CVE-2020-35653
📋 TL;DR
This vulnerability in Pillow's PCX file decoder allows attackers to read beyond allocated memory buffers when processing malicious PCX files. It affects applications using Pillow to handle PCX images, potentially leading to information disclosure or crashes. Any system using vulnerable Pillow versions for image processing is at risk.
💻 Affected Systems
- Pillow (Python Imaging Library fork)
📦 What is this software?
Fedora by Fedoraproject
Fedora by Fedoraproject
Pillow by Python
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution through memory corruption leading to complete system compromise
Likely Case
Application crash (denial of service) or information disclosure from memory
If Mitigated
Application crash with no data loss if proper sandboxing exists
🎯 Exploit Status
Exploitation requires crafting a malicious PCX file with manipulated stride values
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 8.1.0 and later
Vendor Advisory: https://pillow.readthedocs.io/en/stable/releasenotes/index.html
Restart Required: No
Instructions:
1. Update Pillow using pip: 'pip install --upgrade pillow>=8.1.0'
2. Verify installation: 'pip show pillow'
3. Test PCX file processing functionality
🔧 Temporary Workarounds
Disable PCX file processing
allConfigure application to reject or not process PCX files
# Application-specific configuration required
Input validation for image files
allImplement strict validation for uploaded image files before processing
# Implement file type validation in application code
🧯 If You Can't Patch
- Implement strict file upload restrictions to block PCX files
- Run vulnerable applications in sandboxed/containerized environments with limited permissions
🔍 How to Verify
Check if Vulnerable:
Check Pillow version: 'python -c "import PIL; print(PIL.__version__)"' or 'pip show pillow'
Check Version:
python -c "import PIL; print(PIL.__version__)"
Verify Fix Applied:
Confirm version is 8.1.0 or higher using version check command
📡 Detection & Monitoring
Log Indicators:
- Application crashes when processing image files
- Memory access violation errors in logs
- Unusual PCX file uploads
Network Indicators:
- Multiple PCX file upload attempts
- Unusual file upload patterns to image processing endpoints
SIEM Query:
source=application_logs ("PIL" OR "Pillow") AND ("crash" OR "segmentation fault" OR "memory error") AND "PCX"
🔗 References
- https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6BYVI5G44MRIPERKYDQEL3S3YQCZTVHE/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BF553AMNNNBW7SH4IM4MNE4M6GNZQ7YD/
- https://pillow.readthedocs.io/en/stable/releasenotes/index.html
- https://lists.debian.org/debian-lts-announce/2021/07/msg00018.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6BYVI5G44MRIPERKYDQEL3S3YQCZTVHE/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BF553AMNNNBW7SH4IM4MNE4M6GNZQ7YD/
- https://pillow.readthedocs.io/en/stable/releasenotes/index.html