CVE-2023-34152

9.8 CRITICAL

📋 TL;DR

CVE-2023-34152 is a critical remote code execution vulnerability in ImageMagick's OpenBlob function when compiled with --enable-pipes configuration. Attackers can exploit this by processing malicious images, potentially gaining full system control. This affects any system using vulnerable ImageMagick versions with pipes enabled.

💻 Affected Systems

Products:
  • ImageMagick
Versions: Versions before 7.1.1-15 and 6.9.12-90
Operating Systems: Linux, Unix-like systems, Windows
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when compiled with --enable-pipes configuration. Many distributions disable this by default.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with root/admin privileges, data exfiltration, ransomware deployment, and persistent backdoor installation.

🟠

Likely Case

Remote code execution with the privileges of the ImageMagick process, leading to data theft, lateral movement, or cryptomining.

🟢

If Mitigated

Limited impact due to sandboxing, minimal privileges, or network segmentation preventing full system compromise.

🌐 Internet-Facing: HIGH - Any internet-facing service processing user-uploaded images with vulnerable ImageMagick is at immediate risk.
🏢 Internal Only: MEDIUM - Internal systems processing images from untrusted sources remain vulnerable to insider threats or compromised internal systems.

🎯 Exploit Status

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

Exploitation requires processing a malicious image file. Public PoC exists in GitHub issues.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: ImageMagick 7.1.1-15 and 6.9.12-90

Vendor Advisory: https://access.redhat.com/security/cve/CVE-2023-34152

Restart Required: Yes

Instructions:

1. Update ImageMagick using your package manager: 'sudo apt update && sudo apt upgrade imagemagick' (Debian/Ubuntu) or 'sudo yum update imagemagick' (RHEL/CentOS). 2. Restart any services using ImageMagick. 3. Verify the update with 'convert --version'.

🔧 Temporary Workarounds

Disable pipe support

linux

Recompile ImageMagick without --enable-pipes configuration

./configure --disable-pipes
make
sudo make install

Use policy.xml restrictions

all

Limit ImageMagick's capabilities via policy configuration

Edit /etc/ImageMagick-7/policy.xml or /etc/ImageMagick-6/policy.xml to restrict delegate execution

🧯 If You Can't Patch

  • Isolate ImageMagick processing to dedicated, sandboxed containers with minimal privileges
  • Implement strict input validation and file type checking before passing images to ImageMagick

🔍 How to Verify

Check if Vulnerable:

Check ImageMagick version with 'convert --version' or 'magick --version'. If version is below 7.1.1-15 (for ImageMagick 7) or 6.9.12-90 (for ImageMagick 6), and compiled with pipes enabled, it's vulnerable.

Check Version:

convert --version | head -1

Verify Fix Applied:

Confirm version is 7.1.1-15 or higher (ImageMagick 7) or 6.9.12-90 or higher (ImageMagick 6) using 'convert --version'.

📡 Detection & Monitoring

Log Indicators:

  • Unusual process execution from ImageMagick
  • Suspicious command execution in system logs following image processing
  • Failed image processing attempts with malformed files

Network Indicators:

  • Outbound connections from ImageMagick processes to unexpected destinations
  • Unusual data exfiltration following image uploads

SIEM Query:

process.name:"convert" OR process.name:"magick" AND (process.args:"pipe" OR process.args:"|" OR process.args:"sh" OR process.args:"bash")

🔗 References

📤 Share & Export