what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

openbsd.libutil

openbsd.libutil
Posted Oct 4, 2000
Site openbsd.org

OpenBSD Advisories - There is a format string vulnerability present in the pw_error() function of OpenBSD 2.7's libutil library can yield localhost users root access through the setuid /usr/bin/chpass utility. Affected versions: OpenBSD versions through 2.7. FreeBSD 4.0 is vulnerable, but patches have been backported, and FreeBSD versions 4.1 and 4.1.1 are safe.

tags | root
systems | freebsd, openbsd
SHA-256 | c4dc0e1f0cf54500d97b341679ab07d2223bed756a6b56374ca34a7169f219cd

openbsd.libutil

Change Mirror Download

----------------------------------------------------------------------------

OpenBSD Security Advisory

October 3, 2000

Format string vulnerability in libutil pw_error(3) function

----------------------------------------------------------------------------

SYNOPSIS

A format string vulnerability present in the pw_error() function of
OpenBSD 2.7's libutil library can yield localhost users root access through
the setuid /usr/bin/chpass utility. This particular vulnerability was
repaired three months ago on June 30th in OpenBSD-current during a complete
source tree audit for format string problems.

OpenBSD developers became aware of an exploit circulating for the chpass(1)
program on the evening of October 2, 2000.

----------------------------------------------------------------------------

AFFECTED SYSTEMS

This vulnerability affects OpenBSD versions through 2.7. FreeBSD 4.0 is
vulnerable, but patches have been backported, and FreeBSD versions 4.1 and
4.1.1 are safe. Bill Sommerfield committed a fix to NetBSD today shortly
after we notified him of the problem.

OpenBSD users running -current (2.8-beta) with a system dated July 1st
or thereafter are safe.

----------------------------------------------------------------------------

DETAILS

In recent months a myriad of "format string" vulnerabilities have been
discovered in a number of software packages. In response to this threat,
the OpenBSD team immediately began a complete source tree audit, identifying
and fixing dozens of these format bugs. While most of the issues were
harmless, a few such as the bug in xlock and one in the OpenBSD ftpd daemon
raised the red flag and patches were released to correct these problems.
Unfortunately, the severity of the format string bug that was fixed in
pw_error() was not fully realized at the time.

In addition to fixing the bugs, CAVEATS sections were added to all stdarg
function man pages (printf, syslog, setproctitle, err/warn) to warn
programmers that user-supplied strings should never be passed to these
routines without using the "%s" conversion specifier.

----------------------------------------------------------------------------

TECHNICAL DETAILS

To understand a format string attack, you need only understand how varargs
(see "man stdarg") functions work. For example, the printf() function
accepts a variable number of arguments depending on the supplied format.
Here is the function prototype:

int
printf(const char *format, ...);

The problem occurs when one of these functions is used thusly:

printf(user_supplied_string);

An attacker can put their own format specifiers in user_supplied_string.
The printf() function does not know where it's arguments stop on the stack.
If you put 100 `%s' format specifiers in the string, but give it no
arguments, the function will happily continue on down the stack blindly.

The problem is magnified by special conversion specifiers such as `%n'
which let you write to memory. Further attack details are beyond the scope
of this advisory. For more information see Guardent's white paper on
"Format String Attacks" by Tim Newsham at the following URL:

http://www.guardent.com/docs/FormatString.PDF

----------------------------------------------------------------------------

RESOLUTION

/bin/chmod u-s /usr/bin/chpass

Use this command to protect yourself until you are patched. (Note that the
vulnerability is actually in the libutil library, which chpass is linked to,
not the chpass program itself.)

Then, apply the fix below to your OpenBSD 2.7 source tree. The patch is also
available at http://www.openbsd.org/errata.html (025).

----------------------------------------------------------------------------

CREDITS

This vulnerability was originally extinguished on June 30 in a mass
format string repair commit by Todd C. Miller of the OpenBSD project. Other
developers who contributed to the audit include Theo de Raadt, Todd Fries,
and Aaron Campbell.

OpenBSD would also like to thank Kyle Hufford and Eric Jackson for their
assistance in creating this advisory.

----------------------------------------------------------------------------

OPENBSD 2.7 PATCH

Apply by doing:
cd /usr/src
patch -p0 < 025_pw_error.patch

And then rebuild and install libutil.
cd lib/libutil
make depend
make
make install

Index: lib/libutil/passwd.c
===================================================================
RCS file: /cvs/src/lib/libutil/passwd.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- lib/libutil/passwd.c 1998/11/16 07:10:32 1.20
+++ lib/libutil/passwd.c 2000/06/30 16:00:07 1.21
@@ -579,7 +579,7 @@
char *master = pw_file(_PATH_MASTERPASSWD);

if (err)
- warn(name);
+ warn("%s", name);
if (master)
warnx("%s: unchanged", master);
pw_abort();
Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    16 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close