Possible arbitrary file read and remote code execution in Active Storage
Active Storage did not disable libvips 'unfuzzed' operations, so an unauthenticated attacker who can upload a crafted file and cause a variant to be generated could read arbitrary files from the server, including the process environment. That environment typically holds secret_key_base and credentials, which may allow escalation to remote code execution or lateral movement.
github.com
Published on github.com
activestorage (RubyGems)
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
Active Storage did not disable libvips operations marked 'unfuzzed' (unsafe for untrusted content), so crafted uploads could invoke them during variant generation.
Impact
An unauthenticated attacker could read arbitrary files from the server, including the process environment, which may in turn allow escalation to remote code execution or lateral movement to external systems.
What the attacker needed
Rails app using libvips for variants; Image uploads allowed from untrusted users; Attacker can upload a crafted file; A variant is generated from that file
The fix
Upgrade activestorage to a patched version, ensure libvips is at least 8.13, and rotate every secret the application process could read.
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.
Active Storage is a Rails component that handles uploaded files, and it uses a library called libvips to make resized copies of images. libvips has some file-format handlers that its authors consider unsafe for untrusted input, and Rails did not turn those off. Because of that, someone who uploads a specially crafted file could make the server read files it should not, such as configuration files containing passwords.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.