Rapid7 Vulnerability & Exploit Database

Setuid Nmap Exploit

Back to Search

Setuid Nmap Exploit

Disclosed
07/19/2012
Created
05/30/2018

Description

Nmap's man page mentions that "Nmap should never be installed with special privileges (e.g. suid root) for security reasons.." and specifically avoids making any of its binaries setuid during installation. Nevertheless, administrators sometimes feel the need to do insecure things. This module abuses a setuid nmap binary by writing out a lua nse script containing a call to os.execute(). Note that modern interpreters will refuse to run scripts on the command line when EUID != UID, so the cmd/unix/reverse_{perl,ruby} payloads will most likely not work.

Author(s)

  • egypt <egypt@metasploit.com>

Platform

BSD,Linux,Unix

Architectures

cmd, x86

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/unix/local/setuid_nmap
msf exploit(setuid_nmap) > show targets
    ...targets...
msf exploit(setuid_nmap) > set TARGET < target-id >
msf exploit(setuid_nmap) > show options
    ...show and set options...
msf exploit(setuid_nmap) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;