CVE-2023-51105
📋 TL;DR
A divide-by-zero vulnerability in Artifex MuPDF's BMP image processing allows attackers to crash the application via specially crafted BMP files. This affects all users of MuPDF 1.23.4 and earlier versions that process untrusted BMP images. The vulnerability can lead to denial of service and potential memory corruption.
💻 Affected Systems
- Artifex MuPDF
📦 What is this software?
Mupdf by Artifex
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution through memory corruption following the floating point exception, potentially allowing full system compromise.
Likely Case
Application crash (denial of service) when processing malicious BMP files, potentially disrupting document processing workflows.
If Mitigated
Controlled crash with no data loss if application runs with proper privilege separation and input validation.
🎯 Exploit Status
Proof of concept available in public repositories. Exploitation requires delivering a malicious BMP file to be processed by MuPDF.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Fixed in commit cee86dc519d5270a3b96476ad15809ceace64a26
Vendor Advisory: https://bugs.ghostscript.com/show_bug.cgi?id=707622
Restart Required: Yes
Instructions:
1. Update MuPDF to version after commit cee86dc519d5270a3b96476ad15809ceace64a26
2. Rebuild from source or obtain patched binaries
3. Restart all MuPDF processes and dependent applications
🔧 Temporary Workarounds
Disable BMP processing
allConfigure MuPDF to reject or skip BMP file processing
Modify MuPDF configuration to disable BMP support
Input validation
allImplement file type validation before passing to MuPDF
Add BMP file validation in wrapper scripts or applications
🧯 If You Can't Patch
- Implement strict file upload controls to block BMP files from untrusted sources
- Run MuPDF in sandboxed/containerized environments with limited privileges
🔍 How to Verify
Check if Vulnerable:
Check MuPDF version with 'mupdf --version' and verify if it's 1.23.4 or earlier
Check Version:
mupdf --version
Verify Fix Applied:
Verify the commit hash includes cee86dc519d5270a3b96476ad15809ceace64a26 or test with known malicious BMP files
📡 Detection & Monitoring
Log Indicators:
- Floating point exception errors
- SIGFPE signals
- MuPDF crash logs with bmp_decompress_rle4 stack traces
Network Indicators:
- Unusual BMP file transfers to systems running MuPDF
SIEM Query:
process_name:"mupdf" AND (event_type:"crash" OR error_message:"floating point" OR error_message:"divide by zero")
🔗 References
- http://cgit.ghostscript.com/cgi-bin/cgit.cgi/mupdf.git/commit/?id=cee86dc519d5270a3b96476ad15809ceace64a26
- https://bugs.ghostscript.com/show_bug.cgi?id=707622
- https://github.com/dongyuma/sox-defects/blob/main/mupdf-defects.md
- http://cgit.ghostscript.com/cgi-bin/cgit.cgi/mupdf.git/commit/?id=cee86dc519d5270a3b96476ad15809ceace64a26
- https://bugs.ghostscript.com/show_bug.cgi?id=707622
- https://github.com/dongyuma/sox-defects/blob/main/mupdf-defects.md