Public Vulnerability Reports

QNX Neutrino RTOS fontsleuth Command Format String Vulnerability

02.07.06

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.

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.

ANALYSIS

Successful exploitation provides local attackers with super-user
privileges on the affected system. This allows the attacker to have
complete control.

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.

WORKAROUND

Clear the set user ID or execute bits from the affected binary or remove
it entirely.

VENDOR RESPONSE

This issue has been corrected in QNX Momentics 6.3.0 SP3 and later versions. Patches are also available for 6.3.0 (Patch ID:230) , 6.3.0 SP1 (Patch ID:231), and 6.3.0 SP2 (Patch ID:232). Please contact your QNX representative, or visit http://www.qnx.com/account/login.html to obtain these patches.

CVE INFORMATION

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

DISCLOSURE TIMELINE

12/23/2004 Initial vendor notification
02/07/2006 Public disclosure

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

LEGAL NOTICES

Copyright © 2006 Verisign, 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@idefense.com 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.