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-2000.324 -- FreeBSD-SA-00:62 -- top allows reading of kernel memory

Date: 02 November 2000

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

===========================================================================
              AUSCERT External Security Bulletin Redistribution
                             
                      ESB-2000.324 -- FreeBSD-SA-00:62
                     top allows reading of kernel memory
                               2 November 2000

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

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

Product:                top
Vendor:                 FreeBSD
Operating System:       FreeBSD
                        BSD
Impact:                 Root Compromise
Access Required:        Local

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

- -----BEGIN PGP SIGNED MESSAGE-----

=============================================================================
FreeBSD-SA-00:62                                           Security Advisory
                                                                FreeBSD, Inc.

Topic:          top allows reading of kernel memory

Category:       core
Module:         top
Announced:      2000-11-01
Credits:        vort@wiretapped.net via OpenBSD
Affects:        FreeBSD 3.x (all releases), FreeBSD 4.x (all releases prior
                to 4.2), FreeBSD 3.5.1-STABLE and 4.1.1-STABLE prior
                to the correction date.
Corrected:      2000/10/04 (FreeBSD 4.1.1-STABLE)
                2000/10/04 (FreeBSD 3.5.1-STABLE)
FreeBSD only:   NO

I.   Background

top is a utility for displaying current system resource statistics
such as process CPU and memory use.  It is externally-maintained,
contributed software which is included in FreeBSD by default.

II.  Problem Description

A "format string vulnerability" was discovered in the top(1) utility
which allows unprivileged local users to cause the top process to
execute arbitrary code.  The top utility runs with increased
privileges as a member of the kmem group, which allows it to read from
kernel memory (but not write to it).  A process with the ability to
read from kernel memory can monitor privileged data such as network
traffic, disk buffers and terminal activity, and may be able to
leverage this to obtain further privileges on the local system or on
other systems, including root privileges.

All released versions of FreeBSD prior to the correction date
including 4.0, 4.1, 4.1.1 and 3.5.1 are vulnerable to this problem,
but it was fixed in the 4.1.1-STABLE branch prior to the release of
FreeBSD 4.2-RELEASE.

III. Impact

Local users can read privileged data from kernel memory which may
provide information allowing them to further increase their local or
remote system access privileges.

IV.  Workaround

Remove the setgid bit on the top utilities.  This has the side-effect
that users who are not a member of the kmem group or who are not the
superuser cannot use the top utility.

# chmod g-s /usr/bin/top

V.   Solution

One of the following:

1) Upgrade your vulnerable FreeBSD system to 4.1.1-STABLE or
3.5.1-STABLE after the respective correction dates.

2) Apply the patch below and recompile the relevant files:

Either save this advisory to a file, or download the patch and
detached PGP signature from the following locations, and verify the
signature using your PGP utility.

ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:62/top.patch
ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-00:62/top.patch.asc

Execute the following commands as root:

# cd /usr/src/contrib/top
# patch -p < /path/to/patch_or_advisory
# cd /usr/src/usr.bin/top
# make depend && make all install

Patch for vulnerable systems:

    Index: display.c
    ===================================================================
    RCS file: /mnt/ncvs/src/contrib/top/display.c,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- display.c	1999/01/09 20:20:33	1.4
    +++ display.c	2000/10/04 23:34:16	1.5
    @@ -829,7 +831,7 @@
         register int i;
     
         /* first, format the message */
    -    (void) sprintf(next_msg, msgfmt, a1, a2, a3);
    +    (void) snprintf(next_msg, sizeof(next_msg), msgfmt, a1, a2, a3);
     
         if (msglen > 0)
         {
    Index: top.c
    ===================================================================
    RCS file: /mnt/ncvs/src/contrib/top/top.c,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -r1.4 -r1.5
    --- top.c	1999/01/09 20:20:34	1.4
    +++ top.c	2000/10/04 23:34:16	1.5
    @@ -807,7 +809,7 @@
     				{
     				    if ((errmsg = kill_procs(tempbuf2)) != NULL)
     				    {
    -					new_message(MT_standout, errmsg);
    +					new_message(MT_standout, "%s", errmsg);
     					putchar('
');
     					no_command = Yes;
     				    }
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (FreeBSD)
Comment: For info see http://www.gnupg.org

iQCVAwUBOgCfWFUuHi5z0oilAQECnwP8CCL5roxtZIfgV7yEfNGW3u61+NNfFK7V
bEsygpUlT0/KGLM1gBWkMhn7oTlrYk4xJ01SdXenlBJg05ScS6qd8MhJ2TgqsS2l
f5w7ZIvZhSu+V+mLKmjmc52aHM+9Jth2ejyRwlcxWa+tE1XXCUK0KO6oaXod0TR9
g0TXn2UfHJ4=
=eU0t
- -----END PGP SIGNATURE-----

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

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

iQCVAwUBOlSNJSh9+71yA2DNAQFE8wQAj3Tq9JerWsURYPPRxynCR1TzH5Qih2vQ
f3vPYUYHQG9ofQ+PnKi/oaZfruiO/8mayvi3/Dh+xe9VbfBN593opoyh9RBHgNP/
QJxkyiaW8HJslWkcBZR2QGssHl7Z6GTMdnTdNqK3pVOK7fC12YFjA8fM6bW8Jj8/
Ly0+ErZn/io=
=SfSg
-----END PGP SIGNATURE-----