Rails Asset Pipeline Directory Traversal Vulnerability (CVE-2018-3760)
A directory traversal vulnerability existed in Sprockets, the Rails asset pipeline, when runtime asset compilation was enabled. An attacker could craft a URL to trick Sprockets into rendering files outside permitted paths, potentially exposing secrets in the repository or environment variables.
blog.heroku.com
Published on blog.heroku.com
Posted By Richard Schneeman
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the Sprockets server failed to properly validate the requested asset path, allowing an attacker to use a known absolute path to bypass permitted directories.
Impact
If exploited with runtime compilation enabled, secrets in the repository or environment variables could be compromised, though the default production setting is not vulnerable.
What the attacker needed
Config.assets.compile = true in production; known absolute path to a source asset directory
The fix
The vulnerability was fixed by upgrading Sprockets to version 2.12.5, 3.7.2, 4.0.0.beta8 or later, or by disabling runtime asset compilation.
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 write-up has not been written yet. The Original tab links to the source.
Sprockets is a tool that manages website assets like images and stylesheets for Ruby on Rails applications. A directory traversal flaw lets an attacker use a specially crafted web address to access files outside the intended folder, like reading sensitive configuration files. This only worked if a specific setting that compiles assets on the fly was turned on.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.