[unzip] [CVE-2008-0888] potential code execution

Bug #203461 reported by disabled.user
254
Affects Status Importance Assigned to Milestone
unzip (Fedora)
Fix Released
Medium
unzip (Gentoo Linux)
Fix Released
Medium
unzip (Mandriva)
Unknown
Unknown
unzip (Ubuntu)
Fix Released
Undecided
Kees Cook

Bug Description

Binary package hint: unzip

References:
DSA 1522-1 (http://www.debian.org/security/2008/dsa-1522)

Quoting:
"Tavis Ormandy discovered that unzip, when processing specially crafted
ZIP archives, could pass invalid pointers to the C library's free
routine, potentially leading to arbitrary code execution"

CVE References

Revision history for this message
In , Tomas (tomas-redhat-bugs) wrote :

Tavis Ormandy has discovered a flaw in unzip that can cause unzip to attempt to
free() memory block pointed to by uninitialized pointer or memory block, which
was already freed. This can cause unzip to crash (SEGV) during extraction of
malicious zip file, possibly allowing code execution.

Further details from Tavis:

  the inflate_dynamic() routine (~978, inflate.c) uses a macro
  NEEDBITS() that jumps execution to a cleanup routine on error, this
  routine attempts to free() two buffers allocated during the inflate
  process. At certain locations, the NEEDBITS() macro is used while the
  pointers are not pointing to valid buffers, they are either
  uninitialised or pointing inside a block that has already been free()d
  (ie, not pointing at the block, but at a location inside it).

Acknowledgements:

Red Hat would like to thank Tavis Ormandy of the Google Security Team for reporting this issue.

Revision history for this message
In , Tomas (tomas-redhat-bugs) wrote :

Created attachment 293893
Patch against 5.5.2 proposed by Tavis

Revision history for this message
In , Josh (josh-redhat-bugs) wrote :

This flaw is a crash only on Red Hat Enterprise Linux 4 and 5, as glibc will not
allow a free on an invalid pointer.

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

Tavis Ormandy writes:

the inflate_dynamic() routine (~978, inflate.c) uses a macro
NEEDBITS() that jumps execution to a cleanup routine on error, this
routine attempts to free() two buffers allocated during the inflate
process. At certain locations, the NEEDBITS() macro is used while the
pointers are not pointing to valid buffers, they are either
uninitialised or pointing inside a block that has already been free()d
(ie, not pointing at the block, but at a location inside it).

In both cases, the possibility of controlling either the pointer (eg,
by altering the unitialized data on the stack left over from some
previous subroutine call), or the buffer pointed at by the pointer, is
small but perhaps non-zero.

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

base-system, please find the patch attached. No upstream bump to be expected, smithj tried contacting them without success.

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

Created attachment 146443
unzip-5.5.2-CVE-2008-0888.patch

Courtesy of Tavis

Revision history for this message
In , smithj (smithj-gentoo-bugs) wrote :

(In reply to comment #1)
> smithj tried contacting them without success.

Yeah. Actually, if anyone has a contact for them, please pass this info along!

Revision history for this message
In , Tomas (tomas-redhat-bugs) wrote :
Revision history for this message
In , Tomas (tomas-redhat-bugs) wrote :

Issue is also caught on Fedora 7/8 by malloc/free checks, only causing client
application DoS, which is not considered a security issue. I've filed tracking
bug for rawhide, so that this issue is addressed in future Fedora and Red Hat
Enterprise Linux versions.

Revision history for this message
In , vapier (vapier-gentoo-bugs) wrote :

i'd drop the last two hunks of that patch as one is simply whitespace change and the other is redundant -- huft_free() already performs the if(NULL) test

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

(In reply to comment #4)
> i'd drop the last two hunks of that patch as one is simply whitespace change
> and the other is redundant -- huft_free() already performs the if(NULL) test

sounds good, taviso complained about losing performance though ;-)

Revision history for this message
Kees Cook (kees) wrote :

Thanks for the report. This update will be published shortly.

Changed in unzip:
assignee: nobody → keescook
status: New → Fix Committed
Changed in unzip:
status: Unknown → In Progress
Revision history for this message
Kees Cook (kees) wrote :

Thanks, this was published as: http://www.ubuntu.com/usn/usn-589-1

Changed in unzip:
status: Fix Committed → Fix Released
Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

spanky, any updates here?

Revision history for this message
In , vapier (vapier-gentoo-bugs) wrote :

added unzip-5.5.2-r2 to the tree w/the patch ... not that i really looked into the issue to verify correctness of the patch

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

(In reply to comment #7)
> added unzip-5.5.2-r2 to the tree w/the patch ... not that i really looked into
> the issue to verify correctness of the patch

Couldn't reproduce the error with taviso's PoC.

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

Arches, please test and mark stable:
=app-arch/unzip-5.52-r2
Target keywords : "alpha amd64 arm hppa ia64 m68k ppc ppc64 release s390 sh sparc x86"

Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

amd64 stable

Revision history for this message
In , fauli (fauli-gentoo-bugs) wrote :

x86 stable

Revision history for this message
In , ranger (ranger-gentoo-bugs) wrote :

ppc and ppc64 done

Revision history for this message
In , armin76 (armin76-gentoo-bugs) wrote :

alpha/ia64/sparc stable

Revision history for this message
In , jer (jer-gentoo-bugs) wrote :

Stable for HPPA.

Revision history for this message
In , pva (pva-gentoo-bugs) wrote :

Fixed in release snapshot.

Changed in unzip:
status: Unknown → Invalid
Revision history for this message
In , rbu (rbu-gentoo-bugs) wrote :

GLSA 200804-06.

Changed in unzip:
status: In Progress → Fix Released
Changed in unzip:
status: Invalid → Unknown
Revision history for this message
In , Red (red-redhat-bugs) wrote :

This issue was addressed in:

Red Hat Enterprise Linux:
  http://rhn.redhat.com/errata/RHSA-2008-0196.html

Changed in unzip:
status: Unknown → Fix Released
Changed in unzip (Gentoo Linux):
importance: Unknown → Medium
Changed in unzip (Fedora):
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public Security information  
Everyone can see this security related information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.