Skip to content
Path traversal Write-up Intermediate

Major Jenkins core vulnerability (CVE-2024-23897)

Jenkins' built-in CLI command parser expanded an @ followed by a file path into that file's contents, letting attackers read arbitrary files on the controller. With Overall/Read permission entire files could be read, and without it the first few lines, which in some setups could be leveraged further, including remote code execution.

jenkins.io

Published on jenkins.io

Jenkins has a built-in command line interface (CLI) to access Jenkins from a script or shell environment.

The author, on jenkins.io

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

Root cause

The args4j command parser's expandAtFiles feature, which substitutes @file arguments with file contents, was left enabled by default when processing CLI commands.

Impact

Attackers with Overall/Read permission could read entire files, and those without it could read the first few lines; combined with reading binary key files this could lead to remote code execution, though binary reads are limited by the controller's character encoding and are infeasible on UTF-8 systems.

What the attacker needed

Network access to the Jenkins CLI; Overall/Read for full file contents; binary key read needs non-UTF-8 encoding

The fix

Jenkins 2.442, LTS 2.426.3 and LTS 2.440.1 disable the command parser feature that replaces an @ character followed by a file path with the file's contents for CLI commands.

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 builds and tests software, and it has a command line interface so scripts can talk to it. Its argument parser had a convenience feature: if an argument started with an @ sign and a file path, it swapped in the contents of that file. Because this was on by default, someone could ask Jenkins to read files it should never show them, such as key files.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.