LibRaw uncompressed_fp_dng_load_raw integer overflow vulnerability
An integer overflow in LibRaw's uncompressed floating-point DNG decoder causes a heap buffer overflow when processing a malicious DNG file with large dimensions. An attacker could exploit this to corrupt heap memory and potentially execute code, but only if the application raises the memory limit above the default.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the uncompressedfpdngloadraw functionality of LibRaw Commit 8dc68e2. A specially crafted malicious file can lead to a heap buffer overflow.
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
The buffer size calculation for the pixel buffer uses 32-bit arithmetic that can overflow, even though a separate 64-bit memory limit check is performed.
Impact
A heap buffer overflow could lead to heap corruption and potential code execution, but only if the application sets max_raw_memory_mb to around 16 GB or more; the default limit of 2048 MB prevents exploitation.
What the attacker needed
Application sets max_raw_memory_mb to ~16 GB or more; attacker provides a malicious DNG file; application calls unpack() on the file
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.
LibRaw is a library that reads raw image files from cameras. A specially crafted image file can make the library miscalculate how much memory to reserve, so it writes image data past the end of that memory. This can crash the program or, in some cases, let an attacker 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.