Matt Posted August 7, 2013 Report Posted August 7, 2013 Description : An arbitrary file upload vulnerability exists in the official Nmap Http-domino-enum-passwords NSE script.Author : Piotr DuszynskiSource : Nmap Http-domino-enum-passwords File Upload ? Packet StormCode : Trustwave SpiderLabs Security Advisory TWSL2013-025:Arbitrary File Upload Vulnerability in Official NmapHttp-domino-enum-passwords NSE scriptPublished: 08/02/13Version: 1.0Vendor: Nmap (http://nmap.org/)Product: Nmap NSE scriptVersion affected: Nmap 6.25Product description:Nmap ("Network Mapper") is a free and open source (license) utility fornetwork discovery and security auditing. Many systems and networkadministrators also find it useful for tasks such as network inventory,managing service upgrade schedules, and monitoring host or service uptime.Nmap uses raw IP packets in novel ways to determine what hosts areavailable on the network, what services (application name and version)those hosts are offering, what operating systems (and OS versions) they arerunning, what type of packet filters/firewalls are in use, and dozens ofother characteristics. It was designed to rapidly scan large networks, butworks fine against single hosts. Nmap runs on all major computer operatingsystems, and official binary packages are available for Linux, Windows, andMac OS X. In addition to the classic command-line Nmap executable, the Nmapsuite includes an advanced GUI and results viewer (Zenmap), a flexible datatransfer, redirection, and debugging tool (Ncat), a utility for comparingscan results (Ndiff), and a packet generation and response analysis tool(Nping).Finding 1: Arbitrary File Upload Vulnerability*****Credit: Piotr Duszynski @drk1wi of Trustwave SpiderLabsCVE: CVE-2013-4885It is possible to write arbitrary files to a remote system, through aspecially crafted server response for NMAP http-domino-enum-passwords.nsescript (from the official Nmap repository).Example vulnerable command:nmap --script domino-enum-passwords -p 80 <evil_host> --script-args domino-enum-passwords.username='patrik karlsson',domino-enum-passwords.password=secret,domino-enum-passwords.idpath='/tmp'Vulnerable code:...local status, err = saveIDFile( ("%s/%s.id"):format(download_path, u_details.fullname), http_response.body )...This issue can be only exploited if the 'domino-enum-passwords.idpath'parameter is present. In order to bypass the second format stringparameter "%s.id" and be able to write arbitrary files to the operatingsystem the following payload should be appended to the first format stringparameter value:"\x00\x61\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x5c\x25\x64\x0d\x0a"Fully functional exploit for this vulnerability is available in thePortspoof git repository.Remediation Steps:The vendor has released an official patch for this vulnerability. It isrecommended to upgrade to Nmap 6.40.Revision History:07/18/13 - Vulnerability disclosed to vendor07/29/13 - Patch released by vendor08/02/13 - Advisory publishedReferences1. http://nmap.org/changelog.htmlAbout Trustwave:Trustwave is the leading provider of on-demand and subscription-basedinformation security and payment card industry compliance managementsolutions to businesses and government entities throughout the world. Fororganizations faced with today's challenging data security and complianceenvironment, Trustwave provides a unique approach with comprehensivesolutions that include its flagship TrustKeeper compliance managementsoftware and other proprietary security solutions. Trustwave has helpedthousands of organizations--ranging from Fortune 500 businesses and largefinancial institutions to small and medium-sized retailers--managecompliance and secure their network infrastructure, data communications andcritical information assets. Trustwave is headquartered in Chicago withoffices throughout North America, South America, Europe, Africa, China andAustralia. For more information, visit https://www.trustwave.comAbout Trustwave SpiderLabs:SpiderLabs(R) is the advanced security team at Trustwave focused onapplication security, incident response, penetration testing, physicalsecurity and security research. The team has performed over a thousandincident investigations, thousands of penetration tests and hundreds ofapplication security tests globally. In addition, the SpiderLabs Researchteam provides intelligence through bleeding-edge research and proof ofconcept tool development to enhance Trustwave's products and services.https://www.trustwave.com/spiderlabsDisclaimer:The information provided in this advisory is provided "as is" withoutwarranty of any kind. Trustwave disclaims all warranties, either express orimplied, including the warranties of merchantability and fitness for aparticular purpose. In no event shall Trustwave or its suppliers be liablefor any damages whatsoever including direct, indirect, incidental,consequential, loss of business profits or special damages, even ifTrustwave or its suppliers have been advised of the possibility of suchdamages. Some states do not allow the exclusion or limitation of liabilityfor consequential or incidental damages so the foregoing limitation may notapply.________________________________This transmission may contain information that is privileged, confidential, and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is strictly prohibited. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Quote