lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2006 14:31:08 -0500
From: iDefense Labs <>
Subject: iDefense Security Advisory 12.12.06: Sun
 Microsystems Solaris 'doprf()' Buffer Overflow Vulnerability

Sun Microsystems Solaris 'doprf()' Buffer Overflow Vulnerability

iDefense Security Advisory 12.12.06
Dec 12, 2006


Solaris is a UNIX operating system developed by Sun Microsystems.  More
information can be found at


Local exploitation of a buffer overflow vulnerability in could
potentially allow a non root user to execute arbitrary code as root. is vulnerable to a buffer overflow in its internal doprf()
formatting function. A fixed size stack buffer is used to store the
precision padding characters when printing out a numerical format
specifier. The vulnerable code was taken from the OpenSolaris source, and
is as follows:

doprf(const char *format, va_list args, Prfbuf *prf)
    char    c;
    char    *bp = prf->pr_cur;
    char    *bufend = prf->pr_buf + prf->pr_len;
    size_t  bufsiz = prf->pr_len;

    while ((c = *format++) != '\0') {
        if (c != '%') {
        } else {
            int base = 0, flag = 0, width = 0, prec = 0;
            size_t  _i;
            int _c, _n;
            char    *_s;
            int ls = 0;

* snip *

            if (base) {
1]             char        local[20];
                const char  *string =
                size_t      ssize = 0, psize = 0;
                const char  *prefix =
                u_longlong_t    num;

* snip *

                 * Convert the numeric value into a local
                 * string (stored in reverse order).
                _s = local;
2]            do {
                    *_s++ = string[num % base];
                    num /= base;
                } while (num);
                 * Provide any precision or width padding.
                if (prec) {
                    /* LINTED */
                    _n = (int)(prec - ssize);
3]                while (_n-- > 0) {
                        *_s++ = '0';

1) This is the stack buffer that will later be overflowed.

2) Here the given number is stored into the buffer.  There is no chance
for an overflow here as the maximum number of digits in a long long int is
20 bytes.

3) However in this loop an attacker can freely overwrite the stack with
'0' (0x30) bytes.

This vulnerability would normally not be able to be triggered by a non
root user. The doprf() function is only supposed to be passed format
strings from a message file owned by root. However, when this
vulnerability is combined with the directory traversal vulnerability
any user can pass arbitrary format strings to the doprf() function.


Successful local exploitation allows an attacker to execute arbitrary code
as root on the affected host by running a setuid binary.

Exploitation is difficult due to the limited data value with which the
buffer can be overflowed. It is necessary to have valid memory mapped at
an address with a most significant byte of 0x30, for example 0x30fffff0.
In our tests on both x86 and SPARC architectures we were unable to achieve
this. With a different memory layout exploitation may be possible.  On x86,
it also may be possible to overwrite the low byte of a saved frame pointer
if the registers are allocated in a different way.


iDefense has confirmed that Solaris 10 for both x86 and SPARC is
vulnerable. Older versions of Solaris are likely to be vulnerable as well.


iDefense is unaware of any effective workarounds for this issue.


Sun Microsystems has addressed this problem with new patches. More
information can be found in Sun Alert #102724. This alert can be found at:


A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.


10/24/2006  Initial vendor notification
10/27/2006  Initial vendor response
12/12/2006  Coordinated public disclosure


Sean Larsson (iDefense Labs) is credited with the discovery of this

Get paid for vulnerability research

Free tools, research and upcoming events


Copyright © 2006 iDefense, Inc.

Permission is granted for the redistribution of this alert electronically.
It may not be edited in any way without the express written consent of
iDefense. If you wish to reprint the whole or any part of this alert in
any other medium other than electronically, please e-mail for permission.

Disclaimer: The information in the advisory is believed to be accurate at
the time of publishing based on currently available information. Use of
the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on, this

Full-Disclosure - We believe in it.
Hosted and sponsored by Secunia -

Powered by blists - more mailing lists