CVE-2026-20884
Heap Buffer Overflow in LibRaw deflate_dng_load_raw via Integer Overflow
Publication date: 2026-04-07
Last updated on: 2026-04-10
Assigner: Talos
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| libraw | libraw | 0.22.1 |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-190 | The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-20884 is an integer overflow vulnerability in the deflate_dng_load_raw() function of the LibRaw library, which processes deflate-compressed floating-point DNG image files.
The vulnerability occurs because the calculation of the buffer size for image tiles uses 32-bit arithmetic on attacker-controlled values (tile count, tile width, tile height, and samples per pixel) before assigning the result to a 64-bit variable. This causes an integer overflow if the product exceeds the maximum 32-bit value, resulting in an incorrect, smaller buffer size.
Because the buffer is undersized, when tile data is copied into it, a heap buffer overflow occurs, potentially leading to heap corruption and arbitrary code execution.
To exploit this vulnerability, an attacker must provide a specially crafted malicious DNG file and cause the application to increase its memory limit beyond the default to bypass pre-decoder checks.
How can this vulnerability impact me? :
This vulnerability can lead to a heap buffer overflow, which may cause heap corruption and allow an attacker to execute arbitrary code remotely.
If an application using the vulnerable LibRaw library processes a maliciously crafted DNG file, an attacker could exploit this flaw to compromise the system running the application.
The impact includes potential loss of confidentiality, integrity, and availability of the affected system.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability is triggered by processing specially crafted deflate-compressed DNG image files with the vulnerable LibRaw library. Detection involves identifying if your system or application uses the affected LibRaw version (commit 8dc68e2) and monitoring for attempts to process suspicious or unusually large DNG files.
Since the vulnerability arises from integer overflow in tile dimension calculations, you can look for unusually large or malformed DNG files with suspicious TIFF tags that specify large tile counts or dimensions.
Commands to help detect the vulnerability might include:
- Check the LibRaw version in your environment: `ldd /path/to/application | grep libraw` or check the package version via your package manager.
- Scan for large or suspicious DNG files in your file system: `find /path/to/scan -type f -name '*.dng' -exec identify -verbose {} \; | grep -E 'TileWidth|TileHeight|TileCount'` (using ImageMagick's identify or similar tools to inspect TIFF tags).
- Monitor application logs for crashes or heap corruption events related to image processing.
- Use network monitoring tools to detect transfer of suspicious DNG files, especially those with large image dimensions or tile counts.
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation steps include:
- Update LibRaw to the patched version released on 2026-04-06 that fixes this integer overflow vulnerability.
- If updating is not immediately possible, restrict or block processing of untrusted or suspicious DNG files, especially those with large image dimensions or tile counts.
- Ensure that the application does not increase the default max_raw_memory_mb limit beyond the safe default (~2048 MB), as exploitation requires bypassing this limit.
- Implement input validation or filtering on TIFF tags related to tile dimensions and counts to prevent processing of maliciously crafted files.
- Monitor application logs for unusual crashes or memory errors during image processing.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The provided information does not specify any direct impact of this vulnerability on compliance with common standards and regulations such as GDPR or HIPAA.