CVE-2024-31570
NoneCVSS
—
EPSS
0.6%
Published
Apr 12, 2024
CISA due date
—
Cloudanix analysis
A problem in a common image-handling component lets attackers run their own programs simply by tricking the software into opening a specially made picture file.
- Exploitation
- Requires User Interaction
- Attacker needs
- None
- Complexity
- Moderate
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Stack-based buffer overflow write in the Load() function during XPM image parsing allows an attacker to overwrite the stack and achieve arbitrary code execution.
Why it matters to the business
Processing a malicious image file with an affected application can result in full system compromise, data theft, or ransomware deployment; the library's wide use in imaging and graphics tools increases exposure across many products.
How an attack unfolds
An attacker creates a specially crafted XPM file that triggers excessive data writes during parsing; the file is supplied to any application that invokes FreeImage's Load() routine on untrusted input, causing the overflow and subsequent shellcode execution.
How to fix it
Update the FreeImage library to the latest available version that resolves the XPM parsing flaw; if no update exists, disable XPM support or sandbox applications that process untrusted images.
How to confirm the fix worked
Confirm the FreeImage version in use is newer than 3.19.0 r1909; test that malformed XPM files no longer cause crashes or unexpected code paths in the Load() function.
Typical attack path
- Craft malicious XPM image that exceeds expected buffer sizes
- Deliver the image via file upload, email attachment, or web content
- Victim application calls FreeImage Load() on the XPM data
- Overflow overwrites return address or stack variables
- Attacker-supplied code executes with the privileges of the host process
How to detect it
Review application and system logs for segmentation faults or crashes immediately after XPM image loading attempts; correlate with file-access events involving .xpm extensions from untrusted sources.
What your security team should do
- Inventory all applications and dependencies that ship or link FreeImage
- Prioritize patching or replacing the library in internet-facing or high-privilege contexts
- Implement input validation or file-type restrictions to block XPM where feasible
- Add runtime monitoring for image-processing crashes as a temporary control
The record
In FreeImage library version 3.19.0 [r1909], when reading images in XPM format, the Load() function has a stack overflow write vulnerability, which may lead to a command execution.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | freeimage | 0 | No fix |
| Debian:12 | freeimage | 0 | No fix |
| Debian:13 | freeimage | 0 | No fix |
| Debian:14 | freeimage | 0 | No fix |
| Ubuntu:20.04:LTS | freeimage | 0 | No fix |
| Ubuntu:22.04:LTS | freeimage | 0 | No fix |
| Ubuntu:24.04:LTS | freeimage | 0 | No fix |
| Ubuntu:24.10 | freeimage | 0 | No fix |
| Ubuntu:25.04 | freeimage | 0 | No fix |
| Ubuntu:25.10 | freeimage | 0 | No fix |
| Ubuntu:Pro:14.04:LTS | freeimage | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | freeimage | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | freeimage | 0 | No fix |
| Ubuntu:Pro:20.04:LTS | freeimage | 0 | No fix |
Related vulnerabilities
- CVE-2024-9029 A flaw was found in the freeimage library. Also affects freeimage
- CVE-2024-28583 Buffer Overflow vulnerability in open source FreeImage v.3.19.0 [r1909] allows a local… Also affects freeimage
- CVE-2024-28584 Null Pointer Dereference vulnerability in open source FreeImage v.3.19.0 [r1909] allows a… Also affects freeimage
- CVE-2024-28578 Buffer Overflow vulnerability in open source FreeImage v.3.19.0 [r1909] allows a local… Also affects freeimage
- CVE-2024-28579 Buffer Overflow vulnerability in open source FreeImage v.3.19.0 [r1909] allows a local… Also affects freeimage
- CVE-2024-28580 Buffer Overflow vulnerability in open source FreeImage v.3.19.0 [r1909] allows a local… Also affects freeimage
- CVE-2024-28582 Buffer Overflow vulnerability in open source FreeImage v.3.19.0 [r1909] allows a local… Also affects freeimage
- CVE-2024-28577 Null Pointer Dereference vulnerability in open source FreeImage v.3.19.0 [r1909] allows a… Also affects freeimage