CVE-2023-25762
Medium · 5.4CVSS
5.4
EPSS
81.4%
Published
Feb 15, 2023
CISA due date
—
Cloudanix analysis
A Jenkins user who can name jobs could plant code that runs in another user’s browser when they view a pipeline helper page, potentially letting the attacker act as that user.
- Exploitation
- Requires User Interaction
- Attacker needs
- Low Privilege
- Complexity
- Moderate
- Impact
- Data Exposure
- Component
- Application
- Class
- XSS
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Jenkins Pipeline: Build Step Plugin 2.18 and earlier fails to properly escape Jenkins job names before inserting them into a JavaScript expression used by the Pipeline Snippet Generator. An authenticated attacker with permission to create or rename jobs can store a malicious job name containing script content. When another user views the affected Pipeline Snippet Generator interface, the attacker-controlled JavaScript executes in that user’s browser in the Jenkins origin. This can allow theft of browser-accessible data, abuse of the victim’s Jenkins session, unauthorized job or configuration changes within the victim’s permissions, and potential chaining with other Jenkins weaknesses or excessive permissions.
Why it matters to the business
A low-privileged Jenkins user who can control job names may be able to compromise higher-privileged users through the web UI. In practical terms, this can lead to unauthorized pipeline changes, exposure of build metadata or secrets visible to the victim, disruption of CI/CD workflows, and a loss of trust in build integrity. Although it is not listed in CISA KEV and has no confirmed ransomware association, the EPSS score is high, indicating elevated likelihood of exploitation activity relative to many other vulnerabilities; Jenkins environments with broad job-creation permissions should treat remediation as urgent.
How an attack unfolds
An attacker first obtains Jenkins access with permissions sufficient to create or rename a job. They create a job whose name contains a JavaScript payload crafted to break out of the vulnerable JavaScript context used by the Pipeline Snippet Generator. The malicious name is stored by Jenkins. The attacker then waits for, or socially engineers, a developer or administrator to open the Pipeline Snippet Generator page where job names are rendered by the Pipeline: Build Step Plugin. When the page loads, the payload executes in the victim’s browser under the Jenkins web origin. From there, the script can attempt to read page content, capture anti-CSRF crumbs or other browser-accessible values, issue authenticated requests as the victim, alter pipeline configuration, trigger builds, or exfiltrate information reachable by the victim’s session. The impact depends heavily on the victim’s Jenkins permissions and the presence of compensating controls such as strict authorization and session protections.
How to fix it
Upgrade Jenkins Pipeline: Build Step Plugin to a fixed version, specifically 2.18.1 or later where available from the Jenkins update center. If centralized plugin management is used, ensure all Jenkins controllers using the plugin receive the updated plugin and are restarted or safely reloaded as required. As a mitigation until upgrade is complete, restrict job create, rename, and configure permissions to trusted users only; review and remove suspicious job names; limit access to the Pipeline Snippet Generator to authenticated trusted users; and enforce least-privilege role assignments so compromised sessions cannot broadly alter CI/CD workflows. Also keep Jenkins core and related Pipeline plugins current, because XSS in Jenkins is often more damaging when combined with overly broad administrative privileges or older plugin vulnerabilities.
How to confirm the fix worked
Confirm the installed Pipeline: Build Step Plugin version is greater than 2.18, preferably 2.18.1 or later. Validate through Jenkins plugin management, the plugin manager API, or the plugin directory metadata on the controller. Review all Jenkins controllers, not only the primary instance, for the vulnerable plugin. As a functional check in a non-production test environment, create a benign job name containing characters that would previously break JavaScript context, such as angle brackets and quotes, and confirm the Pipeline Snippet Generator displays it safely as text rather than executing it. Review authorization settings to ensure only trusted users can create, rename, or configure jobs. Confirm there are no existing job names containing script tags, JavaScript URLs, HTML event handlers, encoded angle brackets, or other browser-executable payload patterns.
Typical attack path
- Gain authenticated access to Jenkins with permission to create, configure, or rename jobs.
- Create or rename a job using a name that contains an XSS payload such as encoded script, event-handler, or JavaScript-breaking syntax.
- Allow the malicious job name to be stored in Jenkins.
- Induce or wait for a more privileged user to open the Pipeline Snippet Generator interface.
- The vulnerable plugin inserts the unescaped job name into JavaScript, causing the payload to execute in the victim’s browser.
- Use the victim’s Jenkins session to read accessible data, perform unauthorized actions, modify CI/CD configuration, trigger builds, or exfiltrate sensitive information.
- Optionally chain the browser-session compromise with excessive Jenkins permissions, exposed credentials, or unsafe pipeline behavior to expand impact.
How to detect it
To determine whether this was already exploited, review Jenkins audit logs, controller logs, web access logs, and reverse-proxy logs for suspicious job creation, copy, configure, or rename activity involving job names with HTML or JavaScript-like content. Search Jenkins job configuration directories and exported job metadata for encoded or literal XSS payloads in job names. Correlate suspicious job-name changes with subsequent visits to Pipeline Snippet Generator pages, especially by administrators or users with broad Jenkins permissions. After such visits, look for unexpected authenticated requests from the victim’s session, including job reconfiguration, credential-management access, build triggers, pipeline script changes, token creation, user configuration changes, or administrative endpoint access. If available, inspect audit trails for actions performed by privileged users that are inconsistent with normal behavior and occurred immediately after they accessed pipeline syntax or snippet generator URLs. Browser forensics may show script execution or outbound connections to attacker-controlled domains, but server-side Jenkins and proxy logs are usually the most reliable evidence sources.
- <script
- </script>
- %3Cscript
- %3C%2Fscript%3E
- javascript:
- onerror=
- onload=
- onclick=
- document.cookie
- Jenkins-Crumb
- /pipeline-syntax/
- /descriptorByName/org.jenkinsci.plugins.workflow.support.steps.build.BuildTriggerStep
- /createItem
- /doRename
- /configSubmit
- jobs/*/config.xml
What your security team should do
- Prioritize upgrading Pipeline: Build Step Plugin to 2.18.1 or later across all Jenkins controllers because the EPSS score indicates heightened exploitation likelihood despite no KEV listing.
- Inventory Jenkins instances and identify where Pipeline: Build Step Plugin 2.18 or earlier is installed.
- Search existing Jenkins job names and configuration files for XSS payload patterns before and after patching.
- Temporarily restrict job creation, rename, and configure permissions to trusted users until the upgrade and review are complete.
- Review Jenkins audit, access, and reverse-proxy logs for suspicious job creation or rename events followed by privileged users accessing Pipeline Snippet Generator pages.
- Investigate any suspicious browser-originated Jenkins actions performed shortly after a user viewed the Pipeline Snippet Generator, especially configuration changes, credential access attempts, build triggers, or script console access attempts.
- Reinforce Jenkins least privilege by separating ordinary developer permissions from administrative, credential-management, and controller-level permissions.
- Ensure Jenkins core and all Pipeline-related plugins are updated, since XSS impact is amplified in outdated or over-permissive Jenkins deployments.
The record
Jenkins Pipeline: Build Step Plugin 2.18 and earlier does not escape job names in a JavaScript expression used in the Pipeline Snippet Generator, resulting in a stored cross-site scripting (XSS) vulnerability exploitable by attackers able to control job names.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Maven | org.jenkins-ci.plugins:pipeline-build-step | 0 | 2.18.1 |
| Red Hat:ocp_tools:4.11::el8 | jenkins | 0 | 0:2.387.1.1683009763-3.el8 |
| Red Hat:ocp_tools:4.11::el8 | jenkins | 0 | 0:2.414.3.1698298955-3.el8 |
| Red Hat:ocp_tools:4.11::el8 | jenkins | 0 | 0:2.426.3.1706516929-3.el8 |
| Red Hat:ocp_tools:4.11::el8 | jenkins-2-plugins | 0 | 0:4.11.1683009941-1.el8 |
| Red Hat:ocp_tools:4.11::el8 | jenkins-2-plugins | 0 | 0:4.11.1698299029-1.el8 |
| Red Hat:ocp_tools:4.11::el8 | jenkins-2-plugins | 0 | 0:4.11.1706516946-1.el8 |
| Red Hat:ocp_tools:4.12::el8 | jenkins | 0 | 0:2.387.1.1683009767-3.el8 |
| Red Hat:ocp_tools:4.12::el8 | jenkins | 0 | 0:2.414.3.1698293911-3.el8 |
| Red Hat:ocp_tools:4.12::el8 | jenkins | 0 | 0:2.426.3.1706515686-3.el8 |
| Red Hat:ocp_tools:4.12::el8 | jenkins-2-plugins | 0 | 0:4.12.1683009955-1.el8 |
| Red Hat:ocp_tools:4.12::el8 | jenkins-2-plugins | 0 | 0:4.12.1698294000-1.el8 |
| Red Hat:ocp_tools:4.12::el8 | jenkins-2-plugins | 0 | 0:4.12.1706515741-1.el8 |
| Red Hat:ocp_tools:4.13::el8 | jenkins | 0 | 0:2.387.3.1684911776-3.el8 |
| Red Hat:ocp_tools:4.13::el8 | jenkins | 0 | 0:2.414.3.1698292201-3.el8 |
| Red Hat:ocp_tools:4.13::el8 | jenkins | 0 | 0:2.426.3.1706516254-3.el8 |
| Red Hat:ocp_tools:4.13::el8 | jenkins-2-plugins | 0 | 0:4.13.1684911916-1.el8 |
| Red Hat:ocp_tools:4.13::el8 | jenkins-2-plugins | 0 | 0:4.13.1698292274-1.el8 |
| Red Hat:ocp_tools:4.13::el8 | jenkins-2-plugins | 0 | 0:4.13.1706516346-1.el8 |
| Red Hat:ocp_tools:4.14::el8 | jenkins | 0 | 0:2.414.3.1699356615-3.el8 |
| Red Hat:ocp_tools:4.14::el8 | jenkins | 0 | 0:2.426.3.1706516352-3.el8 |
| Red Hat:ocp_tools:4.14::el8 | jenkins-2-plugins | 0 | 0:4.14.1699356715-1.el8 |
| Red Hat:ocp_tools:4.14::el8 | jenkins-2-plugins | 0 | 0:4.14.1706516441-1.el8 |
| Red Hat:openshift:4.10::el8 | jenkins-2-plugins | 0 | 0:4.10.1681719745-1.el8 |
Related vulnerabilities
- CVE-2023-1370 [Json-smart](https://netplex.github.io/json-smart/) is a performance focused, JSON… Also affects jenkins
- CVE-2022-42003 In FasterXML jackson-databind before versions 2.13.4.1 and 2.12.17.1, resource exhaustion… Also affects jenkins
- CVE-2022-42004 In FasterXML jackson-databind before 2.13.4, resource exhaustion can occur because of a… Also affects jenkins
- CVE-2024-47804 Jenkins item creation restriction bypass vulnerability Also affects jenkins
- CVE-2024-47803 Jenkins exposes multi-line secrets through error messages Also affects jenkins
- CVE-2024-38808 In Spring Framework versions 5.3.0 - 5.3.38 and older unsupported versions, it is… Also affects jenkins
- CVE-2024-34145 A sandbox bypass vulnerability involving sandbox-defined classes that shadow specific… Also affects jenkins
- CVE-2024-34144 A sandbox bypass vulnerability involving crafted constructor bodies in Jenkins Script… Also affects jenkins