Path Traversal on Default Installed Rails Application (Asset Pipeline)
Sprockets allowed crafted requests to read files outside the application's root directory when the Sprockets server was used in production.
Originally disclosed on HackerOne
- Triaged in 2 hours
- Fixed in 5 months
- Paid in 5 months
- Disclosed after 6 months
Summary by the program
There is an information leak vulnerability in Sprockets. This vulnerability has been assigned the CVE identifier CVE-2018-3760.
Versions Affected: 4.0.0.beta7 and lower, 3.7.1 and lower, 2.12.4 and lower. Not affected: NONE Fixed Versions: 4.0.0.beta8, 3.7.2, 2.12.5
Impact
Specially crafted requests can be used to access files that exists on the filesystem that is outside an application's root directory, when the Sprockets server is used in production.
All users running an affected release should either upgrade or use one of the work arounds immediately.
Releases
The 4.0.0.beta8, 3.7.2 and 2.12.5 releases are available at the normal locations.
Workarounds
In Rails applications, work around this issue, set config.assets.compile = false and
config.public_file_server.enabled = true in an initializer and precompile the assets.
This work around will not be possible in all hosting environments and upgrading is advised.
Patches
To aid users who aren't able to upgrade immediately we have provided patches for the three supported release series. They are in git-am format and consist of a single changeset.
- 4-0-fix-path-traversal.patch - Patch for the 4.0.x release series
- 3-7-fix-path-traversal.patch - Patch for the 3.7.x release series
- 2-12-fix-path-traversal.patch - Patch for the 2.12.x release series
Credits
Thanks to Orange Tsai from DEVCORE for reporting this issue.
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
Impact
An attacker could read files outside the application's root directory on the server filesystem.
What the attacker needed
Sprockets server used in production; affected version of Sprockets
The fix
The vulnerability was fixed in Sprockets versions 4.0.0.beta8, 3.7.2, and 2.12.5; users should upgrade or apply the provided patches.
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.
Sprockets is a tool Rails uses to manage static files. A path traversal bug lets an attacker read files outside the intended folder. It affects servers running Sprockets in production.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.