NVIDIA nvJPEG2000 Default Coding Styles Ndecomp buffer overflow vulnerability
A heap-based buffer overflow exists in NVIDIA nvJPEG2000 0.8.0 because the Ndecomp field from a JPEG2000 file is used without bounds checking to initialise a heap buffer. An attacker could supply a crafted JPEG2000 file to corrupt adjacent memory and potentially achieve arbitrary code execution.
Originally disclosed on Cisco Talos
A heap based buffer overflow vulnerability exists in the way Ndecomp parameter is used when parsing JPEG2000 files in NVIDIA nvJPEG2000 0.8.0 library. A specially crafted JPEG2000 file can lead to a memory corruption and arbitrary code execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Ndecomp value from the COD segment is used as a length in memset calls without validating it against the allocated buffer size.
Impact
The overflow could corrupt adjacent memory and potentially lead to arbitrary code execution, though the written data is not attacker-controlled.
What the attacker needed
CUDA-enabled GPU; victim opens a crafted JPEG2000 file
The fix
The library should validate the Ndecomp value against the allocated buffer size before using it in memory writes.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A heap buffer overflow happens when a program writes more data into a memory area than that area can hold, spilling into neighbouring memory. Here, a number taken from a JPEG2000 image file is used to decide how much memory to fill, but the program never checks whether that number is too large. An attacker could craft a malicious image file that causes the program to overwrite nearby memory, which might let them run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.