copyright | disclaimer | privacy | contact  
Australia's Leading Computer Emergency Response Team
 
Search this site

 
On this site

 > HOME
 > About AusCERT
 > Membership
 > Contact Us
 > PKI Services
 > Training
 > Publications
 > Sec. Bulletins
 > Conferences
 > News & Media
 > Services
 > Web Log
 > Site Map
 > Site Help
 > Member login





 

ESB-2002.200 -- OpenBSD Security Advisory -- Potential sudo security hole

Date: 26 April 2002

Click here for printable version
Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----

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

                 ESB-2002.200 -- OpenBSD Security Advisory
                       Potential sudo security hole
                               26 April 2002

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

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

Product:                sudo
Vendor:                 OpenBSD
Operating System:       OpenBSD 2.9
                        OpenBSD 3.0
                        OpenBSD 3.1
Impact:                 Root Compromise
Access Required:        Existing Account

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

Summary:
    A heap corruption bug exists in sudo versions 1.5.7 to 1.6.5p2
    (inclusive).  The problem affects expansion of the "%h" and
    "%u" escape sequences in the prompt.  Due to a bug it is possible
    to craft a prompt such that more bytes are written than have
    been allocated.

    Exploiting heap corruption bugs like this requires fairly
    in-depth knowledge of a system's malloc internals.  This class
    of bug has been exploited with the glibc malloc but not, to my
    knowledge, with the malloc shipped with OpenBSD.  It would be
    foolish, however, to simply assume that it is not exploitable
    on OpenBSD.

Details:
    Sudo expands "%h" and "%u" to the hostname and username
    respectively.  This is done in two steps.  In the first step
    sudo calculates the amount of memory required to hold the
    expanded string.  In the second step it does the actual string
    copying and escape sequence expansion.  The bug occurs because
    a variable used to store the last character seen was not
    re-initialized before the second loop.  Consequently, if the
    last character in the prompt is a '%' and the first character
    is a 'h' or 'u', sudo will mistakenly expand the 'h' or 'u',
    thinking the last character processed was a '%'.  This causes
    the computed length to be too small and the malloced buffer
    will overflow.

Credit:
    This problem was brought to my attention by Global InterSec LLC.
    For more information, see their advisory:
	http://www.globalintersec.com/adv/sudo-2002041701.txt

Patches:
    ftp://ftp.openbsd.org/pub/OpenBSD/patches/2.9/common/025_sudo.patch
    ftp://ftp.openbsd.org/pub/OpenBSD/patches/3.0/common/020_sudo.patch
    ftp://ftp.openbsd.org/pub/OpenBSD/patches/3.1/common/002_sudo.patch

    The patches are already in the 2.9, 3.0 and 3.1 patch branches
    (aka the -stable branches).

- --------------------------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.

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 use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

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 original authors 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/Information/advisories.html

If you believe that your system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

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 emergencies.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: ftp://ftp.auscert.org.au/pub/auscert/AUSCERT_PGP.key

iQCVAwUBPMmieCh9+71yA2DNAQEc5wQAiI8NDjtHaSTIA6L+lipIXmh0Ncd2D2NL
R+6i3TlApgoTzyGypB8mDc2EwvGdxdWjDmolV5KCYoqOLvTliDCI6Bf6mEfUvkal
bwMIku67tVINHefKk3wWUCf5UA9c/0JOxMu4tXqYhRcxaZWW/3sQ6ti/OZn/WmmD
oYUq3ohhlMM=
=2pH5
-----END PGP SIGNATURE-----