-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

===========================================================================
             AUSCERT External Security Bulletin Redistribution

                              ESB-2013.0858.2
                       Privilege escalation via mmap
                               24 June 2013

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:           mmap
Publisher:         FreeBSD
Operating System:  FreeBSD
Impact/Access:     Modify Arbitrary Files -- Existing Account
Resolution:        Patch/Upgrade
CVE Names:         CVE-2013-2171  

Original Bulletin: 
   http://security.FreeBSD.org/advisories/FreeBSD-SA-13:06.mmap.asc

Revision History:  June 24 2013: Added workaround information
                   June 19 2013: Initial Release

- --------------------------BEGIN INCLUDED TEXT--------------------

- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

=============================================================================
FreeBSD-SA-13:06.mmap                                       Security Advisory
                                                          The FreeBSD Project

Topic:          Privilege escalation via mmap

Category:       core
Module:         kernel
Announced:      2013-06-18
Credits:        Konstantin Belousov
                Alan Cox
Affects:        FreeBSD 9.0 and later
Corrected:      2013-06-18 07:04:19 UTC (stable/9, 9.1-STABLE)
                2013-06-18 07:05:51 UTC (releng/9.1, 9.1-RELEASE-p4)
CVE Name:       CVE-2013-2171

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

0.   Revision History

v1.0  2013-06-18 Initial release.
v1.1  2013-06-21 Corrected correction date.
                 Added workaround information.

I.   Background

The FreeBSD virtual memory system allows files to be memory-mapped.
All or parts of a file can be made available to a process via its
address space.  The process can then access the file using memory
operations rather than filesystem I/O calls.

The ptrace(2) system call provides tracing and debugging facilities by
allowing one process (the tracing process) to watch and control
another (the traced process).

II.  Problem Description

Due to insufficient permission checks in the virtual memory system, a
tracing process (such as a debugger) may be able to modify portions of
the traced process's address space to which the traced process itself
does not have write access.

III. Impact

This error can be exploited to allow unauthorized modification of an
arbitrary file to which the attacker has read access, but not write
access.  Depending on the file and the nature of the modifications,
this can result in privilege escalation.

To exploit this vulnerability, an attacker must be able to run
arbitrary code with user privileges on the target system.

IV.  Workaround

Systems that do not allow unprivileged users to use the ptrace(2)
system call are not vulnerable, this can be accomplished by setting
the sysctl variable security.bsd.unprivileged_proc_debug to zero.
Please note that this will also prevent debugging tools, for instance
gdb, truss, procstat, as well as some built-in debugging facilities in
certain scripting language like PHP, etc., from working for unprivileged
users.

The following command will set the sysctl accordingly and works until the
next reboot of the system:

    sysctl security.bsd.unprivileged_proc_debug=0

To make this change persistent across reboot, the system administrator
should also add the setting into /etc/sysctl.conf:

    echo 'security.bsd.unprivileged_proc_debug=0' >> /etc/sysctl.conf

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.

2) 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 http://security.FreeBSD.org/patches/SA-13:06/mmap.patch
# fetch http://security.FreeBSD.org/patches/SA-13:06/mmap.patch.asc
# gpg --verify mmap.patch.asc

b) Apply the patch.

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

c) Recompile your kernel as described in
<URL:http://www.FreeBSD.org/handbook/kernelconfig.html> and reboot the
system.

3) 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

VI.  Correction details

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

Branch/path                                                      Revision
- - -------------------------------------------------------------------------
stable/9/                                                         r251902
releng/9.1/                                                       r251903
- - -------------------------------------------------------------------------

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

# svn diff -cXXXXXX --summarize svn://svn.freebsd.org/base

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

<URL:http://svnweb.freebsd.org/base?view=revision&revision=XXXXXX>

VII. References

<URL:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-2171>

The latest revision of this advisory is available at
<URL:http://security.FreeBSD.org/advisories/FreeBSD-SA-13:06.mmap.asc>
- -----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAlHExy0ACgkQFdaIBMps37L8PwCdGXatzPm7OWjZu+GmbbXQC16/
8sgAoJ0LEmREO8Mp7f4YcLHAEwgnJtjT
=WRZD
- -----END PGP SIGNATURE-----

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business hours
                which are GMT+10:00 (AEST).
                On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQIVAwUBUcfRQhLndAQH1ShLAQJZOxAAocU79ctlY273E/clDZbBr1dmqW2lqk3z
XfZP2nWrnW4zYePt8Kkp7ydsIaBeaE1ZlPhSZ6UTrWp9L+7To5DMabzwQx2QF5dL
Te0MnrgrhkSEnQSXcaqzYGy2OIL/MCWAoFADHCsimUyJMTIYd7iSm8Ve8rcdHnm+
9uCl2ygyEflWFgFvSS5eZxtDQ9KyN/FYR5qhAjh+VJ5bbl/zieeFpzK22kn63/C4
GJpN2fV0ktwE4Cm5PnfaurGLaa++Xe1WmwgIv6nF2aN9un/tiAd9vu6d27/9grIk
IwM1ckuxjD0/e+rfOc6KoUOPlUFKC1VPIRkaHQWg9o4q89wyW2BbH3Yu2Nlrf0Dn
RGYdm4LgxI9nw0+7PiCCVBPfSvSt56uieoO9xUv73JSOhjiI9XLGsQ/4EKi4vkes
WlyouWf/kuhQGrQqi5UF9ViaK0KELVJkB+6U1xUdMWTj78LyLldmFOoYDIofhG/9
PKVmpOUVoU6wmflJ7qC/8x0xk4KcLihbiAR6bTIPYyCQVtQ5zKbm1Nw7TlumuexY
NVALvPCoRvVBq9dhc2INu0ukxrWO0pvkrRC+oeg0GP7FD45PDBX7w5tw+L+WzrGf
WoGFoVPDt8OroSz3+z9ckxfTYbk1HOm6TYML3cTAG3gULLfF10/qSVYP3Ts5OQHk
AL5F42WleFg=
=Gcx8
-----END PGP SIGNATURE-----