Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 184984 - app-arch/libarchive (former app-arch/bsdtar): multiple vulnerabilities
Summary: app-arch/libarchive (former app-arch/bsdtar): multiple vulnerabilities
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Security
Whiteboard: B2? [glsa] DerCorny
: 185085 (view as bug list)
Depends on:
Reported: 2007-07-11 19:06 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2009-12-27 18:07 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

libarchive-6stable.patch (libarchive-6stable.patch,6.53 KB, patch)
2007-07-12 10:37 UTC, Diego Elio Pettenò (RETIRED)
no flags Details | Diff
bsdtar-2.2.3-r1.ebuild (bsdtar-2.2.3-r1.ebuild,1.88 KB, text/plain)
2007-07-12 10:38 UTC, Diego Elio Pettenò (RETIRED)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2007-07-11 19:06:36 UTC
From: Colin Percival <>
To: Free Software Distribution Vendors <>, Diego 'Flameeyes' Pettenò <>
Cc: Ludwig Nussel <>,
Subject: security issues in libarchive
Date: Wed, 11 Jul 2007 10:14:49 -0700

Hi guys,

It seems that more linux vendors are distributing libarchive than I expected,
so I might as well send the details to vendor-sec rather than sending separate
emails to all the individual vendors contacting me.

I've attached FreeBSD's draft advisory and patch for libarchive 2.x; I also
have a patch for libarchive 1.x which is almost identical aside from cosmetic
changes due to API differences, but it sounds like most or all of you are
only shipping libarchive 2.x so I haven't attached that.

All versions of libarchive are affected by these issues, with the exception of
one which was introduced quite recently when a new readline() function was
added; if the final hunk of patch does not apply, you probably don't have that
recently added code+bug.

Tim Kientzle will be publishing an advisory for these issues on the libarchive
website and will release version 2.2.4 of libarchive with these issues fixed;
I don't know what the final URLs will be, but you should be able to find them
from once this becomes public.

Please do not publish any advisories or mention this publicly until 15:00 UTC
on July 12th.

Colin Percival
FreeBSD Security Officer

FreeBSD-SA-07:05.libarchive                                 Security Advisory
                                                          The FreeBSD Project

Topic:          Errors handling corrupt tar files in libarchive(3)

Category:       core
Module:         libarchive
Announced:      2007-07-12
Credits:        CPNI, CERT-FI, Tim Kientzle, Colin Percival
Affects:        FreeBSD 5.3 and later.
Corrected:      2007-07-12 15:XX:XX UTC (RELENG_6, 6.2-STABLE)
                2007-07-12 15:XX:XX UTC (RELENG_6_2, 6.2-RELEASE-p6)
                2007-07-12 15:XX:XX UTC (RELENG_6_1, 6.1-RELEASE-p18)
                2007-07-12 15:XX:XX UTC (RELENG_5, 5.5-STABLE)
                2007-07-12 15:XX:XX UTC (RELENG_5_5, 5.5-RELEASE-p14)
CVE Name:       CVE-2007-3641, CVE-2007-3644, CVE-2007-3645

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

I.   Background

The libarchive library provides a flexible interface for reading and
writing streaming archive files such as tar and cpio, and has been the
basis for FreeBSD's implementation of the tar(1) utility since FreeBSD 5.3.

II.  Problem Description

Several problems have been found in the code used to parse the tar and 
pax interchange formats.  These include entering an infinite loop if an
archive prematurely ends within a pax extension header or if certain
types of corruption occur in pax extension headers [CVE-2007-3644];
dereferencing a NULL pointer if an archive prematurely ends within a
tar header immediately following a pax extension header or if certain
other types of corruption occur in pax extension headers [CVE-2007-3645];
and miscomputing the length of a buffer resulting in a buffer overflow
if yet another type of corruption occurs in a pax extension header

III. Impact

An attacker who can cause a corrupt archive of his choice to be parsed
by libarchive, including by having "tar -x" (extract) or "tar -t" (list
entries) run on it, can cause libarchive to enter an infinite loop, to
core dump, or possibly to execute arbitrary code provided by the 

IV.  Workaround

No workaround is available, but systems which do not read tar or pax
extension archives provided by untrusted sources are not vulnerable.
Note that while these issues do not affect libarchive's ability to
parse cpio, ISO9660, or zip format archives, libarchive automatically
detects the format of an archive, so external metadata (e.g., a file
name) is not sufficient to ensure that a file will not be parsed using
the vulnerable tar/pax format parser.

V.   Solution

Perform one of the following:

1) Upgrade your vulnerable system to 5-STABLE, or 6-STABLE, or to the
RELENG_6_2, RELENG_6_1, or RELENG_5_5 security branch dated after the
correction date.

2) To patch your present system:

The following patches have been verified to apply to FreeBSD 5.5, 6.1,
and 6.2 systems.

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

[FreeBSD 5.5, 6.1, and 6.2]
# fetch
# fetch

b) Execute the following commands as root:

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

VI.  Correction details

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

Branch                                                           Revision
  src/UPDATING                                            1.342.
  src/UPDATING                                             1.416.
  src/UPDATING                                            1.416.

VII. References

The latest revision of this advisory is available at


I have the patches, what should I do? Prepare for secret release or?
Comment 1 Stefan Cornelius (RETIRED) gentoo-dev 2007-07-12 10:08:33 UTC
yes, please provide some ebuilds and attach them here, dont commit yet (unless this goes public faster than you are)
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-07-12 10:37:53 UTC
Created attachment 124629 [details, diff]

Patch (updated from the second mail, with Matt Dillon's fix).
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-07-12 10:38:15 UTC
Created attachment 124630 [details]
Comment 4 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-07-12 17:10:54 UTC
*** Bug 185085 has been marked as a duplicate of this bug. ***
Comment 5 Stefan Cornelius (RETIRED) gentoo-dev 2007-07-12 17:14:13 UTC
Comment 6 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-07-12 17:20:12 UTC
I suppose that at this point we could mark 2.2.4 stable and be done with it (I'll add a 2.2.4-r1 to fix a bug, but that's not urgent).
Comment 7 Stefan Cornelius (RETIRED) gentoo-dev 2007-07-12 17:34:01 UTC
amd64, please test and stable bsdtar-2.2.4 (or, even better, 2.2.4-r1 if it's around when you stable)
Comment 8 Steve Dibb (RETIRED) gentoo-dev 2007-07-13 00:45:07 UTC
(In reply to comment #7)
> amd64, please test and stable bsdtar-2.2.4 (or, even better, 2.2.4-r1 if it's
> around when you stable)

Comment 9 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-07-13 15:16:28 UTC
The package was renamed today (to avoid publishing a glsa bound to be invalidated by the move).
Comment 10 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-08-09 07:34:37 UTC
that was GLSA 200708-03, thanks everybody!