CVE-2021-40262
Medium · 6.5CVSS
6.5
EPSS
0.7%
Published
Aug 22, 2023
CISA due date
—
Cloudanix analysis
A flaw in an image handling tool can make programs crash when opening certain picture files, which might stop related services from working.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The vulnerability causes stack exhaustion in the Validate function of PluginRAW.cpp when processing certain RAW image files, leading to application crash due to memory corruption.
Why it matters to the business
Applications using FreeImage may crash when loading specially crafted RAW images, interrupting image processing services and potentially causing denial of service in dependent systems. With over 1157 days since publication and available exploits, unpatched systems remain at risk.
How an attack unfolds
An attacker crafts a malicious RAW image file designed to trigger excessive recursion or stack allocation in the Validate function. When a vulnerable application processes this file, it leads to stack exhaustion and crash.
How to fix it
Upgrade FreeImage to version 1.18.0 or later to address the stack exhaustion issue in PluginRAW.cpp.
How to confirm the fix worked
Verify the installed FreeImage version is 1.18.0 or higher. Test image loading functionality with known problematic RAW files to confirm stability.
Typical attack path
- Craft a malicious RAW image file that exploits the Validate function
- Deliver the file to a target application using FreeImage library
- Trigger image processing to cause stack exhaustion and denial of service
How to detect it
Monitor for unexpected crashes or high stack usage in applications using FreeImage during image file processing. Review logs for errors related to RAW file validation.
What your security team should do
- Update FreeImage library to the latest version immediately
- Scan for and replace any instances of older FreeImage versions in the environment
- Implement input validation or sandboxing for image processing where possible
The record
A stack exhaustion issue was discovered in FreeImage before 1.18.0 via the Validate function in PluginRAW.cpp.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Debian:11 | freeimage | 0 | No fix |
| Debian:12 | freeimage | 0 | No fix |
| Debian:13 | 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-31570 In FreeImage library version 3.19.0 [r1909], when reading images in XPM format, the… 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