CVE-2026-21413
Heap-Based Buffer Overflow in LibRaw lossless_jpeg_load_raw Function
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.0 |
| libraw | libraw | 0.22.1 |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-129 | The product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array. |
Attack-Flow Graph
AI Powered Q&A
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability in LibRaw allows an attacker to execute remote code by exploiting a heap-based buffer overflow, which can lead to unauthorized access, modification, or disruption of data.
Such unauthorized access and potential data corruption or loss could impact compliance with data protection standards and regulations like GDPR and HIPAA, which require safeguarding the confidentiality, integrity, and availability of sensitive data.
Specifically, the vulnerability affects confidentiality, integrity, and availability (C:H/I:H/A:H), which are core principles in these regulations.
Can you explain this vulnerability to me?
CVE-2026-21413 is a critical heap-based buffer overflow vulnerability in the lossless_jpeg_load_raw() function of the LibRaw library. It occurs because the code uses an attacker-controlled value as an array index without proper validation, allowing writes outside the allocated buffer bounds.
Specifically, the vulnerability arises from improper validation of the 'col' index, which is calculated from malicious CR2Slice metadata in Canon CR2 RAW image files. While the row index is checked, the column index can exceed the buffer width, leading to out-of-bounds writes into the heap memory.
An attacker can craft a malicious RAW image file that triggers this vulnerability, causing heap corruption and potentially enabling remote code execution when the file is processed by LibRaw.
How can this vulnerability impact me? :
This vulnerability can have severe impacts including remote code execution without requiring any privileges or user interaction.
- Confidentiality impact: An attacker could potentially access sensitive information.
- Integrity impact: The attacker could modify memory, leading to corrupted data or altered program behavior.
- Availability impact: The heap corruption could cause application crashes or denial of service.
Overall, processing a maliciously crafted RAW image file could allow an attacker to execute arbitrary code remotely, compromising the affected system.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by monitoring for the processing of malicious CR2 files that exploit the heap-based buffer overflow in the lossless_jpeg_load_raw() function of LibRaw. Detection involves identifying attempts to open or process specially crafted RAW image files that trigger out-of-bounds writes.
One practical approach is to use AddressSanitizer or similar memory error detection tools when running applications that use LibRaw to process RAW images, as this vulnerability was confirmed using AddressSanitizer detecting out-of-bounds writes.
Additionally, you can scan your system for vulnerable versions of LibRaw (specifically those including commits 0b56545 and d20315b) and check logs or application crashes related to RAW image processing.
- Use memory error detection tools like AddressSanitizer when processing RAW files.
- Check application logs for crashes or abnormal behavior during RAW image processing.
- Identify and verify the version of LibRaw installed to confirm if it includes the vulnerable commits.
What immediate steps should I take to mitigate this vulnerability?
The immediate mitigation step is to update LibRaw to the patched version released by the vendor on 2026-04-06, which fixes the heap-based buffer overflow in the lossless_jpeg_load_raw() function.
Until the update can be applied, avoid processing untrusted or malicious CR2 RAW image files, especially those that could contain specially crafted CR2Slice TIFF tags.
- Apply the vendor patch released on 2026-04-06 to update LibRaw to a secure version.
- Restrict or block the intake of untrusted RAW image files in your environment.
- Monitor for unusual application behavior or crashes related to RAW image processing.