Excessive Expansion: Uncovering Critical Security Vulnerabilities in Jenkins (CVE-2024-23897 & CVE-2024-23898)
Jenkins CLI argument parsing expanded arguments starting with '@' by reading the referenced file, allowing unauthenticated attackers to read the first few lines of arbitrary files and read-only users to read entire files. Separately, the WebSocket CLI endpoint lacked an Origin check, enabling cross-site WebSocket hijacking so a malicious site could run CLI commands as a logged-in victim.
Published on sonarsource.com
Jenkins is the leading open-source automation server widely used for building, deploying, and automating software projects. Originally developed as Hudson, Jenkins has evolved into a powerful tool for continuous integration and continuous delivery (CI/CD).
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
Unauthenticated attackers could read the first few lines of arbitrary files and read-only users entire files, potentially leading to admin privilege escalation and code execution; the WebSocket flaw could let a malicious site run CLI commands as a victim, though modern browsers' lax-by-default cookie policy may limit it.
What the attacker needed
Network access to the Jenkins CLI endpoint; for full file read: read-only access; for CSWSH: victim logged in and clicks a link
How it was found
- Send two POST requests to the Jenkins CLI endpoint with remoting disabled, using a session identifier to pair the uploader and downloader.
- Invoke a CLI command whose argument begins with '@' followed by a file path, so the parser reads that file and expands its lines into arguments.
- Use a command that echoes failed argument names back, such as connect-to-node, to receive the file contents in error messages.
- For the WebSocket flaw, host a page that opens a WebSocket to the Jenkins CLI endpoint and sends CLI commands, then get a logged-in victim to visit it.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Jenkins is a tool that automates building and deploying software. One of its command-line features treated an argument beginning with '@' as a request to read a file and use its lines as further arguments, so an attacker could make Jenkins read files it should not. A second flaw let a malicious website open a WebSocket connection to Jenkins and run commands as a logged-in user, because Jenkins did not check where the connection came from.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.