# Remote code execution on Basecamp.com

Uploading a PostScript/EPS file renamed .gif to Basecamp's profile image converter triggered Ghostscript CVE-2017-8291, yielding remote command execution.

- Payout: $5,000
- Severity: critical
- Program: Basecamp
- Found by: gammarex
- Disclosed: 2020-11-26
- CVE: CVE-2017-8291
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/365271
- Library page: https://bugbountylibrary.com/r/h1%3A365271
- Tags: area:web domain:web impact:internal-access impact:rce kind:bounty platform:hackerone sev:critical tech:linux technique:chained vuln:file-upload vuln:rce

**Target:** Profile image upload / server-side image conversion (ImageMagick/GraphicsMagick + Ghostscript)
**Root cause:** Image converter invokes Ghostscript on PostScript input (detected by '%!' magic) without validating the file is a real image; the bundled Ghostscript version is vulnerable to CVE-2017-8291.
**Steps:**
1. Craft a PostScript/EPS payload exploiting CVE-2017-8291, embedding a shell command (e.g. `ping -c1 attacker.com`).
2. Rename the payload to `rce.gif` to pass extension checks.
3. Upload it as the profile image.
4. Server-side conversion passes the file to Ghostscript, executing the embedded command.
**How found:** Recognized that server-side image conversion likely uses ImageMagick/GraphicsMagick, which delegates PostScript to Ghostscript; hypothesized that renaming an EPS/PS file to .gif would bypass extension checks and reach the vulnerable interpreter.
**Exploitation:** Attacker uploads a .gif-renamed PostScript file; the image pipeline detects '%!' and hands it to vulnerable Ghostscript, executing arbitrary shell commands as the conversion process, giving a remote shell.
**Escalation:** From the remote shell, proceed to further exploitation/privilege escalation on the host.
**Insight:** When a target does server-side image conversion, test polyglot/renamed PostScript or other non-image formats that ImageMagick delegates to external interpreters (Ghostscript, etc.); extension checks don't stop magic-byte-based delegation.

