Platform 1: TCP SYN flood
Filling a server's waiting list with connections that never finish
Every TCP connection opens with a . The server sets aside memory for the connection, a , as soon as the first packet arrives, before it knows the sender is real. A SYN flood sends thousands of first packets from addresses. Each leaves a connection waiting for an answer that never comes, until the is full and real users are turned away.
Model 1: the server's waiting list
The black board is the server's SYN queue. Each row is one half-open connection, and each one uses memory on the server. Real users are shown in blue so you can tell them apart. The server itself cannot. The clock runs 5× faster, and the queue is cut to 8 rows so you can watch each one.
- SYN spoofing
- SYN/ACK orphaned
- Queue overflow
- Denial of service
Normal handshake vs SYN flood
| Packet | Normal connection | SYN flood |
|---|---|---|
| 1. SYN | From the real client, seq=100 | From the attacker, with a fake source address |
| 2. SYN/ACK | Server reserves a slot, replies seq=300 ack=101 to the client | Server reserves a slot, replies to an address that is offline RFC 4987 §2.2 |
| 3. ACK | Arrives with seq=101 ack=301; slot freed within milliseconds | Never arrives; Linux keeps retrying for about 63 s by default kernel docs, 4.4BSD-derived systems up to 511 s RFC 4987 §2.2 |
| Result | Connection ESTABLISHED, user served | Queue full, new SYNs dropped, real users time out |
Why the fake addresses must be offlineIf a spoofed address belonged to a live machine, that machine would answer the unexpected SYN/ACK with a , and the server would free the slot at once RFC 4987 §2.2.
Defenses, and what each one costs
| Defense | What it does | The catch | In the model |
|---|---|---|---|
| Encodes the connection into the SYN/ACK sequence number and stores nothing until a valid ACK comes back | Some TCP options do not fit in the cookie RFC 4987 §3.6. Linux treats it as a fallback for when the queue overflows kernel docs | SYN cookies switch | |
| Bigger backlog | Holds more half-open connections | Only buys time, because a faster flood fills it again §3.2 | Queue size |
| Fewer SYN/ACK retries | Frees each slot sooner | Helps only against slow floods, and slow real clients may fail §3.3 | SYN/ACK retries |
| SYN cache | Keeps a small record per SYN and builds the full TCB only after the final ACK | In tests, real connections took about 15% longer to set up while under attack §3.5 | Not modeled |
| Filtering | Networks drop packets whose source address is forged | Works only where deployed; a botnet does not need spoofing §3.1 | Not modeled |
| Firewall or proxy | A middlebox completes the handshake and passes on only finished connections | Moves the load onto the middlebox §3.8 | Not modeled |
Spotting it on a serverCount half-open connections with netstat -an | grep SYN_RECV | wc -l; the model's board footer shows the same count. The slide treats more than 100 as an early sign of a SYN flood (slide 58). On Linux each SYN_RECV entry costs about 304 bytes of memory kernel docs.
Finding who is sendingSlide 58's second command counts connections per source address: netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n. Against a spoofed flood it finds nothing useful, because every SYN carries a different fake address, so each one appears once, as on the model's board. It helps against a botnet that floods from its real addresses, where a few sources show up hundreds of times.
Platform 2: Mirai botnet and the DGA
How cameras and routers with factory passwords became one remote-controlled botnet
In 2016 Mirai took over about 600,000 cameras, video recorders and routers at its peak Antonakakis §4.2, just by logging in over with factory-default passwords. The infected devices formed a that flooded targets on orders from a server. The bots only find victims; a separate loader server does the infecting §2.
Slide 52 puts Mirai and DGA together. They came at different times.The 2016 Mirai reached its C2 through domain names written into its code, and researchers pulled 67 of them out of the binaries §3.3. A appeared later in one short-lived variant, used only when those hardcoded domains failed to resolve Netlab, Dec 2016. The two models below keep them apart.
Two numbers that differ from slide 52The slide gives about 60 default logins and "millions" of devices. The Mirai source code holds 62 username and password pairs, and the measured peak was about 600,000 devices at once Antonakakis §2, §4.2. The slide also describes DGAs that make thousands of names a day; that is true of DGAs in general, while the Mirai variant made one Netlab.
Model 2: the infection loop
The red loop line is one infection, stop by stop, as described in the Mirai paper §2. Below it is a neighborhood of 24 devices. Device .10 is already a bot, and the rest of the internet is scanning too.
Model 3: how bots find their C2
Compare a fixed C2 address with a . Each day the bot and the operator run the same function on the date and get the same list of names. The operator registers one; the rest return . This is a teaching formula with reserved test domains, not Mirai's real algorithm, and it makes 5 names a day where the Mirai variant made 1 Netlab.
Hardcoded C2 vs DGA
| Hardcoded C2 (Mirai, 2016) | DGA (later variant) | |
|---|---|---|
| Where the address comes from | Written into the malware | Computed each day from the date and a shared seed |
| To cut the bots off | Take down one domain | Beat every future domain |
| Defender's move | Pull the names from the binary and block or them | Reverse the algorithm, register names ahead, watch for bursts of NXDOMAIN ATT&CK T1568.002 |
| Weak spot | A single point of failure | The algorithm can be recovered, and the failed lookups are noisy |
How big it got
| Date | Event |
|---|---|
| 1 Aug 2016 | First scan; 64,500 devices infected within 20 hours §4.1 |
| 21 Sep 2016 | 623 Gbps attack on the Krebs on Security blog §6.3 |
| 30 Sep 2016 | Source code published; copycat variants follow §5.2 |
| 21 Oct 2016 | Attack on DNS provider Dyn disrupts Amazon, GitHub, Netflix, Twitter and others. It included SYN floods on port 53, the attack from platform 1 §6.3 |
| End of Nov 2016 | Peak of about 600,000 infected devices §4.2 |
| 9 Dec 2016 | A variant with a DGA is reported, spreading through ports 7547 and 5555 Netlab |
DefenseChanging default passwords and turning off Telnet stops the infection at the source. A reboot alone clears the malware from RAM, but an unchanged device is found and infected again CISA TA16-288A. Against a DGA, flag machines with many NXDOMAIN answers and sinkhole the predicted names ATT&CK T1568.002.
Spotting an infected deviceA bot scans for the next victim, so on your own network a camera or router that suddenly opens many outbound connections to TCP 23 and 2323 is probably infected Antonakakis §2. Block outbound Telnet from IoT devices at the firewall, so an infected one cannot recruit others.
Platform 3: TCP session hijacking in 3 phases
Taking over a live connection by forging the numbers it trusts
Once a TCP connection is open, each end accepts any packet with the right addresses, ports and numbers. Nothing else proves who sent it. An attacker between client and server can read those numbers, knock the two ends out of step, then speak to the server as the client Joncheray 1995.
Model 4: hijack a Telnet session
The handshake is done: the client started at 100, the server at 300, the same numbers as slide 63. The three boards show what each side expects next. The server accepts a packet only if its SEQ equals the byte it expects next (inside its window) RFC 9293 §3.10.7.4.
- Track and sniff
- Desynchronize
- Inject
- ACK storm
Two ways to desynchronizeThe model injects harmless null data (Telnet no-ops) into an open session, so the server's count jumps ahead of the client's. The other way, early desync, strikes during setup: the attacker resets the half-built connection with an and opens a new one with a different starting number Joncheray. Either way the result is the same state, and an follows.
Spotting itA network IDS sees what the packet log in the model shows: a sudden jump in a connection's sequence numbers (the "SEQ Jump" indicator on slide 80) and bursts of empty ACKs going back and forth between two hosts. The lab tool on slides 66 and 67, Hunt, does the same three phases on a real LAN: it lists active connections, resets or desynchronizes one, and injects into it.
Network-level vs application-level hijacking
| Network-level (this model) | Application-level | |
|---|---|---|
| Layer | 3 and 4: IP and TCP | 7: HTTP and HTTPS |
| What is taken over | The TCP stream itself | The session cookie or token |
| How | Sniff SEQ/ACK, desynchronize, inject; RST tricks | XSS, session fixation, sniffing cookies sent over plain HTTP |
| Works against | Any TCP application | Web applications |
| Main defense | Encrypt and authenticate packets (TLS, IPsec); unpredictable stop attackers off the path RFC 6528 | Cookie flags Secure, HttpOnly, SameSite, plus HSTS (slides 76 to 78) |
The three attacks side by side
| SYN flood | Mirai | TCP session hijack | |
|---|---|---|---|
| Part of CIA hit | Availability | Availability, through the DDoS it launches; the devices themselves are taken over | Integrity and confidentiality |
| Layer | Transport (TCP) | Application (Telnet login) to recruit; its floods hit several layers | Network and transport (IP, TCP) |
| What it abuses | The server stores state before the client is proven real | Factory-default passwords on exposed Telnet | Trust in any packet with the right IP, port and SEQ/ACK |
| Attacker needs | A way to send many SYNs; spoofing hides the source | Internet reach to devices with Telnet open | A position on the path, or ISNs it can guess |
| Stages | 4 (slide 45) | 6-stop loop (paper §2) | 3 phases (slide 65) |
| Best defense | SYN cookies; filtering and scrubbing upstream | Change default passwords, close Telnet, patch | Encryption with authentication: TLS, IPsec; random ISNs |
Terms
- 3-way handshake
- The three packets (SYN, SYN/ACK, ACK) that open a TCP connection before any data moves. RFC 9293 §3.5
- TCB
- Transmission Control Block: the record a host keeps in memory for each connection, holding its addresses, ports, sequence numbers and state. RFC 9293 §3.3.1
- Half-open connection (SYN_RECV)
- A connection the server has answered with SYN/ACK but that has not received the final ACK yet. RFC 4987 §2.2
- Backlog (SYN queue)
- The limit on how many half-open connections a listening port holds. When it is full, new SYNs are dropped. RFC 4987 §2.2
- IP spoofing
- Writing a false source address into a packet, so the replies go somewhere else. RFC 4987 §2.2
- RST
- A TCP flag that aborts a connection at once. A host sends it when a packet does not belong to any connection it knows. RFC 9293 §3.5.2
- ISN
- Initial Sequence Number: each side's starting count. It must be hard to predict, or an attacker off the path can guess it. RFC 6528 §3
- SEQ and ACK numbers
- SEQ numbers the bytes a side sends; ACK names the next byte it expects. A segment is accepted only if its SEQ falls inside the receiver's window. RFC 9293 §3.4
- Botnet
- A group of malware-infected devices controlled remotely as one. CISA TA16-288A
- C2 (command and control)
- The server an operator uses to send orders to infected devices. MITRE ATT&CK
- Telnet
- An old remote-login protocol that sends everything, passwords included, unencrypted. Mirai scanned for it on TCP ports 23 and 2323. Antonakakis §2
- DGA
- Domain Generation Algorithm: code that malware and its operator both run to compute the same changing list of C2 domain names, usually from the date. ATT&CK T1568.002
- NXDOMAIN
- The DNS answer that means the name does not exist. Many of them from one machine is a sign of a DGA at work. ATT&CK T1568.002
- Sinkhole
- Defenders take control of a C2 name and point it at their own server. Bots that connect there are cut off from the operator and reveal themselves. ATT&CK T1568.002
- On-path attacker
- Also called man-in-the-middle: an attacker on the route between two hosts, who can see their packets and send forged ones, such as someone on the same Wi-Fi or a compromised router. Joncheray
- Desynchronized state
- Both ends think the connection is open, but each one's SEQ falls outside what the other expects, so their own packets get rejected. Joncheray
- ACK storm
- Two desynchronized ends answering each other's unacceptable packets with ACKs, in a loop. The ACKs carry no data, so one lost packet ends it. Joncheray
Sources
- Eddy, W. (ed.). Transmission Control Protocol (TCP). RFC 9293, IETF, Aug 2022. rfc-editor.org/rfc/rfc9293
- Eddy, W. TCP SYN Flooding Attacks and Common Mitigations. RFC 4987, IETF, Aug 2007. rfc-editor.org/rfc/rfc4987
- The Linux kernel documentation. IP sysctl (tcp_synack_retries, tcp_syncookies, tcp_max_syn_backlog). docs.kernel.org/networking/ip-sysctl.html
- Gont, F. and Bellovin, S. Defending against Sequence Number Attacks. RFC 6528, IETF, Feb 2012. rfc-editor.org/rfc/rfc6528
- Antonakakis, M. et al. Understanding the Mirai Botnet. 26th USENIX Security Symposium, 2017. usenix.org
- Liu, Y. Now Mirai Has DGA Feature Built in. 360 Netlab blog, 9 Dec 2016. blog.netlab.360.com
- US-CERT / CISA. Heightened DDoS Threat Posed by Mirai and Other Botnets. Alert TA16-288A, 14 Oct 2016. cisa.gov
- MITRE ATT&CK. Dynamic Resolution: Domain Generation Algorithms, T1568.002. attack.mitre.org
- Joncheray, L. A Simple Active Attack Against TCP. 5th USENIX UNIX Security Symposium, 1995. usenix.org
- Rescorla, E. The Transport Layer Security (TLS) Protocol Version 1.3. RFC 8446, IETF, Aug 2018. rfc-editor.org/rfc/rfc8446
- Kent, S. IP Encapsulating Security Payload (ESP). RFC 4303, IETF, Dec 2005. rfc-editor.org/rfc/rfc4303
- Arkko, J. et al. IPv4 Address Blocks Reserved for Documentation. RFC 5737, IETF, Jan 2010 (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, used for every address in the models). rfc-editor.org/rfc/rfc5737
- Eastlake, D. and Panitz, A. Reserved Top Level DNS Names. RFC 2606, IETF, Jun 1999 (.example, .test, .invalid, used for every domain in the models). rfc-editor.org/rfc/rfc2606
Lecture material: EHE Cyber Module 07, Part 2, Network Level Attacks (slides 44 to 46, 51 and 52, 58, 63 to 67, 76 and 80).