Notes / Module 3
Attacking the Foundation
IP, TCP and UDP were built to move data, not to protect it. This module shows which header fields and design choices attackers abuse, from ICMP floods to the SYN flood.
3.1Why IP is exploitable
IP is connectionless, and it never validates the source address. It was designed to deliver packets, not to track or manage flow; flow control belongs to TCP at Layer 4. As a result, threat actors can spoof the source and tamper with header fields.
3.1The IPv4 header
| Field | Size | Purpose |
|---|---|---|
| Version | 4 bits | Set to 0100 |
| Internet Header Length | 4 bits | Header length; minimum 20 bytes |
| Differentiated Services | 8 bits | Sets packet priority; top 6 bits are DSCP, last 2 are ECN |
| Total length | 2 bytes | Header plus data; maximum packet 65,535 bytes |
| TTL | 8 bits | Decremented by one at each router |
| Protocol | Names the payload type |
When TTL reaches zero the packet is discarded and an ICMP Time Exceeded message is sent to the source. The Protocol field makes sure the payload reaches the right upper-layer protocol:
| Protocol | Value |
|---|---|
| ICMP | 1 |
| TCP | 6 |
| UDP | 17 |
Identification, Flag and Fragment offset handle fragmentation. They are used when a route can't carry the packet's size: the packet is divided and reassembled later.
3.1The IPv6 header
The IPv6 header is 40 bytes and has eight fields: Version, Traffic Class, Flow Label, Payload Length, Next Header, Hop Limit, Source and Destination. Several replace IPv4 fields:
| IPv6 field | IPv4 equivalent | Note |
|---|---|---|
| Traffic Class (8 bits) | Differentiated Services | |
| Next Header (8 bits) | Protocol | |
| Hop Limit (8 bits) | TTL | Sends ICMPv6 Time Exceeded |
| Flow Label (20 bits) | None given | Same handling for the same flow |
| Source / Destination | Addresses | 128-bit, not 32-bit |
Extension headers carry optional information between the header and the payload, used for fragmentation, security and mobility. Routers do not fragment routed IPv6 packets.
3.2IP attacks and ICMP abuse
There are six IP-related attacks: ICMP, DoS, DDoS, address spoofing, MiTM and session hijacking.
Actors abuse ICMP for reconnaissance (mapping the topology, finding reachable hosts, OS fingerprinting, determining firewall state) and for DoS and DDoS floods. Ping is a user-generated echo request. The messages attackers favour:
| ICMP message | Attacker use |
|---|---|
| Echo request/reply | Host verification and DoS |
| Unreachable | Reconnaissance and scanning |
| Mask reply | Map an internal IP network |
| Redirects | Lure traffic through a compromised device (MiTM) |
| Router discovery | Inject bogus routes |
Limit probing with strict ICMP ACL filtering at the network edge. Analysts spot attacks in captured traffic and log files; in large networks, firewalls and IDS raise the alerts.
3.2Smurf and address spoofing
A Smurf attack amplifies to many and reflects back to one:
- Amplification: echo requests go to many hosts, spoofed to appear to come from the victim.
- Reflection: all those hosts reply to the victim at once.
- Newer variants include DNS reflection and NTP amplification.
In address spoofing the question is whether the attacker can see the replies.
| Type | Attacker sees traffic? | Used for |
|---|---|---|
| Non-blind | Yes | Predicting sequence numbers and hijacking sessions |
| Blind | No | DoS |
MAC spoofing fools a switch by exploiting its CAM table:
- The attacker sets their MAC to match the target's.
- The switch reads the source MAC on the frame.
- It overwrites the CAM entry to the attacker's port.
- Frames for the target now go to the attacker.
3.3TCP control bits and services
TCP provides three services: reliable delivery (acknowledgments and retransmission), flow control (many segments per acknowledgment) and stateful communication, established by the three-way handshake.
- URG
- Urgent pointer significant.
- ACK
- Acknowledgment significant.
- PSH
- Push function.
- RST
- Reset the connection.
- SYN
- Synchronize sequence numbers.
- FIN
- No more data from sender.
3.3Handshake, SYN flood, reset, close and hijacking
The three-way handshake is SYN, SYN-ACK, ACK. The client requests a client-to-server session, the server acknowledges and requests server-to-client, and the client acknowledges server-to-client, at which point the session is established.
The three-way handshake
A SYN flood
A SYN flood fills the target with half-open connections that never complete. SYNs are sent with randomly spoofed source addresses, the target replies SYN-ACK and waits, and the final ACK never arrives. Legitimate users are denied service.
A TCP reset attack uses a spoofed RST to kill a session instantly. RST is an abrupt teardown, sent to one or both endpoints.
A normal close is a four-way exchange: FIN, ACK, FIN, ACK.
- Client sends FIN.
- Server ACKs: client-to-server closed.
- Server sends its own FIN.
- Client ACKs: server-to-client closed.
Session hijacking needs the attacker to spoof the IP, predict the sequence number and send an ACK. It takes over an already-authenticated host. The attacker can send but not receive data, and it is difficult to conduct.
3.3UDP and its attacks
UDP is chosen for low overhead in simple request-and-reply. It is connectionless, with no retransmission, sequencing or flow control, and has an 8-byte header: source port, destination port, length, checksum. DNS, DHCP, TFTP, NFS and SNMP use it, as do media streaming and VoIP. 'Unreliable' means reliability is not provided at the transport layer.
UDP's weaknesses:
- No encryption, so traffic can be read and altered.
- The checksum is optional and can be recomputed by the attacker.
- A UDP flood (tools like UDP Unicorn and Low Orbit Ion Cannon) sweeps all ports; the server replies with ICMP port unreachable.
- That resulting traffic eats the bandwidth, like a DoS.
Check yourself
Answer these out loud, without scrolling up. Any you can't, reread that section — then let the deck mark you.
- 1.Why can IP source addresses be spoofed, and which layer handles flow control instead?
- 2.Give the Protocol field values for ICMP, TCP and UDP.
- 3.Which IPv6 fields replace Differentiated Services, Protocol and TTL?
- 4.Explain amplification and reflection in a Smurf attack.
- 5.Walk through the handshake and say which step is missing in a SYN flood.
- 6.What does a session hijacker need, and what can they not do?