- tcp vs udp
- tcp flags
- SYN
- ACK
- FIN
- RST
- PSH
- URG
- tcp three-way handshake
- session estabilishment:
SYN,SYN-ACK,ACK - session termination:
FIN,ACK-FIN,ACK
- session estabilishment:
- ping scan types
- ARP - network protocol used to find out the hardware (MAC) address of a device from an IP address
- sends a request packet to all the network elements, asking for the MAC address from a specific IP
nmap -sn <host>- executed by a privileged user on a local ethernet network it uses ARP scan by default
- executed by a privileged user it uses ICMP ECHO request + TCP SYN to port 443 + TCP ACK to port 80, and an ICMP timestamp request
- executed by a unprivileged user it uses TCP SYN to port 80 and 443
- UDP ping scan - similar to TCP ping scan; however, in the UDP ping scan, Nmap sends UDP packets to the target host
nmap -sn -PU <host>
- ECHO - involves sending ICMP ECHO requests to a host. If the host is alive, it will return an ICMP ECHO reply. Useful for locating active devices or determining if ICMP is passing through a firewall
nmap -sn -PE <host>
- ECHO sweep - basic network scanning technique that is adopted to determine the range of IP addresses that map to live hosts
nmap -sn -PE 10.10.10.5-15from host 5 to host 15- countermeasures
- ICMP timestamp
nmap -sn -PP <host>hpingICMP mode-1
- ICMP address mask - is effective in identifying the active hosts similarly to the ICMP timestamp ping, specifically when the administrator blocks the traditional ICMP Echo ping
nmap -sn -PM <host>
- SYN
nmap -sn -PS <host>
- ACK
nmap -sn -PA <host>
- IP
nmap -sn -PO <host>
- ARP - network protocol used to find out the hardware (MAC) address of a device from an IP address
Different types of port scanning techniques is used to bypass IDSs.
On TCP scans, the target host responds with RST or RST/ACK when the port is closed.
TCPConnect/Full Open Scan (nmap-sT, hping-8) - port closed:RSTresponse- Stealth
TCPScanning Methods (nmap-sS)- Half-open Scan
- Inverse
TCPFlag Scan: : high stealtly, requires superuser privileges, avoids many IDS and logging system, most effective on BSD TCP/IP stack, not very effective on windows hosts.- Xmas Scan:
FIN,URG,PSH(nmap-sX, hping-FUP) FINScan (nmap-sF, hping-F)NULLScan (nmap-sN)- Maimon Scan:
FIN/ACK(nmap-sM)
- Xmas Scan:
ACKFlag Probe Scan: slow and works with older BSD based TCP/IP stacks.- TTL-Based Scan (ttl
RST < 64-> port is open) - Window Scan (window value
RST != 0-> port is open) - used to check if the port is filtered (firewalled)
- TTL-Based Scan (ttl
- IDLE/IP ID Header Scan: use of zombie host to check open/closed port using IPID number check (nmap
-sI, hping-Q)
UDPScanning: no response if port is open,ICMPport unreachable message otherwise (nmap-sU, hping-2)SCTPScanning:- Stream Control Tranport Protocol
SCTP INITScanning (ABORT chunk means that port is closed, nmap-sY)SCTP COOKIE/ECHOScanning - no response means that port is opennmap -sZ
SSDPScanning:- Simple Service Discovery Protocol
SSDPscanning: (metasploit modulescanner/upnp/ssdp_msearch)
- List Scanning (nmap
-sL) - IPv6 Scanning (nmap
-6) - service version discovery (nmap
-sV) - nmap timing options(nmap
-T)
- Configure firewall and IDS to detect probes
- run port scanning agains host on the network
- check firewalls and routers
- update firmwares
- custom set of rules to lock down the network
- filter all
ICMPmessages - perform
TCPandUDPscanning along withICMPprobes - ensure anti-scanning and anti-spoofing rules are correctly configured
- nmap operating system detection options (
-O) - types of banner grabbing:
- active: using
TCP/IPstack probes - passive:
- from error messages
- sniffing network traffing
- from page extensions
- active: using
Four areas that determine the OS:
- TTL (time to live)
- Window Size
- DF (Don’t Fragment) bit set
- TOS (Type of Service)
| OS | TTL | Window size |
|---|---|---|
| Linux (Kernel 2.4 and 2.6) | 64 | 5840 |
| Google Linux | 64 | 5720 |
| FreeBSD | 64 | 65535 |
| OpenBSD | 64 | 16384 |
| Windows 95 | 32 | 8192 |
| Windows 2000 | 128 | 16384 |
| Windows XP | 128 | 65535 |
| Windows 98, Vista, and 7 (Server 2008) | 128 | 8192 |
| iOS 12.4 (Cisco Routers) | 255 | 4128 |
| Solaris 7 | 255 | 8760 |
| AIX 4.3 | 64 | 16384 |
- nmap script engine (
--script) - ipv6 fingerprinting (nmap
-6 -O) - banner grabbing countermeasures:
- disabling or changing banner
- hiding file extensions from web pages (e.g.
.aspto.htm)
- packet fragmentation (hping
f) - source routing (create custom chain of hops)
- source port manipulation (nmap
-gor--source-port) - ip address decoy (nmap
-D RND:10,-D decoy1,decoy2,decoy3,...,ME,...) - ip spoofing (hping3
-a) - ip spoofing detection tencniques:
- ttl may be different
- ip identification number is different
- tcp flow
- egress filtering
- creating custom packets (nmap
--data-string) - randomize host address (nmap
--randomize-hosts) - sending bad checksum (nmap
--badsum) - proxy servers
- anonymizer
- types: networked, single-point
- hping2/hping3
- metasploit
- mobile scanner: ip scanner/fing/network scanner
- nmap
- angry ip scanner
- netcat
- wireshark
- packet creation tool:
- colasfot packet builder
- netscantool pro
- network topology mapper