GHSL-2023-077: Arbitrary file write in the File Parameters Jenkins Plugin - CVE-2023-32986
The File Parameters Plugin for Jenkins did not validate the name of a file parameter, allowing a user with Job/Configure permission to write a file with arbitrary contents to any location on the Jenkins controller. This could lead to arbitrary file write.
Originally disclosed on GitHub Security Lab
Jenkins File Parameters Plugin 285.v757c5b67ac25 and earlier does not restrict a file path in a job parameter, allowing attackers with the Job/Configure permission to upload arbitrary files to the Jenkins controller.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The plugin used the user-supplied parameter name directly to construct a file path without validating or sanitising it, allowing directory traversal.
Impact
An attacker with Job/Configure permission could write a file with arbitrary contents to any location on the Jenkins controller, which may lead to arbitrary file write.
What the attacker needed
Jenkins with File Parameters Plugin; Job/Configure permission
The fix
The issue was fixed in a later release; the plugin should validate the parameter name to prevent path traversal.
How it was found
- Configure a parameterized job with a Stashed File Parameter.
- Set the parameter name to a path traversal sequence pointing to the desired location.
- Execute the job and provide the desired file contents in the parameter.
- The file is written to the specified location on the Jenkins controller.
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 report has not been written yet. The Original tab links to the source.
In Jenkins, a job can have parameters that accept files. The plugin saved the uploaded file using the name provided by the user without checking it. By including '../' sequences in the name, an attacker could make the file be saved outside the intended temporary folder, anywhere on the server.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.