Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconCraft malicious PNM file with overflow dimensions
-
DeliveryPlace file in accessible location or supply to user
-
ExploitUser/application calls CImg::load() on file
-
InstallInteger overflow in W*H*D calculation bypasses guard
-
C2Undersized heap buffer allocated
-
ExecuteParser writes pixel data beyond buffer
-
ImpactHeap corruption and potential code execution
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Integer overflow checks
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires the target application to load a malicious PNM/PGM/PPM file using CImg's _load_pnm() function. The attacker must either place the file on the target system (local attack vector per CVSS) or convince a user to open it (UI:R interaction requirement). The vulnerability is triggered only when processing image files with crafted large dimensions that cause integer overflow in the W*H*D calculation; standard legitimate PNM files with reasonable dimensions do not trigger the flaw. No special CImg configuration or feature flags are required - the vulnerable code is active in all default builds. The attack does NOT require authentication or elevated privileges (PR:N). Limiting factors: the local attack vector restricts exploitation to scenarios where an attacker can write files to the target system or has local file access; the required user interaction means the user must explicitly load or the application must automatically process a supplied file; and the constraint to PNM/PGM/PPM formats limits applicability to systems specifically handling these older image formats (less common than JPEG/PNG in modern workflows). |
| Impact | CVSS 6.1 reflects moderate severity with attack vector local (AV:L), low complexity (AC:L), no privilege requirement, and user interaction required. The score aggregates information disclosure potential (none: C:N), integrity impact (low: I:L), and availability impact (high: A:H). The local attack vector and required user interaction (UI:R) significantly limit real-world risk compared to network-based vectors. EPSS data not provided; however, the vulnerability requires an attacker to craft a malicious image file and trick a user or application into processing it - a plausible but not trivial attack surface. The heap buffer overflow condition is real once exploitation occurs, potentially causing denial of service or code execution depending on heap layout and mitigation effectiveness. POC exists as the commit diff itself demonstrates the exact vulnerable code path. No KEV (active exploitation) data provided, suggesting limited or no confirmed exploitation in the wild at time of analysis. The patch is straightforward (type promotion via cimg_int64 cast), indicating the issue is well-understood and quickly remediable. Risk is elevated in scenarios where CImg processes untrusted image files (web image uploads, document conversion, automated media processing pipelines) but lower in contexts where only trusted images are processed. |
| Exploit ScenarioDerived | An attacker creates a malicious PNM image file with dimensions such that W*H*D overflows to a small integer (e.g., width=70000, height=70000, depth=3 overflows to ~10MB instead of the legitimate ~14.7GB). When a user or web application loads this file via CImg (e.g., through a document converter or media service), the memory allocation guard accepts the wrapped small size, and the heap buffer is undersized. During pixel data parsing, out-of-bounds writes corrupt adjacent heap memory, causing a crash (DoS) or, in favorable heap layouts, enabling code execution. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 04, 2026
Integer overflow in CImg Library's _load_pnm() function allows crafted PNM/PGM/PPM image files to bypass memory allocation guards via undersized buffer allocation, potentially triggering heap buffer overflow with local file access and user interaction. CVSS 6.1 (local, user-required interaction). Patch available in commit 4ca26bc and v.3.7.5.
RemediationAI
Upgrade CImg Library to version 3.7.5 or later, which includes commit 4ca26bc that corrects the vulnerability by casting W, H, D multiplication to cimg_int64 before comparison. For applications unable to upgrade immediately, implement input validation at the application layer: reject PNM files with width or height exceeding a reasonable threshold (e.g., 65536 pixels per dimension) before passing to CImg::load(). This workaround trades functionality (very large legitimate images will be rejected) but eliminates the attack surface for maliciously crafted dimensions. Additionally, sanitize image file sources: avoid loading PNM images from untrusted or user-uploaded sources without pre-validation; prefer downloading images over HTTPS from trusted servers and verifying file signatures where possible. For development teams, consider sandboxing image processing tasks in separate processes with restricted memory allocation to limit impact of heap overflows.
Affected VersionsENISA
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
CImg is a C++ image processing library that includes a _load_pnm() function to parse Portable Anymap (PNM) format image files, including PGM (grayscale) and PPM (color) variants. The vulnerability exists in the size validation logic where the product W*H*D (width × height × depth) is computed using standard 32-bit integer arithmetic. When dimensions are sufficiently large, this multiplication overflows, wrapping to a small value and bypassing the guard check (siz threshold). This allows allocation of a drastically undersized buffer relative to the image data that follows, creating a classic heap buffer overflow condition when the PNM parser writes image pixel data. The root cause (CWE-190: Integer Overflow or Wraparound) stems from performing arithmetic on user-controlled values without type promotion to a larger integer type before comparison.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:H
Primary rating from Vendor (github) · only source for this CVE.
CVSS VectorVendor: github
Lifecycle Timeline
2DescriptionCVE.org
CImg Library is a C++ library for image processing. Prior to commit 4ca26bc, there is an integer overflow vulnerability in the W*H*D size computation inside _load_pnm() that can bypass the memory allocation guard. A crafted PNM/PGM/PPM file with large dimension values causes the overflow to wrap around, allocating an undersized buffer and potentially triggering a heap buffer overflow. Any application using CImg to load untrusted image files is affected. This issue has been patched via commit 4ca26bc.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.
EUVD-2026-27075
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB