#### 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:
1. Download Jenkins latest weekly from <http://mirrors.jenkins.io/war/latest/jenkins.war>. At the time of this writing, this is 2.180.
2. Start Jenkins (java -jar jenkins.war) and browse to http://<server>:8080/
3. Follow the on screen instructions to begin using Jenkins (initialAdminPW, default plugins etc.).
4. Create a user and give them overall read and job build, configure & read permissions.
5. Create a new "Freestyle Project" named test (the workspace for this project will be located at JENKINS_HOME/workspace/test)
6. Log out of admin user and in as the restricted permission user created above.
7. Select the project and click configure on the left.
8. Tick the "This build is parameterised" box and select File Parameter.
9. For the file location enter: 'dir/../../../pwned' and click save.
10. Click build with parameters and select the file you wish to upload.
11. 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.
The original fix disallowed absolute / relative paths. However, the above path bypasses their validation.
### Solution
Upgrade to Jenkins 2.186.
### Additional References
[https://jenkins.io/security/advisory/2018-10-10/#SECURITY-1074 ](https://jenkins.io/security/advisory/2018-10-10/#SECURITY-1074)
[https://jenkins.io/security/advisory/2019-07-17/#SECURITY-1424 ](https://jenkins.io/security/advisory/2019-07-17/#SECURITY-1424)
### Disclosure Timeline
06/13/2019 - Vulnerability discovered.
06/13/2019 - Vulnerability reported to Jenkins using issue tracker. 90-day date is 9/11/19.
06/13/2019 - Jenkins thanks Tenable for the report.
06/13/2019 - Jenkins asks for clarification about affected versions.
06/14/2019 - Tenable provides clarification.
06/14/2019 - Jenkins thanks Tenable.
06/14/2019 - Jenkins says, "Earliest fix release would be 2.176.2 on July 17, latest possible within disclosure schedule 2.xxx.1 on September 11."
06/14/2019 - Tenable thanks Jenkins for the update.
06/14/2019 - Jenkins confirms the vulnerability exists.
07/02/2019 - Tenable asks for an update.
07/02/2019 - Jenkins plans to release a fix on July 17.
07/03/2019 - Tenable thanks Jenkins for the update.
07/12/2019 - Jenkins ticket added CVE-2019-10352.
07/17/2019 - Jenkins security advisory released.
暂无评论