CVE-2019-19950

9.8 CRITICAL

📋 TL;DR

CVE-2019-19950 is a use-after-free vulnerability in GraphicsMagick's error handling functions that allows attackers to execute arbitrary code or cause denial of service. This affects systems running vulnerable versions of GraphicsMagick that process untrusted image files. The vulnerability is particularly dangerous because GraphicsMagick is widely used in web applications for image processing.

💻 Affected Systems

Products:
  • GraphicsMagick
Versions: GraphicsMagick 1.4 snapshot-20190403 Q8 and earlier versions
Operating Systems: Linux, Unix-like systems, Windows
Default Config Vulnerable: ⚠️ Yes
Notes: Any system using GraphicsMagick to process image files is vulnerable. The vulnerability is triggered when processing malformed image files.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Denial of service through application crashes, with potential for limited code execution in specific configurations.

🟢

If Mitigated

Application crashes without code execution if exploit attempts are blocked or memory protections are enabled.

🌐 Internet-Facing: HIGH - GraphicsMagick is commonly used in web applications that process user-uploaded images, making internet-facing systems prime targets.
🏢 Internal Only: MEDIUM - Internal systems processing images from untrusted sources remain vulnerable, though attack surface is reduced.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Proof-of-concept code exists in the bug tracker. Exploitation requires crafting a malicious image file that triggers the use-after-free condition.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: GraphicsMagick 1.4 snapshot-20190404 and later

Vendor Advisory: http://hg.graphicsmagick.org/hg/GraphicsMagick/rev/44ab7f6c20b4

Restart Required: Yes

Instructions:

1. Update GraphicsMagick to version 1.4 snapshot-20190404 or later. 2. For package managers: 'apt-get update && apt-get upgrade graphicsmagick' on Debian/Ubuntu, 'yum update graphicsmagick' on RHEL/CentOS. 3. Restart any services using GraphicsMagick.

🔧 Temporary Workarounds

Disable GraphicsMagick image processing

linux

Temporarily disable GraphicsMagick functionality until patching is possible

# Remove or rename GraphicsMagick binaries
sudo mv /usr/bin/gm /usr/bin/gm.disabled
# Or disable specific services using GraphicsMagick

Implement input validation

all

Reject suspicious image files before processing with GraphicsMagick

# Example: Check file type before processing
file --mime-type uploaded_image.jpg | grep -q 'image/' || exit 1

🧯 If You Can't Patch

  • Implement strict file upload restrictions and validation for image files
  • Run GraphicsMagick in a sandboxed environment with limited privileges

🔍 How to Verify

Check if Vulnerable:

Check GraphicsMagick version: 'gm version | head -1'. If version is 1.4 snapshot-20190403 Q8 or earlier, system is vulnerable.

Check Version:

gm version | head -1

Verify Fix Applied:

After update, verify version is 1.4 snapshot-20190404 or later: 'gm version | head -1'

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault errors in application logs
  • GraphicsMagick crash reports
  • Unexpected process termination

Network Indicators:

  • Unusual image file uploads to web applications
  • Multiple failed image processing attempts

SIEM Query:

source="application.log" "segmentation fault" OR "GraphicsMagick" AND "crash"

🔗 References

📤 Share & Export