1

Running nmap on my localhost shows me strange open ports:

$ nmap -p- localhost
Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-28 12:14 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00047s latency).
All 65535 scanned ports on localhost (127.0.0.1) are closed

Nmap done: 1 IP address (1 host up) scanned in 2.51 seconds

$ nmap -p- localhost
Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-28 12:14 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
Not shown: 65533 closed ports
PORT      STATE SERVICE
36642/tcp open  unknown
50826/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 2.55 seconds

$ nmap -p- localhost
Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-28 12:14 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00050s latency).
Not shown: 65531 closed ports
PORT      STATE SERVICE
37700/tcp open  unknown
46694/tcp open  unknown
48334/tcp open  unknown
53438/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 2.60 seconds

$ nmap -p- localhost
Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-28 12:14 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00046s latency).
All 65535 scanned ports on localhost (127.0.0.1) are closed

Nmap done: 1 IP address (1 host up) scanned in 2.51 second

As this ouput shows, the open ports seem to change fast and randomly. I cannot see these ports via netstat if I am interpreting the output the right way:

$ sudo netstat -tulpen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      0          17081       809/dnsmasq     
udp        0      0 0.0.0.0:5449            0.0.0.0:*                           0          30885       2855/dhclient   
udp        0      0 127.0.1.1:53            0.0.0.0:*                           0          17080       809/dnsmasq     
udp        0      0 0.0.0.0:68              0.0.0.0:*                           0          30321       2855/dhclient   
udp        0      0 0.0.0.0:45170           0.0.0.0:*                           107        15289       606/avahi-daemon: r
udp        0      0 0.0.0.0:631             0.0.0.0:*                           0          15931       636/cups-browsed
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           107        15287       606/avahi-daemon: r
udp6       0      0 :::34146                :::*                                107        15290       606/avahi-daemon: r
udp6       0      0 :::55654                :::*                                0          30886       2855/dhclient   
udp6       0      0 :::5353                 :::*                                107        15288       606/avahi-daemon: r

I tried to use lsof to investige these ports, but there is no result, I guess when nmap returns, the port is not open any longer:

lsof -i :`nmap -p- localhost|grep '/tcp'|cut -d'/' -f1|head -n1`

What can I do to further investigate this issue? Do I have to be worried? Is this normal? Should I suspect any malicious processes running?

Note that this Q&A is different as I am running everything on my local machine.

2

This is a bug in Nmap 6.40 - 6.47 that I discussed in detail in an answer on StackOverflow. It has been fixed since the 6.49BETA-series, so upgrading to the latest Nmap (7.01 at the time of this writing) will solve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.