Learn › Part 2 ยท Network attacks and defence
LAN and transport attacks: ARP, DHCP, SYN flood, hijacking
Layer 2 attacks mapped to X.800, DHCP starvation and spoofing, SYN floods and SYN cookies, session hijacking and spoofing, and Ettercap.
X.800 attacks at Layer 2
| X.800 category | Layer 2 form |
|---|---|
| Release of contents | Promiscuous-mode sniffing, taps, SPAN ports |
| Traffic analysis | Profiling MACs (vendor OUI), frame sizes and timing |
| Masquerade | MAC spoofing; ARP spoofing (claiming the gateway's IP) |
| Modification | ARP-poisoned man-in-the-middle rewriting frames and recomputing the FCS |
| Replay | Re-injecting captured frames (for example ARP replay against old WEP) |
| Denial of service | MAC flooding (CAM overflow), DHCP starvation, Wi-Fi deauthentication floods |
A switch forwards by its CAM table; when MAC flooding fills it, the switch floods unknown destinations to every port and acts like a hub. ARP is stateless and unauthenticated, so hosts accept unsolicited replies and overwrite their caches.
DHCP starvation and rogue servers
- Starvation: many DISCOVER/REQUEST messages with spoofed MACs drain the pool (DoS). Behind a relay every frame carries the router's MAC, so the server must inspect the client hardware address (CHADDR) in the DHCP payload.
- Spoofing: clients take the first OFFER, so a rogue server that answers first sets the victim's gateway (MitM) and DNS server (pharming). Defence: DHCP snooping with trusted ports.
Worked example
Pool 254, in use 150, free 104; flood 500 DISCOVER/min. Time = 104 / 500 = 0.208 min = 12.48 s (one slide prints “12.5 minutes”, which is a unit error). A 1-hour lease instead of 24 hours does not slow exhaustion; it shortens the outage after the flood stops.
SYN floods
The server stores state for each SYN in its backlog and answers SYN-ACK; the attacker never sends the final ACK, so half-open entries fill the queue. Spoofing a live host fails because that host replies RST; attackers use offline addresses or botnets that ignore SYN-ACKs.
Fill time = backlog capacity / SYN rate. Example: 8,192 / 50,000 per s = 0.164 s, so cutting the timeout from 30 s to 5 s changes nothing.
Defences: filtering, ingress filtering at the edge (drop inbound packets claiming your own prefix, and outbound packets not from it), and SYN cookies: the server keeps no state and encodes addresses, ports, time, MSS and a secret into its ISN, rebuilding state when a valid ACK returns.
Hijacking versus spoofing
| Session hijacking | Session spoofing | |
|---|---|---|
| Target | An established connection | A new connection |
| Needs | Sniffed 4-tuple and current seq/ack; desynchronise the real client (flood or forged RST) | Trusted host taken offline (else it sends RST); blind prediction of the server's ISN |
Random initial sequence numbers exist to keep old, delayed segments out of new connections and to make blind prediction hard.
Ettercap in practice
sudo ettercap -T -i eth0 -M arp:remote /192.168.1.1// /192.168.1.50//
# -T text UI -G GUI -q quiet -i interface -w file.pcap save
# -M arp:remote two-way ARP poisoning between the two targets
etterfilter swap.filter -o swap.ef # compile a content-rewriting filter
sudo ettercap -T -i eth0 -F swap.ef -M arp:remote // //
Defences: Dynamic ARP Inspection backed by DHCP snooping, static ARP for critical hosts, client isolation on Wi-Fi, and TLS everywhere so a MitM cannot read or alter content.
Common pitfalls
- Watch units in rate problems (minutes versus seconds).
- Shorter timeouts do not beat floods that refill faster than they expire.
- MAC limiting at a remote DHCP server sees only the relay's MAC.