Skip to main content

CImg Library EUVDEUVD-2026-27075

| CVE-2026-42144 MEDIUM
Integer Overflow or Wraparound (CWE-190)
2026-05-04 security-advisories@github.com
6.1
CVSS 3.1 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Craft malicious PNM file with overflow dimensions
  2. Delivery
    Place file in accessible location or supply to user
  3. Exploit
    User/application calls CImg::load() on file
  4. Install
    Integer overflow in W*H*D calculation bypasses guard
  5. C2
    Undersized heap buffer allocated
  6. Execute
    Parser writes pixel data beyond buffer
  7. Impact
    Heap 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

CImg < 4ca26bce4d8c61fcd1507d5f9401b9fb1222c27d

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

Vendor (github) PRIMARY 6.1 MEDIUM
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

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
High

Lifecycle Timeline

2
Patch available
May 04, 2026 - 19:17 EUVD
CVE Published
May 04, 2026 - 18:16 nvd
MEDIUM 6.1

DescriptionCVE.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

EPSS Score
0.0%
Top 98% exploitable
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GitHub VulDB

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy