Security Tip: Avoid Detection with nmap Port Scan Decoys

Posted on in Categories Howto, Linux, Monitoring, Networking, Security, Sys admin, UNIX last updated January 8, 2008

You can test your IDS or IPS devices to monitor your scan traffic. Use this feature to avoid detection with nmap. You may not want to get caught performing a network scan. For example, using following technique you can test your own IDS / IPS / network security from remote location or home.

nmap Decoy option – Cloak a scan with decoys

nmap has -D option. It is called decoy scan. With -D option it appear to the remote host that the host(s) you specify as decoys are scanning the target network too. Thus their IDS might report 5-10 port scans from unique IP addresses, but they won’t know which IP was scanning them and which were innocent decoys. While this can be defeated through router path tracing, response-dropping, and other active mechanisms, it is generally an effective technique for hiding your IP address.

You can separate each decoy host with commas, and you can optionally use ME as one of the decoys to represent the position for your real IP address. If you put ME in the 6th position or later, some common port scan detectors (such as Solar Designer’s excellent scanlogd) are unlikely to show your IP address at all. If you don’t use ME, nmap will put you in a random position. Note that the hosts you use as decoys should be up or you might accidentally SYN flood your targets. Also it will be pretty easy to determine which host is scanning if only one is actually up on the network. You might want to use IP addresses instead of names (so the decoy networks don’t see you in their nameserver logs).

WARNING! These penetration testing (security testing) examples may be considered as Unauthorized Access or Illegal Behavior. Use examples on your own RISK and/or to secure your own network host / IPS /IDS.

Use the following syntax:
# nmap -n -Ddecoy-ip1,decoy-ip2,your-own-ip,decoy-ip3,decoy-ip4 remote-host-ip
# nmap -n -D192.168.1.5,,,

Host (or network IDS / IPS) will see 4 port scan and remote host / IDS has no way telling which one was real. Decoys are used both in the initial ping scan (using ICMP, SYN, ACK, or whatever) and during the actual port scanning phase. Decoys are also used during remote OS detection (-O). Decoys do not work with version detection or TCP connect scan. It is worth noting that using too many decoys may slow your scan and potentially even make it less accurate. Also, some ISPs will filter out your spoofed packets, but many do not restrict spoofed IP packets at all.

nmap ideal scan technique to hide your IP

Following example, uses an an idle scan technique. It uses port 1234 on IP as as a zombie to scan host –
# nmap -P0 -sI

This technique only hides your source address but remote IPS / IDS always record and logs scan. Please refer to nmap man page for more information:
man nmap