Closed
Bug 157202
Opened 23 years ago
Closed 23 years ago
Exploitable (?) heap overrun in PNG
Categories
(Core :: Security, defect)
Tracking
()
VERIFIED
FIXED
mozilla1.0.1
People
(Reporter: security-bugs, Assigned: pavlov)
References
Details
(Whiteboard: [adt1 rtm] [ETA 07/23])
Attachments
(4 files, 6 obsolete files)
1.00 KB,
patch
|
dougt
:
review+
tor
:
superreview+
chofmann
:
approval+
|
Details | Diff | Splinter Review |
592 bytes,
image/png
|
Details | |
4.38 KB,
patch
|
dougt
:
review+
tor
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
1.35 KB,
patch
|
dougt
:
review+
tor
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
Subject:
exploitable heap corruption via PNG Alpha data
From:
zen-parse <zen-parse@gmx.net>
Date:
Sat, 13 Jul 2002 04:04:56 +1200 (NZST)
This problem allows execution of arbitrary code via Netscape 6.2.3.
Product: Netscape 6.x
Platform: Unix: x86 Linux
Operating system version: Redhat 7.0
exploitable heap corruption via PNG Alpha data
I believe the fault lies somewhere around here:
http://lxr.mozilla.org/mozilla/source/gfx2/src/gfxImageFrame.cpp#326
A specially crafted invalid PNG, with reported dimensions of 65536x65536
such as and an 8-bit alpha channel (most likely, similar overflowing
values as well, such as 65531x32771 with 16-bit alpha, if that is
supported),can cause controllable heap corruption, overwriting (at least)
a pointer to a function pointer that allows arbitary code to be executed.
An example exploit for this is on:
http://crash.ihug.co.nz/~Sneuro/pngkiller2.tar.gz
The code is somewhat commented and explains what I believe is happening,
although it was written while offline, and so without access to the source
to verify the accuracy.
However, this is a DIFFERENT problem to the previously reported PNG
problem.
Reporter | ||
Comment 1•23 years ago
|
||
Adding keywords, this sounds quite serious. Could someone (pavlov?) confirm this
crash?
Whiteboard: [adt1 rtm]
Updated•23 years ago
|
Assignee | ||
Comment 2•23 years ago
|
||
I wasn't seeing the crash on my solaris box, but I'll try it on a few other
machines. I am having trouble building the crash code due to missing libraries
and headers.
Reporter | ||
Comment 3•23 years ago
|
||
From Georgi:
Bug 157202 Exploitable (?) heap overrun in PNG really seems exploitable.
I had problems running the programs (probably because they need a lot of
disk space).
But the supplied laa.png really crashes mozilla in a nasty way - writes 0x42 to
the stack.
Georgi
Reporter | ||
Comment 4•23 years ago
|
||
Also, does this cause a crash on Windows?
Assignee | ||
Comment 5•23 years ago
|
||
where did Georgi find laa.png?
Two problems at first glance:
* nsImageGTK uses signed shorts to describe alpha data metrics. Changing
them in nsImageGTK.h to PRUInt32s should eliminate that problem.
* mozilla doesn't sanity check the amount of memory requested for an image.
The example file (laa.png) wants 65536*65536*4 bytes.
Along the lines of excessive memory use, I'm not aware that we have any limit
to the total amount of memory used by the image cache for a page. A possible
DOS attack would be to create a page with a number of large dimension solid
block pngs (which compress into trivially small files).
Assignee | ||
Comment 7•23 years ago
|
||
this should fix the overflow on linux. the overflow doesn't occur on the other
platforms.
Comment 8•23 years ago
|
||
Stuart Parmenter: the file laa.png is in the tar pngkiller2.tar.gz
Comment 9•23 years ago
|
||
Removing adt1.0.1, until this has been reviewed and verified on the trunk.
Who can review and supper review Pav's patch?
Keywords: adt1.0.1
Whiteboard: [adt1 rtm] [ETA Needed] → [adt1 rtm] [ETA 07/20]
Assignee | ||
Comment 10•23 years ago
|
||
dougt: can you r=? tor: can you sr=?
Comment 11•23 years ago
|
||
Comment on attachment 91785 [details] [diff] [review]
change int16s to int32s
do we have any logic that depends on the size of these ?
if not and assuming that this is well tested, r=dougt
Attachment #91785 -
Flags: review+
Comment 12•23 years ago
|
||
Comment on attachment 91785 [details] [diff] [review]
change int16s to int32s
sr=tor
There's some logic in the alpha compositing that will break down if
screen dimensions get bigger than 16 bits, but since the X protocol
will break first we're safe.
Attachment #91785 -
Flags: superreview+
Comment 13•23 years ago
|
||
Pav - Looks like you have the reviews. Can you pls land this on the trunk
tonight, so that we can have it verified by bindu tomorrow? thanks!
Keywords: adt1.0.1
Comment 14•23 years ago
|
||
Comment on attachment 91785 [details] [diff] [review]
change int16s to int32s
a=chofmann for trunk/1.1b
Attachment #91785 -
Flags: approval+
Assignee | ||
Comment 15•23 years ago
|
||
landed on trunk.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 16•23 years ago
|
||
Bindu, can you verify this on the trunk?
Comment 17•23 years ago
|
||
I disagree with Comment #7 "the overflow doesn't occur on the other
platforms."
The file laa.png crashes moz1.0 on win2k.
Are you sure the fix in *gtk* also fixes win2k?
Comment 18•23 years ago
|
||
Attached png consumes even more memory and still crashes latest CVS build on at
least linux.
Comment 19•23 years ago
|
||
I think this bug should be reopened per my 2 previous comments.
Today's linux CVS build passes the crash with laa.png (the reporters testcase)
but if it is modified a little mozilla still crashes with the attached to this
bug testcase.
http://bugzilla.mozilla.org/attachment.cgi?id=91955&action=view
Comment 20•23 years ago
|
||
As I mentioned in comment 6, the nsImageGTK change is only a small portion
of the problem.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 21•23 years ago
|
||
My testcase seems to abort() mozilla and doesn't seem exploitable on linux IMHO.
The problem is a signed/unsigned issue.
Comment 22•23 years ago
|
||
Verified on 2002-07-19-trunk build on Win 2K and Linux.
Try to open the laa.png in http://crash.ihug.co.nz/~Sneuro/pngkiller2.tar.gz
and the Win 2K and Linux crashes.
Assignee | ||
Comment 23•23 years ago
|
||
Assignee | ||
Comment 24•23 years ago
|
||
Assignee | ||
Comment 25•23 years ago
|
||
Assignee | ||
Comment 26•23 years ago
|
||
Attachment #92019 -
Attachment is obsolete: true
Assignee | ||
Comment 27•23 years ago
|
||
Attachment #92018 -
Attachment is obsolete: true
Assignee | ||
Comment 28•23 years ago
|
||
Assignee | ||
Comment 29•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #92017 -
Attachment is obsolete: true
Attachment #92020 -
Attachment is obsolete: true
Attachment #92023 -
Attachment is obsolete: true
Assignee | ||
Comment 30•23 years ago
|
||
ok, these 2 patches limit image sizes to 2^14 (16k) and will error out if
images try to get bigger than that.
Keywords: patch
Comment 31•23 years ago
|
||
Comment on attachment 92024 [details] [diff] [review]
one patch for all the decoders
sr=tor
Attachment #92024 -
Flags: superreview+
Comment 32•23 years ago
|
||
Comment on attachment 92024 [details] [diff] [review]
one patch for all the decoders
r=dougt
Attachment #92024 -
Flags: review+
Comment 33•23 years ago
|
||
Comment on attachment 92021 [details] [diff] [review]
limit size of images to 2^14 x 2^14
r=saari
Attachment #92021 -
Flags: review+
Assignee | ||
Comment 34•23 years ago
|
||
Attachment #92021 -
Attachment is obsolete: true
Comment 35•23 years ago
|
||
Comment on attachment 92030 [details] [diff] [review]
limit size to (2^15)-1
sr=tor
Attachment #92030 -
Flags: superreview+
Comment 36•23 years ago
|
||
Comment on attachment 92030 [details] [diff] [review]
limit size to (2^15)-1
r=dougt
Attachment #92030 -
Flags: review+
Comment 37•23 years ago
|
||
Comment on attachment 92024 [details] [diff] [review]
one patch for all the decoders
a=asa (on behalf of drivers) for checkin to 1.1
Attachment #92024 -
Flags: approval+
Comment 38•23 years ago
|
||
Comment on attachment 92030 [details] [diff] [review]
limit size to (2^15)-1
a=asa (on behalf of drivers) for checkin to 1.1
Attachment #92030 -
Flags: approval+
Assignee | ||
Comment 39•23 years ago
|
||
fixes checked in.
Status: REOPENED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → FIXED
Comment 40•23 years ago
|
||
bsharma: bindu, can you verify this fix on the trunk? thanks!
Whiteboard: [adt1 rtm] [ETA 07/20] → [adt1 rtm] [ETA 07/23]
Comment 41•23 years ago
|
||
Verified on 2002-07-22-trunk on Win 2000.
The laa.png does not load and the error appears in the content window.
Status: RESOLVED → VERIFIED
Comment 42•23 years ago
|
||
Adding adt1.0.1 on behalf of the adt. Please check this fix into the Mozilla
branch after getting branch approval from drivers.
Comment 43•23 years ago
|
||
a=chofmann for 1.0.1. add the fixed1.0.1 keyword after checking in on the branch.
Keywords: mozilla1.0.1 → mozilla1.0.1+
Assignee | ||
Updated•23 years ago
|
Keywords: fixed1.0.1
Comment 44•23 years ago
|
||
bsharma: bindu, can you verify this fix on the branch, then replace "fixed1.0.1"
with "verified1.0.1"? thanks!
Comment 45•23 years ago
|
||
Verified on 2002-07-25-branch on Win 2000.
The laa.png does not load and the error appears in the content window.
Keywords: fixed1.0.1 → verified1.0.1
Updated•23 years ago
|
Keywords: mozilla1.0.1+
Reporter | ||
Updated•22 years ago
|
Group: security?
Comment 46•22 years ago
|
||
*** Bug 101948 has been marked as a duplicate of this bug. ***
You need to log in
before you can comment on or make changes to this bug.
Description
•