CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-21413

CVE-2026-21413: Heap-Based Buffer Overflow in LibRaw Lossless JPEG Decoder

Alon Barad
Alon Barad
Software Engineer

Apr 9, 2026·4 min read·20 visits

Executive Summary (TL;DR)

A critical heap buffer overflow in LibRaw's CR2 metadata parser allows attackers to execute arbitrary code remotely via maliciously crafted RAW image files.

CVE-2026-21413 is a critical heap-based buffer overflow in the LibRaw library, specifically within the `lossless_jpeg_load_raw` function. Triggered by maliciously crafted RAW files, the vulnerability allows for out-of-bounds memory writes due to improper validation of the `col` index in CR2Slice metadata, resulting in an unauthenticated remote code execution vector.

Vulnerability Overview

LibRaw is an open-source library widely deployed for reading and decoding RAW image files from digital cameras. It serves as a foundational component in numerous downstream image processing applications, including ImageMagick, GIMP, and various operating system media frameworks.

The vulnerability, designated CVE-2026-21413, is a critical heap-based buffer overflow located in the library's lossless_jpeg_load_raw() function. This function handles the decoding of lossless JPEG data embedded within specific RAW formats, predominantly Canon's CR2 format.

The flaw is classified under CWE-129 (Improper Validation of Array Index). It allows an attacker to manipulate the memory space of applications parsing untrusted image files, yielding an unauthenticated remote code execution vector.

Root Cause Analysis

The root cause of CVE-2026-21413 is the absence of adequate boundary checks during the processing of CR2Slice metadata. When LibRaw decodes a CR2 image, it extracts dimension and offset parameters from this metadata to reconstruct the image matrix.

Within the lossless_jpeg_load_raw() execution path, the library utilizes a col (column) index variable derived directly from the parsed CR2Slice data. The code fails to validate whether this col value exceeds the maximum bounds of the dynamically allocated heap buffer reserved for the raw image pixels.

Because the index is trusted implicitly, subsequent memory write operations use the attacker-controlled col value to calculate memory offsets. This enables arbitrary out-of-bounds write primitives on the heap, corrupting adjacent memory structures.

Code Analysis

The vulnerable implementation processes the JPEG slices without verifying the upper limits of the structural parameters. A crafted RAW file can declare abnormally large slice dimensions, directly manipulating the parsing loops.

The fix, introduced in commit 75ed2c12a35b765b3b6ad695cc1f044f19efe644, implements strict bounds checking on the column indices before permitting any memory writes. By evaluating the parsed metadata against the known safe buffer dimensions, the patched code ensures that out-of-bounds indexing is safely aborted.

Any attempt to provide structural dimensions exceeding the allocated pixel array capacity will now trigger an early exit or error state. This structural validation neutralizes the specific metadata manipulation path leveraged by this vulnerability.

Exploitation

Exploitation relies on the target application invoking LibRaw to process an attacker-supplied RAW file. Since no authentication is required, any interface that accepts image uploads or processes images automatically is a viable attack vector.

An attacker constructs a specialized CR2 file where the CR2Slice metadata is strategically altered. By setting the col index to target specific offsets, the attacker forces the application to overwrite adjacent heap metadata or function pointers.

Achieving reliable remote code execution requires precise heap layout manipulation. The attacker must align the target objects in memory so that the out-of-bounds write modifies a critical data structure, redirecting the execution flow to an attacker-controlled payload.

Impact Assessment

The vulnerability carries a maximum CVSS v3.1 score of 9.8, indicating critical severity. A successful exploit results in the complete compromise of the process executing the LibRaw parsing routine.

In a typical web application scenario where user-uploaded images are processed for thumbnail generation or metadata extraction, exploitation yields unauthenticated remote code execution. The attacker inherits the privileges of the processing daemon, often leading to full system compromise or lateral movement within the network.

Alternatively, if reliable code execution fails, the memory corruption predictably leads to application crashes. This introduces a robust denial-of-service vector against automated image processing pipelines.

Remediation

The definitive remediation for CVE-2026-21413 is upgrading the LibRaw library to version 0.22.1 or later. This release incorporates the upstream fix commit 75ed2c12a35b765b3b6ad695cc1f044f19efe644.

System administrators must also identify and update statically linked binaries that package older versions of LibRaw. Downstream software such as ImageMagick and GIMP should be audited and rebuilt against the updated library to ensure comprehensive protection.

If an immediate upgrade is unfeasible, administrators should restrict the uploading and processing of RAW image files, specifically .cr2 files, from untrusted sources. Executing LibRaw-based tasks within isolated sandboxes or containerized environments will limit the blast radius of a successful exploit.

Official Patches

LibRawOfficial patch fixing the out-of-bounds write

Fix Analysis (1)

Technical Appendix

CVSS Score
9.8/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.04%
Top 87% most exploited

Affected Systems

LibRaw versions prior to 0.22.1ImageMagick (when compiled with vulnerable LibRaw)GIMP (when utilizing vulnerable LibRaw plugins)Various Linux distributions bundling LibRaw < 0.22.1

Affected Versions Detail

Product
Affected Versions
Fixed Version
LibRaw
LibRaw
< 0.22.10.22.1
AttributeDetail
CWE IDCWE-129
Attack VectorNetwork
CVSS Score9.8
EPSS Score0.00043
Exploit StatusUnexploited / Theoretical
CISA KEVNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-129
Improper Validation of Array Index

The product uses untrusted input as an array index, but it does not validate or incorrectly validates the index to ensure it references a valid position within the array.

Vulnerability Timeline

Initial discovery and report by Francesco Benvenuto of Cisco Talos
2026-02-12
LibRaw version 0.22.1 released with patch
2026-04-06
Official public disclosure by Cisco Talos
2026-04-07
NVD and CVE.org records finalized
2026-04-08

References & Sources

  • [1]Cisco Talos Advisory
  • [2]CVE Record
  • [3]LibRaw GitHub Repository
  • [4]LibRaw Download Page
  • [5]GitHub Security Advisory

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 9 hours ago•CVE-2026-9306
6.3

CVE-2026-9306: Unauthenticated Insecure Direct Object Reference (IDOR) in QuantumNous new-api Midjourney Relay

CVE-2026-9306 is a critical unauthenticated Insecure Direct Object Reference (IDOR) vulnerability located in the QuantumNous new-api application, affecting versions up to and including 0.12.1. The flaw is caused by improper middleware ordering combined with a lack of object-level authorization checks. This allows remote, unauthenticated attackers to retrieve sensitive Midjourney images belonging to other users by supplying a valid task identifier.

Amit Schendel
Amit Schendel
7 views•5 min read
•1 day ago•GHSA-GGXF-37HM-9WQF
6.5

GHSA-GGXF-37HM-9WQF: Session Leakage via Unsafe Challenge Path Parsing in instagrapi

The instagrapi library prior to version 2.6.9 contains an improper input validation vulnerability within its challenge handling mechanism. Maliciously crafted server responses can manipulate the client into forwarding session cookies and credentials to an external attacker-controlled domain.

Amit Schendel
Amit Schendel
7 views•6 min read
•1 day ago•GHSA-QQQM-5547-774X
9.1

GHSA-QQQM-5547-774X: Unauthenticated Path Traversal in FileBrowser Quantum PATCH Handler

GHSA-QQQM-5547-774X is a critical path traversal vulnerability in the FileBrowser Quantum application, specifically within the Go backend package. The vulnerability resides in the HTTP handler responsible for processing bulk file modifications via the public API. Unauthenticated attackers can exploit an order-of-operations flaw in the path sanitization logic to bypass intended directory restrictions. This allows adversaries to arbitrarily read, move, and overwrite files on the underlying filesystem by supplying specially crafted HTTP PATCH requests.

Alon Barad
Alon Barad
3 views•6 min read
•1 day ago•CVE-2026-8723
5.3

CVE-2026-8723: Synchronous Denial of Service in qs npm Package via TypeError

The qs query string parsing and serialization library for Node.js is vulnerable to a synchronous Denial of Service (DoS) attack. The vulnerability manifests as a process-terminating TypeError when processing arrays with null or undefined elements under specific configuration parameters.

Amit Schendel
Amit Schendel
17 views•7 min read
•1 day ago•GHSA-7M8F-HGJQ-8GC9
7.5

GHSA-7M8F-HGJQ-8GC9: Pre-Authentication Denial of Service via Insecure Deserialization Order in aiosend

The aiosend library prior to version 3.0.6 contains a pre-authentication Denial of Service (DoS) vulnerability in its webhook handling mechanism. The software processes and deserializes incoming JSON payloads before verifying the cryptographic signature, allowing unauthenticated attackers to exhaust server CPU and memory resources by sending large, complex payloads.

Amit Schendel
Amit Schendel
3 views•6 min read
•2 days ago•GHSA-JQQ5-8PX3-9M6M
6.2

GHSA-JQQ5-8PX3-9M6M: Single-Byte Heap Overflow Bypass in ImageMagick JSON and YAML Encoders

A heap-based buffer overflow vulnerability exists in the JSON and YAML encoders of ImageMagick and Magick.NET. This issue constitutes an incomplete fix for CVE-2026-40169, resulting in a single-byte out-of-bounds write (off-by-one error) during image metadata serialization.

Alon Barad
Alon Barad
4 views•6 min read