Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Jenkins Path Traversal / Arbitrary File Write

Medium

Synopsis

Tenable discovered that the patch for CVE-2018-1000406 (SECURITY-1074) is inadequate.

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.

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.

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]

Risk Information

CVE ID: CVE-2019-10352
Tenable Advisory ID: TRA-2019-35
Credit:
Conor O'Neill
CVSSv2 Base / Temporal Score:
4.0 / 3.1
CVSSv2 Vector:
(AV:N/AC:L/Au:S/C:N/I:P/A:N)
Affected Products:
Jenkins (core) prior to 2.186
Risk Factor:
Medium

Advisory Timeline

07/17/2019 - Initial advisory released.