CVE-2026-47667: CWE-401: Missing Release of Memory after Effective Lifetime in GreycLab CImg
Description
CImg Library is a C++ library for image processing. Prior to version 4.0.0 in `_load_analyze()`, the header_size field is read as an `unsigned int` from the first 4 bytes of an Analyze/NIfTI file and passed directly to `new unsigned char[header_size]` without being bounded against the actual file size. A value up to ~4 GB is accepted. If the subsequent `fread` returns `short` as it will for any malformed file), the function throws a `CImgIOException` and the allocated buffer is never freed. A 6-byte crafted file is sufficient to trigger an allocation of ~1.3 GB per call, with the full allocation leaked on every error path. The issue is reachable via `load_analyze()` and the generic `load()` when the file extension is .hdr, .img, or .nii. Version 4.0.0 fixes the issue.
CVSS v3.1
Score 7.5high
Affected software
GreycLab
CImg
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The CImg Library before version 4.0.0 has a vulnerability (CVE-2026-47667) in the _load_analyze() function where the header_size field from an Analyze/NIfTI file is read as an unsigned int and used directly to allocate memory without validating it against the actual file size. If fread returns fewer bytes than expected due to a malformed file, the function throws an exception but does not free the allocated buffer, causing a memory leak. A crafted 6-byte file can trigger an allocation of approximately 1.3 GB per call, leaking memory on every error path. This affects the load_analyze() and generic load() functions for files with .hdr, .img, or .nii extensions. The vulnerability is fixed in version 4.0.0.
Potential Impact
This vulnerability can cause a denial of service by exhausting system memory through repeated memory leaks triggered by malformed input files. There is no impact on confidentiality or integrity reported. The CVSS score is 7.5 (high severity) with network attack vector, low attack complexity, no privileges required, no user interaction, and impact limited to availability.
Mitigation Recommendations
Upgrade to CImg version 4.0.0 or later, where this issue is fixed. There is no official patch advisory beyond this version update. Until upgraded, avoid processing untrusted Analyze/NIfTI files with extensions .hdr, .img, or .nii to prevent triggering the memory leak.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-19T21:10:38.797Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a5fd4a41010f89cc224946f
Added to database: 07/21/2026, 20:20:52 UTC
Last enriched: 07/30/2026, 05:17:21 UTC
Last updated: 10/19/2026, 06:48:17 UTC
Views: 128
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.