Hello DjVuLibre maintainers,
I found two security-relevant crash issues in DjVuLibre involving crafted DjVu files that trigger uncontrolled recursion and stack exhaustion in metadata/text parsing paths.
I reproduced the issues against the current SourceForge DjVuLibre Git tree:
The affected paths are:
ANTa annotation parsing
function: GLParser::parse()
plain Release result: Segmentation fault / rc=139
TXTa text layer parsing
function: DjVuTXT::Zone::decode()
AddressSanitizer also reports stack-overflow for both cases. The demonstrated impact is denial of service / process crash via crafted DjVu files. I am not claiming code execution.
Could you please let me know the preferred private security reporting contact or channel? I can provide the full report, minimized PoCs, SHA256 hashes, build details, plain crash logs, and sanitizer logs privately.
Thank you.
The stack overflow issue for txt chunks has been fixed with commit https://sourceforge.net/p/djvu/djvulibre-git/ci/aacf21be31119f6d436d2e6a5e995c928b633167/ which ensures proper nesting of the zone types.
The stack overflow issue for ant chunks has been left along because the DjVuAnno.cpp parser is mostly deprecated. The print_meta command in djvused is its main residual use. Modern code uses the miniexp parser instead which is a lot less stack intensive (but can still overflow given enough parentheses). I am not too concerned.
Todo: maybe remove DjVuAnno from djvused.