CVE-2021-21646: Remote code execution vulnerability in Jenkins Templating Engine Plugin

Summary

24/05/2022
Yes i
High
8.8

CVE-2021-21646: Remote code execution vulnerability in Jenkins Templating Engine Plugin. Affects org.jenkins-ci.plugins:templating-engine versions < 2.2. Fixed in 2.2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The Jenkins Templating Engine Plugin is a Maven-based package that provides a templating engine for Jenkins pipeline configurations. It allows users to define reusable templates for their pipelines, improving code reusability and maintainability. The plugin integrates with the Script Security Plugin to ensure the security of pipeline configurations. However, versions 2.1 and earlier of the Templating Engine Plugin do not properly protect pipeline configurations, making them vulnerable to remote code execution attacks.

Vulnerability Detail

The vulnerability (CVE-2021-21646) in the Jenkins Templating Engine Plugin allows attackers with Job/Configure permission to execute arbitrary code in the context of the Jenkins controller JVM. This means that an attacker can gain control over the Jenkins server and potentially perform malicious actions. The vulnerability arises from the lack of protection provided by the Script Security Plugin in versions 2.1 and earlier of the Templating Engine Plugin. The issue has a CVSSv3 score of 8.8, indicating a high severity level.

How To Fix

Minimum fixed version

2.2

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to version 2.2 is not immediately feasible, a workaround is to restrict Job/Configure permission to trusted users only. By limiting access to this permission, the risk of exploitation can be mitigated. However, this is a temporary solution, and upgrading to the latest version is still strongly recommended.

Conclusion

The remote code execution vulnerability in Jenkins Templating Engine Plugin (CVE-2021-21646) poses a significant risk to Jenkins servers running versions 2.1 and earlier of the plugin. To mitigate this vulnerability, it is crucial to upgrade to version 2.2 or later, which integrates with the Script Security Plugin to protect pipeline configurations. Restricting Job/Configure permission to trusted users can provide a temporary workaround, but upgrading to the latest version is strongly recommended. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.jenkins-ci.plugins:templating-engine →

Share this vulnerability

FAQ

This vulnerability allows attackers to execute arbitrary code on the Jenkins server, potentially leading to unauthorized access, data breaches, or disruption of services.

Users of Jenkins Templating Engine Plugin versions 2.1 and earlier are affected by this vulnerability.

At the time of this advisory, there are no known public exploits targeting this vulnerability. However, it is important to patch the vulnerability as soon as possible to prevent any potential exploitation.

A temporary mitigation is to restrict Job/Configure permission to trusted users only. However, this is not a permanent solution, and upgrading to the latest version of the Templating Engine Plugin is strongly recommended.

For more information about this vulnerability, you can refer to the official CVE-2021-21646 advisory or contact the Jenkins community for assistance.

Related vulnerabilities

Recent vulnerabilities recorded for org.jenkins-ci.plugins:templating-engine.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.2

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback