- Network scanning refers to a set of procedures for identifying hosts, ports, and services in a network
- Network scanning is one of the components of intelligence gathering and attacker uses to create a profile of the target organization
- Types of scanning
- Port scanning (list the open ports and services)
- Network Scanning (lists IP addresses)
- Vulnerability Scanning (shows presence of known weaknesses)
- TCP communication Flags (controls transmission of data)
- URG(urgent): Data contained in packet should be processed immediately
- PSH(push): Sends all buffered data immediately
- FIN(Finish): There will be no more transmissions
- ACK(Acknowledgement): Acknowledges receipts of a packet
- RST(Reset): Resets a connection
- SYN(Synchronization): Initiates a connection between hosts
- ICMP Scanning: Ping scans involves ICMP ECHO requests to a host. If the host is live, it will return an ICMP ECHO reply
- Useful for locating active devices and if ICMP is passing through firewall
- Ping sweep is used to determine the live hosts from a range of IP addresses
- Attackers calculate subnet masks using Subnet Mask Calculators
- Attackers then use the Ping Sweep to create an inventory of live systems in the subnet
- Simple Service Discovery protocol (SSDP) works in conjunction with UPnP to detect plug and play devices on a networks
- Vulnerabilities in UPnP may allow attackers to launch Buffer overflow or DoS attacks
- Scanning IPv6 networks are computationally less feasible due to larger search space (128 bits)
- Network admins can use Nmap for network inventory, managing service upgrade schedules, and monitoring host or service uptime
- Attacker uses Nmap to extract info such as live hosts on the network, services, type of packet filters/firewalls, operating systems and OS versions
- Hping2/Hping3: command line network scanning and packet crafting tools for the TCP/IP protocol
- It can be used for network security auditing , firewall testing
- TCP connect scan detects when a port is open by completing the three-way handshake
- TCP connect scan establishes a full connection and tears it down sending a RST packet
- It does not require superuser privileges
- Attackers send TCP probe packets with a TCP flags (FIN,URG,PSH) set or with no flags. No responses means port is open, RST means the port is closed
- In Xmas scan, attackers send a TCP frame to a remote device with FIN, URG, and PUSH flags set
- Won’t work against any current version of Microsoft Windows
- Attackers can an ACK probe packet with random sequence number, no responses means the port is filtered (stateful firewall is present) and RST response means the port is not filtered
- A port is considered open if an application is listening on the port
- Most web servers are on port 80 and mail servers on 25
- One way to determine whether a port is open is to send a “SYN” (session establishment) packet to the port
- The target machine will then send back a SYN|ACK packet is the port is open, and a RST (reset) packet if the port is closed
- IDLE Scan
- Attack a zombie computer. A zombie machine is one that assigns IPID packets incrementally.
- Can retrieve IPID number for IP address spoofing
- UDP Scanning: When UDP port is open ---There is not three-way TCP handshake for UDP scan. System does not respond with a me. The system does not respond with a message when the port is open. When UDP port is closed -- the system responds with ICMP port unreachable message. Spywares, Trojan Horses, and other apps use UDP ports
- There are port scanners for mobile as well
- Port scanning counter measures
- Configure firewall, IDS rules to detect/block probes
- Run port scanning tools against hosts to determine firewall properly detects port scanning activity
- Ensure mechanism used for routing and filtering at the routers and firewalls respectively cannot be bypassed
- Ensure sure the router, IDS, and firewall firmware are updated
- Use custom rule set to lock down the network and block unwanted ports
- Filter all ICMP message at the firewalls and routers
- Perform TCP and UDP scanning
- Ensure that anti scanning and anti spoofing rules are configured
- Evasion techniques: fragmented IP packets, spoofing IP address, source routing, connect to proxy servers
- Lower the frequency of packets, split into parts
- An attacker uses banner grabbing techniques to identify network hosts running versions of applications and OSs with known exploits.
- Banner grabbing or OS fingerprinting is the method to determine the operating system running on a remote target system. There are two types
- Active Banner Grabbing: specifically crafted packets are sent to remote OS and responses are noted, then compared with a database to determine OS.
- Passive Banner Grabbing: Sniffing the network traffic. Banner grabbing from error message, and banner grabbing from page extensions (stealthy)
- Identifying OS’s allow an attack to figure out the vulnerabilities running on a remote target system
- An attacker uses banner grabbing to identify the OS used on the target host and thus determine the system vulnerabilities
- Tools like Netcat reads and writes data across network connections
- Countermeasures for banner grabbing
- Display False Banners
- Turn off unnecessary services
- Use ServerMask
- Hiding file extensions from web pages
- Vulnerability scanning identifies vulnerabilities and weaknesses of a system
- Nessus is the vulnerability and configuration assessment product
- A network diagrams helps in analyzing complete network topology.
- Drawing target’s network diagram shows logical or physical path to a potential target. Shows network and its architecture to attacker
- Proxy servers serves as an intermediary for connecting with other computers
- Hides the source IP
- Chain multiple proxies to avoid detection
- Many hackers use proxies to hide his/her identity so they cannot be traced. Logs record proxy’s address rather than the attacker’s
- Burp suite includes an intercepting proxy, which lets you inspect and modify traffic between your browser and target app. Popular.
- Anonymizers removes all identifying information from a user’s computer while user surfs internet
- Tails is a live operating system, that user can start on any computer from a DVD, USB stick, or SD card
- Can use HPING2 to IPSpoof
- IP spoofing counter measures
- Encrypt all network traffic
- Use multiple firewalls
- Do not rely on IP-based authentication
- Use random initial sequence number
- Ingress filtering: use routers and firewalls at network perimeter to filter incoming packets that appear to come from an internal IP address
- Egress filtering: Filter all outgoing packets with an invalid local IP address as source address
- Pen testing a network determines the network's security posture by identifying live systems, discovering open ports, associating services and grabbing system banners to simulate a network hacking attempt
- Here’s how to conduct a pen-test of a target network
- Host Discovery: detect live hosts on the target network. It is difficult to detect live hosts behind a firewall (Nmap, Angry IP scanner, colasoft)
- Port Scanning: Check for open ports (Nmap, Netscan)
- Banner Grabbing or OS fingerprinting: determine the OS running on the target host
- Scan the network for vulnerabilities (nessus)
- Draw Network Diagrams that help you understand the logical connection
- Prepare Proxies: Hides yourself from detection
- Document all findings