HexBrain

Basecamp · Report #365271

Remote code execution on Basecamp.com

Validstatus
criticalseverity
$5,000bounty
417upvotes
26 Nov 2020disclosed

How it was found

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

This report was disclosed publicly on HackerOne and belongs to its author and the program. See the original