CVE-2026-23874

5.5 MEDIUM

📋 TL;DR

ImageMagick versions before 7.1.2-13 have a stack overflow vulnerability in the MSL (Magick Scripting Language) <write> command when writing to MSL format, caused by infinite recursion. This can lead to denial of service or potential arbitrary code execution. Anyone using vulnerable ImageMagick versions to process MSL scripts is affected.

💻 Affected Systems

Products:
  • ImageMagick
Versions: All versions prior to 7.1.2-13
Operating Systems: All operating systems running ImageMagick
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects systems where ImageMagick processes MSL (Magick Scripting Language) format files. Many deployments may not use MSL functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise if an attacker can trigger the infinite recursion with crafted MSL input.

🟠

Likely Case

Denial of service causing ImageMagick to crash when processing malicious MSL scripts.

🟢

If Mitigated

Limited impact if MSL processing is disabled or input validation blocks malicious scripts.

🌐 Internet-Facing: MEDIUM - Exploitable if ImageMagick processes user-uploaded MSL files, but requires specific MSL format usage.
🏢 Internal Only: LOW - Typically requires intentional or accidental processing of malicious MSL scripts internally.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires crafting MSL files that trigger infinite recursion in the <write> command. No public exploit code is currently known.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 7.1.2-13

Vendor Advisory: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-9vj4-wc7r-p844

Restart Required: No

Instructions:

1. Check current ImageMagick version with 'convert --version' or 'magick --version'. 2. Update to version 7.1.2-13 or later using your package manager (apt-get upgrade imagemagick, yum update imagemagick, etc.). 3. Verify update with version check command.

🔧 Temporary Workarounds

Disable MSL format processing

linux

Remove MSL format from ImageMagick's policy.xml to prevent processing of MSL files

Edit /etc/ImageMagick-7/policy.xml or /etc/ImageMagick-6/policy.xml
Add or modify: <policy domain="coder" rights="none" pattern="MSL" />

Input validation for MSL files

all

Implement server-side validation to reject or sanitize MSL file uploads

🧯 If You Can't Patch

  • Implement strict input validation to block MSL file uploads or processing
  • Use application-level sandboxing or containerization to limit ImageMagick's impact if exploited

🔍 How to Verify

Check if Vulnerable:

Run 'convert --version' or 'magick --version' and check if version is below 7.1.2-13

Check Version:

convert --version | head -1 || magick --version | head -1

Verify Fix Applied:

Confirm version is 7.1.2-13 or higher using version check command

📡 Detection & Monitoring

Log Indicators:

  • ImageMagick process crashes with segmentation faults
  • High CPU usage from ImageMagick processes
  • Repeated MSL file processing failures

Network Indicators:

  • Unusual uploads of MSL format files to web applications

SIEM Query:

process_name:"convert" OR process_name:"magick" AND (event_type:crash OR exit_code:139)

🔗 References

📤 Share & Export