Bug 201919 - (CVE-2006-1168) CVE-2006-1168 ncompress: .bss buffer underflow in decompression
CVE-2006-1168 ncompress: .bss buffer underflow in decompression
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20060808,repor...
: Security
Depends On: 201335 728536 768083 772473 790335 800293 802089
Blocks: 742493 784298
  Show dependency treegraph
 
Reported: 2006-08-09 15:21 EDT by Marcel Holtmann
Modified: 2012-06-20 09:13 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 06:06:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Marcel Holtmann 2006-08-09 15:21:31 EDT
Report from Tavis Ormandy, Google Security Team:

An audit of ncompress version 4.2.4 uncovered a serious security flaw, this loop
in decompress() (~1749, compress42.c) performs no bounds checking, allowing a
specially crafted datastream to underflow a .bss buffer with attacker controlled
data. Some research reveals that the lzw decompressors from gzip and openbsd
(both derived from the same public domain implementation) have already corrected
this flaw, however ncompress shipped by (at least) gentoo, debian, fedora and
suse seem to still be vulnerable.

              while ((cmp_code_int)code >= (cmp_code_int)256)
              { /* Generate output characters in reverse order */
                  *--stackp = tab_suffixof(code);
                  code = tab_prefixof(code);
              }

In my test environment I've been able to successfully overwirte .got and .dtors
with controlled data. The most simple testcase would be:

$ perl -e 'print "\x1f\x9d\x90","\x01"x"2048"' | compress -d

My suggested fix would be adding  `&& stackp >= htabof(0)` to the loop condition.
Comment 1 Peter Vrabec 2006-08-11 07:46:22 EDT
fixed in ncompress-4.2.4-45
Comment 3 Tomas Hoger 2011-08-17 11:45:49 EDT
This was fixed in ncompress versions shipped in Red Hat Enterprise Linux:

https://www.redhat.com/security/data/cve/CVE-2006-1168.html

and Fedora.  The fix has not bee applied to busybox yet, which include a copy of the ncompress code.
Comment 4 Tomas Hoger 2011-08-18 08:45:29 EDT
(In reply to comment #3)
> The fix has not bee applied to busybox yet, which include a copy of the
> ncompress code.

Fixed now via:
http://git.busybox.net/busybox/commit/archival/libarchive/decompress_uncompress.c?id=251fc70e9722f931eec23a34030d05ba5f747b0e
Comment 7 Murray McAllister 2012-02-03 00:49:39 EST
Acknowledgements:

Red Hat would like to thank Tavis Ormandy of the Google Security Team for reporting this issue.
Comment 9 errata-xmlrpc 2012-02-20 22:20:48 EST
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2012:0308 https://rhn.redhat.com/errata/RHSA-2012-0308.html
Comment 12 errata-xmlrpc 2012-06-20 03:16:07 EDT
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2012:0810 https://rhn.redhat.com/errata/RHSA-2012-0810.html

Note You need to log in before you can comment on or make changes to this bug.