NVIDIA nvJPEG2000 cSIZ out-of-bounds write vulnerability
The nvJPEG2000 library fails to validate the component index (Cqcc) in a QCC segment against the number of components (Csiz) declared in the SIZ segment, leading to an out-of-bounds write. An attacker can supply a malicious .jp2 file to trigger memory corruption, potentially leading to arbitrary code execution.
Originally disclosed on Cisco Talos
A memory corruption vulnerability exists in the Image Decoding functionality of NVIDIA nvJPEG2000 0.8.0. A specially crafted .jp2 file can lead to an out-of-bounds write.
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 library fails to validate that the component index (Cqcc) from a QCC segment is less than the number of components (Csiz) declared in the SIZ segment before using it to index into the allocated component array.
Impact
This could lead to memory corruption and potentially arbitrary code execution.
What the attacker needed
CUDA-enabled GPU; victim opens a malicious .jp2 file
How it was found
- Craft a .jp2 file with a SIZ segment specifying a small Csiz value.
- Include a QCC segment with a Cqcc value larger than Csiz.
- Open the file with nvJPEG2000 to trigger the out-of-bounds write.
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.
The library reads a number from the file that says how many components the image has, and uses it to allocate an array. Later, it reads another number that says which component to work on, but it does not check that this second number is within the array size. By providing a large number, an attacker can make the library write outside the allocated memory, which can crash the program or allow code execution.
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.