Synopsis
CVE-2019-10352: Path Traversal Arbitrary File Write
A path traversal vulnerability exists in core/src/main/java/hudson/model/FileParameterValue.java that allows authenticated attackers with Job/Configure permission to define a file parameter with a file name outside the intended directory, resulting in an arbitrary file write on the Jenkins master when scheduling a build.
Proof of Concept
Below is a series of instructions to follow in order to reproduce the vulnerability:
- Download Jenkins latest weekly from http://mirrors.jenkins.io/war/latest/jenkins.war. At the time of this writing, this is 2.180.
- Start Jenkins (java -jar jenkins.war) and browse to http://<server>:8080/
- Follow the on screen instructions to begin using Jenkins (initialAdminPW, default plugins etc.).
- Create a user and give them overall read and job build, configure & read permissions.
- Create a new "Freestyle Project" named test (the workspace for this project will be located at JENKINS_HOME/workspace/test)
- Log out of admin user and in as the restricted permission user created above.
- Select the project and click configure on the left.
- Tick the "This build is parameterised" box and select File Parameter.
- For the file location enter: 'dir/../../../pwned' and click save.
- Click build with parameters and select the file you wish to upload.
- With the path supplied above, the file will be written to the JENKINS_HOME/workspace directory (it is the intended behaviour that it should only be permitted to be written under the project workspace - in this case JENKINS_HOME/workspace/test). However, it may be written to anywhere on the filesystem that the user running Jenkins has permission to write.
Solution
Upgrade to Jenkins 2.186.Additional References
https://jenkins.io/security/advisory/2018-10-10/#SECURITY-1074https://jenkins.io/security/advisory/2019-07-17/#SECURITY-1424
Disclosure Timeline
All information within TRA advisories is provided “as is”, without warranty of any kind, including the implied warranties of merchantability and fitness for a particular purpose, and with no guarantee of completeness, accuracy, or timeliness. Individuals and organizations are responsible for assessing the impact of any actual or potential security vulnerability.
Tenable takes product security very seriously. If you believe you have found a vulnerability in one of our products, we ask that you please work with us to quickly resolve it in order to protect customers. Tenable believes in responding quickly to such reports, maintaining communication with researchers, and providing a solution in short order.
For more details on submitting vulnerability information, please see our Vulnerability Reporting Guidelines page.
If you have questions or corrections about this advisory, please email [email protected]