| Solaris lpq Stack Buffer Overflow Vulnerability
Author : NSFOCUS <email@example.com>
NSFOCUS Security Advisory(SA2003-02)
Topic: Solaris lpq Stack Buffer Overflow Vulnerability
Release Date: 2003-3-31
CVE CAN ID: CAN-2003-0091
Sun Solaris 2.5.1 (SPARC/x86)
Sun Solaris 2.6 (SPARC/x86)
Sun Solaris 7 (SPARC/x86)
NSFOCUS Security Team has found a buffer overflow vulnerability in lpq,
application in Sun Solaris system. Exploiting the vulnerability local
attackers could gain root privilege.
lpq, which is used to display the contents in printing queue, is a command
in SunOS/BSD compatible package.By default suid root bit is set to it.
Because valid bound check has not been implemented when handling the data
provided by users, attackers could cause a fixed stack buffer to overflow.
By carefully crafting overflow data attackers could run arbitrary code
Actually /usr/ucb/lpq is a symbol link to /usr/bin/lpstat. lpstat will
operate according to the program names during the calling. If "lpq",
operate in BSD style, or it will operate in System V style. The bsd_queue()
function in lpq will call strcat() to copy the data provided by users
buffer the size of which is fixed. Because the length of the copied data
not been checked, if an attacker provides a over-long string, he/she will
cause a stack buffer overflow. By overwriting the returning addresses
data in the stack, local attackers could gain root privilege.
Solaris 8/9 uses strlcat() to implement string copy, so it avoids buffer
overflow and therefore is not vulnerable to the issue.
NSFOCUS suggests to disable suid root attribute of lpstat(lpq) temporarily:
# chmod a-s /usr/bin/lpstat
2002-12-11 Informed the vendor.
2002-12-13 The vendor confirmed the vulnerability.
2003-03-31 The vendor released a Sun Alert and patches for this issue.
The Sun Alert is available at:
The patches are:
Solaris 2.6 106235-12
Solaris 2.6_x86 106236-12
Solaris 7 107115-12
Solaris 7_x86 107116-12
The Common Vulnerabilities and Exposures (CVE) project has assigned the
name CAN-2003-0091 to this issue. This is a candidate for inclusion in
CVE list (http://cve.mitre.org), which standardizes names for security
problems. Candidates may change significantly before they become official
THE INFORMATION PROVIDED IS RELEASED BY NSFOCUS "AS IS" WITHOUT
OF ANY KIND. NSFOCUS DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
EXCEPT FOR THE WARRANTIES OF MERCHANTABILITY. IN NO EVENTSHALL NSFOCUS
BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT,
INCIDENTAL,CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES,
EVEN IF NSFOCUS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
DISTRIBUTION OR REPRODUCTION OF THE INFORMATION IS PROVIDED THAT THE
ADVISORY IS NOT MODIFIED IN ANY WAY.
NSFOCUS Security Team <firstname.lastname@example.org>
NSFOCUS INFORMATION TECHNOLOGY CO.,LTD
PGP Key: http://www.nsfocus.com/homepage/research/pgpkey.asc
Key fingerprint = F8F2 F5D1 EF74 E08C 02FE 1B90 D7BF 7877 C6A6 F6DA