I inherited a small network and currently am assessing its security performance.
I started port scanning a host (lets call it Weirdo) in that small network and from my perspective, it seems that that specific host has some kind of port scanning detector and/or scan result obfuscator thing with iptables going on, because the result coming back from the intense scan differs so much from that of the quick one.
So here the quick scan result me@mypc:~# nmap -T4 -F 12.34.56.78
:
Starting Nmap 7.01 ( https://nmap.org ) at 2017-04-18 11:48 CEST
Nmap scan report for 12.34.56.78
Host is up (0.57s latency).
Not shown: 93 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
53/tcp open domain
80/tcp open http
3306/tcp open mysql
8080/tcp open http-proxy
8443/tcp open https-alt
Nmap done: 1 IP address (1 host up) scanned in 4.15 seconds
This actually shows the same output as running the quick scan from Weirdo localhost root@Weirdo:~# nmap -T4 -F localhost
.
But this is the intense scan me@mypc:~# nmap -T4 -A -v 12.34.56.78
:
1/tcp open tcpmux?
...(every port is shown as open, except a few)
49155/tcp open unknown
...
9102/tcp open jetdirect?
...
65389/tcp open tcpwrapped
...
Completed SYN Stealth Scan at 11:49, 18.22s elapsed (1000 total ports)
...
Not shown: 120 closed ports
Note: ...
means repetition of previous line with different port number
So basically the intense scan finds that many more ports are open, but this is paradox, because the intense scan on the Weirdo localhost root@Weirdo:~# nmap -T4 -A -v localhost
gives also the exact same open port list as the quick scan.
When I look at the traceroute then I see the following:
TRACEROUTE (using port 199/tcp)
HOP RTT ADDRESS
1 1.52 ms 12.99.34.255
2 1.37 ms 12.99.0.3
3 1.09 ms 12.34.56.78
Port Scanning the two ips with me@mypc:~# nmap -sV -T4 -O -F --version-light 12.99.34.255 12.99.0.3
I see that 12.99.34.255
is a Netgear Firewall FVS336Gv2 accessible with the browser (port 80, is open therefore).
A consecutive (1 seconds after), quick scan (after the intense scan) does result in the same output as the intense scan.
After waiting a couple of seconds and then doing the quick scan again it results in the same output as the initial quick scan.
Is this firewall playing tricks on the intense scan probably?
Another little addition:
On the Weirdo host I check the iptables firewall and get this:
root@Weirdo:~# iptables -vL -t filter
Chain INPUT (policy DROP 25288 packets, 1768K bytes)
pkts bytes target prot opt in out source destination
101K 54M ACCEPT all -- lo any anywhere anywhere
189K 12M ACCEPT all -- eth1 any anywhere anywhere
285 9686 ACCEPT icmp -- eth0 any anywhere anywhere icmp echo-request
297 30354 garbage all -- eth0 any anywhere anywhere state INVALID
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: FIN,SYN,RST,PSH,ACK,URG/NONE
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: FIN,SYN/FIN,SYN
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: SYN,RST/SYN,RST
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: FIN,RST/FIN,RST
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: FIN,ACK/FIN
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: PSH,ACK/PSH
0 0 garbage tcp -- eth0 any anywhere anywhere tcpflags: ACK,URG/URG
1968K 2742M ACCEPT all -- eth0 any anywhere anywhere state RELATED,ESTABLISHED
9564 391K ACCEPT tcp -- eth0 any anywhere anywhere tcp dpt:http
463 27508 ACCEPT tcp -- eth0 any anywhere anywhere tcp dpt:domain
45 2392 ACCEPT tcp -- eth0 any anywhere anywhere tcp dpt:8443
0 0 ACCEPT tcp -- eth0 any anywhere anywhere tcp dpt:9422
25288 1768K garbage all -- eth0 any anywhere anywhere
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1361K packets, 501M bytes)
pkts bytes target prot opt in out source destination
Chain garbage (9 references)
pkts bytes target prot opt in out source destination
Are these filters playing the tricks on the intense scan?
What does it mean to have a rule with target garbage
?