CVE-2022-32547
📋 TL;DR
This CVE is an alignment vulnerability in ImageMagick's property.c file where misaligned memory access for double and float types can cause undefined behavior. It affects applications that process untrusted image files using vulnerable ImageMagick versions, potentially leading to crashes or availability issues. Any system using ImageMagick to handle user-uploaded or external images is at risk.
💻 Affected Systems
- ImageMagick
- ImageMagick6
📦 What is this software?
Fedora by Fedoraproject
Imagemagick by Imagemagick
Imagemagick by Imagemagick
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution or complete system compromise through memory corruption, though this is less likely given the alignment nature of the vulnerability.
Likely Case
Application crashes, denial of service, or unpredictable behavior when processing maliciously crafted image files.
If Mitigated
Minimal impact if proper input validation and sandboxing are implemented, with crashes contained to the ImageMagick process.
🎯 Exploit Status
Exploitation requires crafting specific image files that trigger the alignment issue. While unauthenticated exploitation is possible via file upload, weaponization status is unclear from public sources.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: ImageMagick 7.1.0-39 and ImageMagick6 6.9.12-39
Vendor Advisory: https://github.com/ImageMagick/ImageMagick/commit/eac8ce4d873f28bb6a46aa3a662fb196b49b95d0
Restart Required: Yes
Instructions:
1. Identify ImageMagick version with 'convert --version' or 'magick --version'. 2. Update via package manager: 'apt update && apt upgrade imagemagick' (Debian/Ubuntu) or 'yum update imagemagick' (RHEL/CentOS). 3. Restart services using ImageMagick. 4. For source installations, download patched version from ImageMagick website and recompile.
🔧 Temporary Workarounds
Disable vulnerable image formats
linuxRemove or disable ImageMagick's ability to process potentially malicious image formats via policy.xml
Edit /etc/ImageMagick-6/policy.xml or /etc/ImageMagick-7/policy.xml
Add: <policy domain="coder" rights="none" pattern="*" />
Implement input validation
allValidate and sanitize all image inputs before processing with ImageMagick
Use file type verification before passing to ImageMagick
Implement size limits and format restrictions
🧯 If You Can't Patch
- Implement strict input validation and file type checking for all image uploads
- Run ImageMagick in a sandboxed/containerized environment with limited privileges
🔍 How to Verify
Check if Vulnerable:
Check ImageMagick version: 'convert --version' or 'magick --version'. If version is below 7.1.0-39 (ImageMagick7) or 6.9.12-39 (ImageMagick6), system is vulnerable.
Check Version:
convert --version 2>/dev/null || magick --version 2>/dev/null || echo 'ImageMagick not found'
Verify Fix Applied:
After patching, verify version is at or above patched versions. Test with known safe image processing to ensure functionality.
📡 Detection & Monitoring
Log Indicators:
- ImageMagick process crashes or segmentation faults in system logs
- Unusual image processing errors in application logs
- Failed image conversion attempts with malformed files
Network Indicators:
- Unusual volume of image uploads to vulnerable endpoints
- Requests with crafted image files to image processing services
SIEM Query:
source="*syslog*" AND ("segmentation fault" OR "SIGSEGV") AND process="convert" OR process="magick"
🔗 References
- https://bugzilla.redhat.com/show_bug.cgi?id=2091813
- https://github.com/ImageMagick/ImageMagick/commit/eac8ce4d873f28bb6a46aa3a662fb196b49b95d0
- https://github.com/ImageMagick/ImageMagick6/commit/dc070da861a015d3c97488fdcca6063b44d47a7b
- https://lists.debian.org/debian-lts-announce/2023/05/msg00020.html
- https://bugzilla.redhat.com/show_bug.cgi?id=2091813
- https://github.com/ImageMagick/ImageMagick/commit/eac8ce4d873f28bb6a46aa3a662fb196b49b95d0
- https://github.com/ImageMagick/ImageMagick6/commit/dc070da861a015d3c97488fdcca6063b44d47a7b
- https://lists.debian.org/debian-lts-announce/2023/05/msg00020.html