FreeBSD Security Advisory FreeBSD-SA-16:25.bspatch

From: FreeBSD Security Advisories <>
To: Bugtraq <>
Subject: FreeBSD Security Advisory FreeBSD-SA-16:25.bspatch

Hash: SHA512

FreeBSD-SA-16:25.bspatch                                    Security Advisory
                                                          The FreeBSD Project

Topic:          Heap vulnerability in bspatch

Category:       core
Module:         bsdiff
Announced:      2016-07-25
Affects:        All supported versions of FreeBSD.
Corrected:      2016-07-25 14:52:12 UTC (stable/11, 11.0-BETA2-p1)
                2016-07-25 14:52:12 UTC (stable/11, 11.0-BETA1-p1)
                2016-07-25 14:53:04 UTC (stable/10, 10.3-STABLE)
                2016-07-25 15:04:17 UTC (releng/10.3, 10.3-RELEASE-p6)
                2016-07-25 15:04:17 UTC (releng/10.2, 10.2-RELEASE-p20)
                2016-07-25 15:04:17 UTC (releng/10.1, 10.1-RELEASE-p37)
                2016-07-25 14:53:04 UTC (stable/9, 9.3-STABLE)
                2016-07-25 15:04:17 UTC (releng/9.3, 9.3-RELEASE-p45)
CVE Name:       CVE-2014-9862

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 bspatch utility generates newfile from oldfile and patchfile where
patchfile is a binary patch built by bsdiff(1).

II.  Problem Description

The implementation of bspatch does not check for a negative value on numbers
of bytes read from the diff and extra streams, allowing an attacker who
can control the patch file to write at arbitrary locations in the heap.

This issue was first discovered by The Chromium Project and reported
independently by Lu Tung-Pin to the FreeBSD project.

III. Impact

An attacker who can control the patch file can cause a crash or run arbitrary
code under the credentials of the user who runs bspatch, in many cases, root.

IV.  Workaround

No workaround is available.

V.   Solution

Perform one of the following:

1) Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date.

No reboot is needed.

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

Systems running a RELEASE version of FreeBSD on the i386 or amd64
platforms can be updated via the freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install

No reboot is needed.

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

The following patches have been verified to apply to the applicable
FreeBSD release branches.

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

# fetch
# fetch
# gpg --verify bspatch.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:>.

VI.  Correction details

The following list contains the correction revision numbers for each
affected branch.

Branch/path                                                      Revision
- -------------------------------------------------------------------------
stable/9/                                                         r303301
releng/9.3/                                                       r303304
stable/10/                                                        r303301
releng/10.1/                                                      r303304
releng/10.2/                                                      r303304
releng/10.3/                                                      r303304
stable/11/                                                        r303300
- -------------------------------------------------------------------------

To see which files were modified by a particular revision, run the
following command, replacing NNNNNN with the revision number, on a
machine with Subversion installed:

# svn diff -cNNNNNN --summarize svn://

Or visit the following URL, replacing NNNNNN with the revision number:


VII. References



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


Copyright © 1995-2018 All rights reserved.