Remote code execution on Basecamp.com
The profile image upload accepted PostScript/EPS files disguised as GIFs, and the server-side image converter invoked Ghostscript, which was vulnerable to CVE-2017-8291. An attacker could upload a crafted file to run shell commands on the server and gain a remote shell.
- Fixed in 5 hours
- Paid in 5 hours
- Disclosed after 2.5 years
A critical flaw in Basecamp's profile image upload function leads to remote command execution. Images are converted on the server side, but not only image files but also PostScript/EPS files are accepted (if renamed to .gif). This is probably due to ImageMagick / GraphicsMagick being used for image conversion, which calls a PostScript interpreter (Ghostscript) if the input file starts with '%!'. The used Ghostscript version however has a security bug (CVE-2017-8291) leading to remote command execution.
/Proof of concept/: Upload the attached rce.gif file as profile image (change the `ping -c1 attacker.com' to some other shell command).
/Mitigation/: Upgrade Ghostscript; also, before processing uploaded images make sure they are real image files (e.g. based on magic header)
Impact
Gain a remote shell; from here start exploitation/privilege escalation
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
Root cause
Likely the upload check relied on the file extension and the image converter passed PostScript content to a vulnerable Ghostscript version.
Impact
An attacker could gain a remote shell and from there start exploitation or privilege escalation.
What the attacker needed
Ability to upload a profile image
The fix
Ghostscript should be upgraded and uploaded files should be checked to be real images, for example by their magic header, before processing.
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.
A website let people upload a picture for their profile. The server used a tool to convert the picture, but that tool could also read a different file type that can contain instructions. Because the tool was out of date, those instructions could run commands on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.