Bug 580105 (CVE-2010-0206)

Summary: CVE-2010-0206 xpdf: Invalid pointer dereference by processing JBIG2 PDF stream objects
Product: [Other] Security Response Reporter: Jan Lieskovsky <jlieskov>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: bressers, jnovy, mkasik, security-response-team, than, twaugh
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-04-19 15:29:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jan Lieskovsky 2010-04-07 13:53:55 UTC
An invalid pointer dereference was found in the way xpdf
processed JBIG2 PDF stream objects in the PDF file catalog.
If a local user was tricked into opening a specially-crafted
Portable Document Format (PDF) file, it could lead to denial
of service (xpdf crash) or, potentially, to arbitrary code
execution with the privileges of the user running xpdf.

Comment 11 Josh Bressers 2010-04-14 18:28:38 UTC
(In reply to comment #10)
> i tested xpdf-3.00-23.el4_8.1.i386. The sample1.pdf caused a crash xpdf but no
> crash in pdftops.    

This crash is a NULL pointer dereference:
Program received signal SIGSEGV, Segmentation fault.
0x08076cf4 in ~JArithmeticDecoder (this=0x8838628) at JArithmeticDecoder.cc:107
107	  return (Guint)str->getChar() & 0xff;
(gdb) print str
$1 = (class Stream *) 0x0


I'll do some additional testing, but I suspect this is a DoS only

Comment 12 Josh Bressers 2010-04-14 20:18:32 UTC
I got the same results as above with gpdf and kpdf.

I'm going to write this one off as a DoS only, which matches the results Canonical found.

Comment 15 Tomas Hoger 2010-04-19 15:29:59 UTC
Closing this one not-a-security-bug, as it's NULL pointer dereference only (see comment #11 and comment #12).

Comment 16 Tomas Hoger 2010-04-20 09:41:01 UTC
(In reply to comment #11)

> This crash is a NULL pointer dereference:
> Program received signal SIGSEGV, Segmentation fault.
> 0x08076cf4 in ~JArithmeticDecoder (this=0x8838628) at JArithmeticDecoder.cc:107
> 107   return (Guint)str->getChar() & 0xff;
> (gdb) print str
> $1 = (class Stream *) 0x0

The crash in recent poppler versions is different, but still NULL pointer dereference issue.  JBIG2Bitmap::getSlice() gets called with large values in wA/hA arguments:

http://cgit.freedesktop.org/poppler/poppler/tree/poppler/JBIG2Stream.cc?id=e9501070#n740

It calls JBIG2Bitmap::JBIG2Bitmap():

http://cgit.freedesktop.org/poppler/poppler/tree/poppler/JBIG2Stream.cc?id=e9501070#n700

which contains protection against integer overflow / under-allocation of the data[] buffer, and leaves data set to NULL if integer overflow is detected.

JBIG2Bitmap::getSlice() subsequently calls JBIG2Bitmap::clearToZero(), which does memset(data, ...), resulting in NULL pointer dereference crash.

Comment 17 Tomas Hoger 2010-05-19 09:22:56 UTC
Reported upstream:
  https://bugs.freedesktop.org/show_bug.cgi?id=28170