FreeBSD-SA-10:08.bzip2: Integer overflow in bzip2 decompression

When decompressing data, the run-length encoded values are not adequately sanity-checked, allowing for an integer overflow.

Hash: SHA1

FreeBSD-SA-10:08.bzip2                                      Security Advisory
                                                          The FreeBSD Project

Topic:          Integer overflow in bzip2 decompression

Category:       contrib
Module:         bzip2
Announced:      2010-09-20
Credits:        Mikolaj Izdebski
Affects:        All supported versions of FreeBSD.
Corrected:      2010-09-20 14:58:08 UTC (RELENG_8, 8.1-STABLE)
                2010-09-20 14:58:08 UTC (RELENG_8_1, 8.1-RELEASE-p1)
                2010-09-20 14:58:08 UTC (RELENG_8_0, 8.0-RELEASE-p5)
                2010-09-20 14:58:08 UTC (RELENG_7, 7.3-STABLE)
                2010-09-20 14:58:08 UTC (RELENG_7_3, 7.3-RELEASE-p3)
                2010-09-20 14:58:08 UTC (RELENG_7_1, 7.1-RELEASE-p14)
                2010-09-20 14:58:08 UTC (RELENG_6, 6.4-STABLE)
                2010-09-20 14:58:08 UTC (RELENG_6_4, 6.4-RELEASE-p11)
CVE Name:       CVE-2010-0405

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit .

I.   Background

The bzip2/bunzip2 utilities and the libbz2 library compress and decompress
files using an algorithm based on the Burrows-Wheeler transform.  They are
generally slower than Lempel-Ziv compressors such as gzip, but usually
provide a greater compression ratio.

II.  Problem Description

When decompressing data, the run-length encoded values are not adequately
sanity-checked, allowing for an integer overflow.

III. Impact

An attacker who can cause maliciously chosen inputs to be decompressed can
cause the decompressor to crash.  It is suspected that such an attacker
can cause arbitrary code to be executed, but this is not known for certain.

Note that some utilities, including the tar archiver and the bspatch
binary patching utility (used in portsnap and freebsd-update) decompress
bzip2-compressed data internally; system administrators should assume that
their systems will at some point decompress bzip2-compressed data even if
they never explicitly invoke the bunzip2 utility.

IV.  Workaround

No workaround is available.

V.   Solution

Perform one of the following:

1) Upgrade your vulnerable system to 6-STABLE, 7-STABLE or 8-STABLE,
or to the RELENG_8_1, RELENG_8_0, RELENG_7_3, RELENG_7_1, or
RELENG_6_4 security branch dated after the correction date.

2) To update your vulnerable system via a source code patch:

The following patches have been verified to apply to FreeBSD 6.4, 7.1,
7.3, 8.0 and 8.1 systems.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch
# fetch

b) Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch
# cd /usr/src/lib/libbz2
# make obj && make depend && make && make install

NOTE: On the amd64 platform, the above procedure will not update the
lib32 (i386 compatibility) libraries.  On amd64 systems where the i386
compatibility libraries are used, the operating system should instead
be recompiled as described in

3) To update your vulnerable system via a binary patch:

Systems running 6.4-RELEASE, 7.1-RELEASE, 7.3-RELEASE, 8.0-RELEASE or
8.1-RELEASE on the i386 or amd64 platforms can be updated via the
freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install

VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in FreeBSD.


Branch                                                           Revision
- -------------------------------------------------------------------------
  src/UPDATING                                            1.416.
  src/UPDATING                                             1.507.
  src/UPDATING                                            1.507.
  src/UPDATING                                             1.632.
  src/UPDATING                                              1.632.
- -------------------------------------------------------------------------


Branch/path                                                      Revision
- -------------------------------------------------------------------------
stable/6/                                                         r212901
releng/6.4/                                                       r212901
stable/7/                                                         r212901
releng/7.3/                                                       r212901
releng/7.1/                                                       r212901
stable/8/                                                         r212901
releng/8.0/                                                       r212901
releng/8.1/                                                       r212901
- -------------------------------------------------------------------------

VII. References

The latest revision of this advisory is available at
Version: GnuPG v1.4.10 (FreeBSD)

Подписывайтесь на каналы "SecurityLab" в TelegramTelegram и Яндекс.ДзенЯндекс.Дзен, чтобы первыми узнавать о новостях и эксклюзивных материалах по информационной безопасности.