Problem description: On linux installations with X/fvwm, xpdf on a minimal installation will not work properly and crash. The goal of this analysis was to understand the cause of the crash to see if it might be exploitable under more common conditions also, e.g. when rendering embedded pdf via libpoppler from network source.
Default behavior:
After minimal install, rendering of each tested pdf document, e.g. of this test document, failed with a crash. Debugger shows:Starting program: /usr/bin/xpdf.real Test.pdf Warning: Cannot convert string "-*-helvetica-medium-r-normal--12-*-*-*-*-*-iso8859-1" to type FontStruct Warning: Cannot convert string "-*-courier-medium-r-normal--12-*-*-*-*-*-iso8859-1" to type FontStruct Warning: Cannot convert string "-*-times-bold-i-normal--20-*-*-*-*-*-iso8859-1" to type FontStruct Warning: Cannot convert string "-*-times-medium-r-normal--16-*-*-*-*-*-iso8859-1" to type FontStruct Error: PDF file is damaged - attempting to reconstruct xref table... ***** MediaBox = ll:0,0 ur:595.28,841.89 ***** CropBox = ll:0,0 ur:595.28,841.89 ***** Rotate = 0 ***** page 1 ***** ***** MediaBox = ll:0,0 ur:595.28,841.89 ***** CropBox = ll:0,0 ur:595.28,841.89 ***** Rotate = 0 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7796420 in GooHash::hash(GooString*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 (gdb) bt #0 0x00007ffff7796420 in GooHash::hash(GooString*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #1 0x00007ffff7796472 in GooHash::find(GooString*, int*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #2 0x00007ffff779660e in GooHash::lookup(GooString*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #3 0x00007ffff7748be4 in GlobalParams::getResidentUnicodeMap(GooString*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #4 0x00007ffff774a2f3 in GlobalParams::getUnicodeMap2(GooString*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #5 0x00007ffff778d3da in TextPage::coalesce(bool, bool) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #6 0x00007ffff77921ba in TextOutputDev::endPage() () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #7 0x00007ffff77252e7 in Gfx::~Gfx() () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #8 0x00007ffff7761ce2 in Page::displaySlice(OutputDev*, double, double, int, bool, bool, int, int, int, int, bool, Catalog*, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #9 0x00007ffff7761d7b in Page::display(OutputDev*, double, double, int, bool, bool, bool, Catalog*, bool (*)(void*), void*, bool (*)(Annot*, void*), void*) () from /usr/lib/x86_64-linux-gnu/libpoppler.so.19 #10 0x0000000000415432 in ?? () #11 0x0000000000418631 in ?? () #12 0x000000000041b15d in ?? () #13 0x00000000004130f5 in ?? () #14 0x00000000004275fa in ?? () #15 0x00000000004194f3 in ?? () #16 0x000000000040b694 in ?? () #17 0x00007ffff651476d in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6 ... (gdb) x/1i $rip => 0x7ffff7796420 <_ZN7GooHash4hashEP9GooString>: mov 0x20(%rsi),%r8 (gdb) info registers ... rsi 0x1010001 16842753 ...
Dump of assembler code for function _ZN12GlobalParams15getTextEncodingEv: => 0x00007ffff774a3e0 <+0>: mov 0x80(%rdi),%rsi
psCrop no psExpandSmaller no psShrinkLarger no psCenter no psDuplex no
Last modified 20120602
Contact e-mail: me (%) halfdog.net