Skip to content
Info disclosure Write-up Advanced

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.

Yaniv Nizry Follow

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).

Yaniv Nizry (@YNizry), on sonarsource.com

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

  1. Send two POST requests to the Jenkins CLI endpoint with remoting disabled, using a session identifier to pair the uploader and downloader.
  2. 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.
  3. Use a command that echoes failed argument names back, such as connect-to-node, to receive the file contents in error messages.
  4. 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.

More by Yaniv Nizry

View all

7 more disclosed reports, best first.

More from Jenkins

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.