OpenCV Heap Buffer Write Vulnerability in JPEG Image Processing

Vulnerability

A vulnerability in OpenCV versions prior to 4.12.0 allows for an uninitialized pointer on the stack to cause arbitrary writes to the heap. This issue arises when the library processes specially crafted JPEG images. The vulnerability stems from the JPEG 2000 decoder, where a pointer variable is not properly initialized before being used, leading to potential memory corruption.

Impact

Exploitation of this vulnerability can result in a heap-use-after-free condition, allowing for memory corruption that could be leveraged for arbitrary code execution.

Reproduction

The vulnerability can be reproduced by using OpenCV's image decoding functions with crafted JPEG 2000 data that exploits the uninitialized pointer issue. This can be done by creating a C++ program that uses the OpenCV library to decode the manipulated JPEG 2000 images, triggering the vulnerability in the process.

Remediation

Users can upgrade to OpenCV version 4.12.0 or later, where this vulnerability has been fixed.

Added: Jul 17, 2025, 6:22 PM
Updated: Jul 17, 2025, 6:22 PM

Vulnerability Rating

Custom Algorithm
spread
7.8
impact
7.5
exploitability
6.0
remediation
7.7
relevance
0.3
threat
6.4
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.