Recursive function call in function JBIG2Stream::readGenericBitmap() – poppler 0.74.0
Loginsoft-2019-1100
28 February, 2019
CVE Number
CVE-2019-9545
CWE
CWE - 20 : Improper Input Validation
Product Details
Poppler is a free software utility library for rendering Portable Document Format documents.URL:https://gitlab.freedesktop.org/poppler/poppler/
Vulnerable Versions
0.74.0
Vulnerability Details
During our research there is a recursive function call, in JBIG2Stream::readTextRegion()
located in JBIG2Stream.cc in poppler 0.74.0. The same be triggered by sending a crafted pdf file to the pdfimages binary. It allows an attacker to cause Denial of Service (Segmentation fault) or possibly have unspecified other impact.
SYNOPSIS
In Progress
Vulnerable Source code
JBIG2Stream::readTextRegion()
Analysis
DEBUG:
GDB :
[ Legend: Modified register | Code | Heap | Stack | String ]
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ registers ]────
$rax : 0x7fff8cf5c800 → 0x0000000000000000
$rbx : 0x3be980
$rcx : 0x7fff8cff5000 → 0x0000000000000000
$rdx : 0x7fff8d31b180 → 0x0000000000000000
$rsp : 0x7fffffffc158 → 0x00007ffff6e78cdf → mov rcx, QWORD PTR [rbp-0x38]
$rbp : 0x7fffffffc9e0 → 0x00007fffffffca00 → 0x00007fffffffcdb0 → 0x00007fffffffd3b0 → 0x00007fffffffd5f0 → 0x00007fffffffd620 → 0x00007fffffffd640 → 0x00007fffffffd740
$rsi : 0x0
$rdi : 0x7fff8cf5c800 → 0x0000000000000000
$rip : 0x7ffff5b58963 → movdqa XMMWORD PTR [rcx], xmm0
$r8 : 0x1000719e3900 → 0x0000000000000000
$r9 : 0x100071a5b630 → 0xfafafafafafafa01
$r10 : 0x4032
$r11 : 0x202
$r12 : 0x7fff8cf5c800 → 0x0000000000000000
$r13 : 0x7fff8d31b180 → 0x0000000000000000
$r14 : 0x0
$r15 : 0x0
$eflags: [zero carry parity adjust sign trap INTERRUPT direction overflow RESUME virtualx86 identification]
$fs: 0x0000 $gs: 0x0000 $ds: 0x0000 $cs: 0x0033 $es: 0x0000 $ss: 0x002b
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ stack ]────
0x00007fffffffc158│+0x00: 0x00007ffff6e78cdf → mov rcx, QWORD PTR [rbp-0x38] ← $rsp
0x00007fffffffc160│+0x08: 0x00007ffff6726e6f → mov QWORD PTR [rbp-0x2d8], r14
0x00007fffffffc168│+0x10: 0x00007ffff6722a77 → add rsp, 0xb0
0x00007fffffffc170│+0x18: 0x00007ffff671f5a2 → xor eax, 0x1
0x00007fffffffc178│+0x20: 0x00007ffff671e351 → mov rax, QWORD PTR [rbp-0x18]
0x00007fffffffc180│+0x28: 0x00007ffff6609541 → nop
0x00007fffffffc188│+0x30: 0x00007ffff673bee2 → nop
0x00007fffffffc190│+0x38: 0x00007ffff66354eb → 0x00000040bfe6894d → 0x0000000000000000
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ code:i386:x86-64 ]────
0x7ffff5b5895a and rdx, 0xffffffffffffffc0
0x7ffff5b5895e cmp rcx, rdx
0x7ffff5b58961 je 0x7ffff5b58923
→ 0x7ffff5b58963 movdqa XMMWORD PTR [rcx], xmm0
0x7ffff5b58967 movdqa XMMWORD PTR [rcx+0x10], xmm0
0x7ffff5b5896c movdqa XMMWORD PTR [rcx+0x20], xmm0
0x7ffff5b58971 movdqa XMMWORD PTR [rcx+0x30], xmm0
0x7ffff5b58976 add rcx, 0x40
0x7ffff5b5897a cmp rdx, rcx
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ threads ]────
[
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[ trace ]────
[
[
[
[
[
[
[
[
[
[
Proof of Concept
pdfimages -f 1 -l 1 -opw testing -upw testing -j -p –q $POC output
Timeline
Vendor Disclosure: 2019-3-1
Public Disclosure:2019-3-2
Credit
Discovered by ACE Team - Loginsoft