iDefense Security Advisory 02.07.06: QNX Neutrino RTOS fontsleuth Command Format String Vulnerability
QNX Neutrino RTOS fontsleuth Command Format String Vulnerability
iDefense Security Advisory 02.07.06
http://www.idefense.com/intelligence/vulnerabilities/display.php?id=380
February 7, 2006
I. BACKGROUND
QNX Software Systems Ltd.'s Neutrino RTOS (QNX) is a real-time operating
system designed for use in embedded systems. More information is
available at:
http://www.qnx.com/products/rtos/
fontsleuth is a setuid root binary included by default in version 6.3.0
QNX Neutrino RTOS (QNX). It is a utility that tells the Photon font
manager where to look for fonts.
II. DESCRIPTION
Local exploitation of a format string vulnerability in QNX Neutrino
RTOS's (QNX) fontsleuth command allows attackers to gain root
privileges.
The problem specifically exists in the handling of a string passed as
the zeroth argument to the set user id (setuid) binary fontsleuth. The
string is ultimately passed to a formatted print function where a format
specifier is not supplied. This allows the attacker to use such
dangerous format specifiers as %n and %hn to write to arbitrary areas in
memory. Using this method, it is possible to overwrite the stored return
address or several function pointers, allowing an attacker to seize CPU
control and eventually execute arbitrary code under root privileges.
The following debugger dump shows what successful exploitation of this
vulnerability looks like at a low level.
Loaded symbols for /usr/qnx630/target/qnx6/x86/lib/libc.so.2
#0 0xb033ec7e in _Putfld () from /usr/qnx630/target/qnx6/x86/lib/libc.so.2
(gdb) x/i $pc
0xb033ec7e <_Putfld+1082>: mov %ax,(%edx)
(gdb) i r eax edx
eax 0x4142 16706
edx 0x51525354 1364349780
Both EAX and EDX are controlled by the attacker, allowing an overwrite
of any location in memory. Furthermore, multiple writes can be achieved
by using more than one write format specifier. An attacker can choose to
overwrite the saved return address or function pointer and easily gain
control of execution.
III. ANALYSIS
Successful exploitation provides local attackers with super-user
privileges on the affected system. This allows the attacker to have
complete control.
IV. DETECTION
iDefense has confirmed the existence of these vulnerabilities in QNX
Neutrino RTOS version 6.3.0. Earlier versions are suspected to be
susceptible to exploitation as well.
V. WORKAROUND
Clear the set user ID or execute bits from the affected binary or remove
it entirely.
VI. VENDOR RESPONSE
The vendor has not responded to communication regarding this issue.
VII. CVE INFORMATION
A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.
VIII. DISCLOSURE TIMELINE
12/23/2004 Initial vendor notification
02/07/2006 Public disclosure
IX. CREDIT
iDefense Labs is credited with this discovery.
Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp
Free tools, research and upcoming events
http://labs.idefense.com
X. LEGAL NOTICES
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
email customerservice@xxxxxxxxxxxx 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 information.