Cloudanix VulnDB

CVE-2021-40262

Medium · 6.5

CVSS

6.5

EPSS

0.7%

Published

Aug 22, 2023

CISA due date

—

Cloudanix analysis

Monitor only SSVC: Track

A flaw in an image handling tool can make programs crash when opening certain picture files, which might stop related services from working.

Exploit Available
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

  1. Craft a malicious RAW image file that exploits the Validate function
  2. Deliver the file to a target application using FreeImage library
  3. 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