Exploit-DB #39942
Description: Foxit PDF Reader 1.0.1.0925 - CFX_WideString::operator= Invalid Read
Type: dos
Platform: linux
Date: 2016-06-13
Author: Google Security Research

Exploit:
Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=745

We have identified the following crash due to an invalid read in Foxit PDF Reader (version 1.0.1.0925 for Linux 64-bit), when started with a specially crafted PDF file in the following way:

$ DISPLAY=:1 FoxitReader /path/to/poc/file.pdf

The DISPLAY=:1 environment variable is set due to the fact that we are testing the application with a virtual X server (Xvfb), but the issue should be equally reproducible with the program started with standard display settings, too.

An example excerpt from the crash log is as follows:

--- cut ---
Program received signal SIGSEGV, Segmentation fault.
0x[PII_REDACTED]ab467f in CFX_WideString::operator=(CFX_WideString const&) ()
(gdb) where
#0  0x[PII_REDACTED]ab467f in CFX_WideString::operator=(CFX_WideString const&) ()
#1  0x[PII_REDACTED]6c53a8 in CRichTextXML::ParseXML2Text(CXML_Element*, CRichTextXML::STYLE*, CRichTextXML::STYLE*) ()
#2  0x[PII_REDACTED]6c5357 in CRichTextXML::ParseXML2Text(CXML_Element*, CRichTextXML::STYLE*, CRichTextXML::STYLE*) ()
#3  0x[PII_REDACTED]6c5357 in CRichTextXML::ParseXML2Text(CXML_Element*, CRichTextXML::STYLE*, CRichTextXML::STYLE*) ()
#4  0x[PII_REDACTED]6c6364 in CRichTextXML::ParseXML2Text() ()
#5  0x[PII_REDACTED]6c6a33 in CRichTextXML::SetXML(wchar_t const*, wchar_t const*) ()
#6  0x[PII_REDACTED]6c9d49 in CFX_Edit::SetRichTextByXML(wchar_t const*, wchar_t const*, int, int) ()
#7  0x[PII_REDACTED]67e995 in CPWL_Note_Contents::SetRichText(CFX_WideString const&) ()
#8  0x[PII_REDACTED]67e9e5 in CPWL_NoteItem::SetRichContents(CFX_WideString const&) ()
#9  0x[PII_REDACTED]5cbcc7 in CMarkup_Popup::SetNoteContents(CFX_WideString const&, CReader_PageView*) ()
#10 0x[PII_REDACTED]5ca0e7 in CMarkup_Popup::InitNote(CReader_PageView*) ()
#11 0x[PII_REDACTED]5ca420 in CMarkup_Popup::CreateNote(CReader_PageView*, int) ()
#12 0x[PII_REDACTED]5cd578 in CMarkup_Popup::UpdateNote(CReader_PageView*, int) ()
#13 0x[PII_REDACTED]5d2475 in CMarkup_AnnotHandler::OnPageVisible(CReader_PageView*, CReader_Annot*) ()
#14 0x[PII_REDACTED]6e733e in CTA_AnnotHandler::OnPageVisible(CReader_PageView*, CReader_Annot*) ()
#15 0x[PII_REDACTED]640424 in CBA_PageEventHandler::OnPageVisible(CReader_PageView*) ()
#16 0x[PII_REDACTED]461d1b in CReader_AppEx::OnPageVisible (this=0x14a5120, pDocView=0x19446a0)
    at ../../Readerlite/ReaderLite/src/frd_appex.cpp:2901
#17 0x[PII_REDACTED]450bec in CReader_ViewPage::DoPageVisibleAction (this=0x1944670)
    at ../../Readerlite/ReaderLite/src/preview.cpp:3204
x#18 0x[PII_REDACTED]44b980 in CPDF_TVPreview::Slot_DoPageVisibleEvent (this=0x1943180)
    at ../../Readerlite/ReaderLite/src/preview.cpp:1443
#19 0x[PII_REDACTED]44e333 in CPDFViewerEventHandler::OnFinishRender (this=0x194c520)
    at ../../Readerlite/ReaderLite/src/preview.cpp:2386
#20 0x[PII_REDACTED]61db28 in CPDFViewerEx::ContinueRendering() ()
#21 0x[PII_REDACTED]61de17 in CPDFViewerEx::GetRenderData(int) ()
#22 0x[PII_REDACTED]44b274 in CPDF_TVPreview::paintEvent (this=0x1943180)
    at ../../Readerlite/ReaderLite/src/preview.cpp:1305
#23 0x00007ffff74c2302 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007ffff7486c8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff748be56 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007ffff6340c2d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff74bcbea in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#28 0x00007ffff74bd5bc in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007ffff74bc786 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#30 0x00007ffff74bd5bc in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#31 0x00007ffff74bd434 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#32 0x00007ffff74bc786 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#33 0x00007ffff74bd5bc in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#34 0x00007ffff74bc786 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#35 0x00007ffff74bd5bc in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#36 0x00007ffff74bd434 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
---Type <return> to continue, or q <return> to quit---   
   from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#37 0x00007ffff74bd434 in QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
   from /usr/lib/x86_64-linu