GHSL-2025-055: OOB Write in MMRDecoder::scanruns() in DjVuLibre - CVE-2025-53367
The MMRDecoder::scanruns() method in DjVuLibre fails to check that the xr pointer stays within the allocated buffers, leading to an out-of-bounds write and heap corruption. An attacker could exploit this to gain arbitrary code execution in applications that use DjVuLibre, such as the default document viewer on many Linux distributions.
Originally disclosed on GitHub Security Lab
MMRDecoder::scanruns() has an out-of-bounds write vulnerability which can cause memory corruption.
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 scanruns() function does not validate that the xr pointer remains within the bounds of the lineruns and prevruns buffers before writing to them.
Impact
This out-of-bounds write could be used to gain arbitrary code execution in an application that uses DjVuLibre, such as the default document viewer on many Linux distributions.
What the attacker needed
Victim opens a malicious DjVu file
The fix
The vulnerability was fixed in commit [redacted] and DjVuLibre version 3.5.29 was released.
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.
DjVuLibre is a library for reading DjVu files, a document format. A function that decodes compressed image data writes into a buffer without checking if it has reached the end, so it can write past the buffer and corrupt memory. This can let an attacker run their own code on the victim's computer.
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.