The Yo-Yo Attack: Bankrupting Cloud Infrastructure
A comprehensive guide to the Yo-Yo attack, an Economic Denial of Sustainability (EDoS) technique that targets auto-scaling mechanisms in cloud environments.
Feb 28, 2026Cybersecurity
RFC-793, published in September 1981 by Jon Postel, defines the Transmission Control Protocol (TCP)—the reliable, connection-oriented transport layer protocol that underpins much of the internet's communication. As the de facto standard for data transfer over IP networks, TCP ensures ordered, error-checked delivery of streams of octets. This article dives into its key concepts, then shifts to a cybersecurity lens: how red teams exploit TCP's design flaws and pro tips for blue teams to fortify defenses. We'll include code samples in Python to illustrate practical implementations.
RFC-793 outlines TCP as a byte-stream protocol operating over IP, emphasizing reliability through acknowledgments, sequencing, and retransmissions. It doesn't delve deeply into modern extensions like congestion control (later refined in RFCs like 5681), but its foundations remain unchanged.
TCP connections begin with a three-way handshake to synchronize sequence numbers and confirm bidirectional reachability:
This process transitions states from LISTEN/SYN-SENT to ESTABLISHED, preventing old or duplicate packets from hijacking connections via resets (RST segments).
Security note: ISNs must be unpredictable to thwart sequence prediction attacks, though RFC-793 assumes a "quiet time" after crashes to avoid overlaps.
Here's a simple Python example using the socket library to establish a TCP connection:
import socket
# Client side: Perform a three-way handshake
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('example.com', 80)) # SYN sent implicitly
# Send a basic HTTP request (data transfer post-handshake)
client.send(b'GET / HTTP/1.1\r\nHost: example.com\r\n\r\n')
response = client.recv(4096)
print(response.decode('utf-8'))
client.close() # Initiates FIN for graceful closeOnce established, TCP treats data as a stream of bytes, assigning sequence numbers to each octet for ordering and duplicate detection. Segments carry up to the Maximum Segment Size (MSS), with flags like PSH (push data immediately) and URG (urgent data).
RFC-793 implies vulnerability in window management: zero windows require periodic probes, but misconfigurations can lead to deadlocks.
Connections close via a four-way handshake (two FINs and ACKs per direction), entering states like FIN-WAIT and TIME-WAIT (lasting 2x Maximum Segment Lifetime to drain duplicates). Abrupt aborts use RST.
Example Python snippet for server-side listening and closing:
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('0.0.0.0', 8080))
server.listen(1)
conn, addr = server.accept() # Accepts SYN, completes handshake
data = conn.recv(1024)
conn.send(b'HTTP/1.1 200 OK\r\n\r\nHello, TCP!')
conn.close() # Sends FIN
server.close()Red teams love TCP's statefulness—it's a goldmine for denial-of-service (DoS), hijacking, and reconnaissance. While RFC-793 aimed for robustness, its assumptions (e.g., trusted networks) leave gaps exploitable today.
The handshake creates server-side state for uncompleted SYNs, vulnerable to floods of spoofed SYNs. Attackers send SYNs with fake IPs, forcing servers to allocate resources (e.g., ~1KB per connection) until timeouts or RSTs clear them. RFC-793's LISTEN state queues these, but unbounded backlogs crash systems.
Pro exploit: Use tools like hping3 for low-rate floods evading detection.
Python POC for a basic SYN flood (use ethically, e.g., on your own lab):
import socket
import random
target_ip = '192.168.1.1' # Lab target only!
target_port = 80
syn_flood_count = 1000
for _ in range(syn_flood_count):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1) # Raw socket for spoofing (requires root)
src_ip = f'{random.randint(1,254)}.{random.randint(1,254)}.{random.randint(1,254)}.{random.randint(1,254)}'
# Craft raw SYN packet (simplified; use Scapy for real)
try:
sock.connect((target_ip, target_port)) # Triggers SYN
sock.close()
except:
pass # Ignore failuresAttackers on-path can inject RSTs to tear down connections (RFC-793 mandates RST on invalid segments). Off-path, predict ISNs (pre-RFC-1948 randomness) to hijack sessions via blind spoofing.
These leverage TCP's verbose error responses for reconnaissance.
Blue teams counter by layering mitigations, tuning kernels, and monitoring anomalies. Focus on RFC-793's weak spots without overhauling the stack.
sysctl net.ipv4.tcp_syncookies=1): Servers compute a cryptographic cookie in the SYN-ACK's ISN, avoiding state until the final ACK. No backlog exhaustion.-m connlimit --connlimit-above 10 -j DROP) to cap connections per IP.Pro Tip: Monitor netstat -an | grep SYN_RECV for backlog spikes; integrate with tools like Fail2Ban for auto-bans.
net.ipv4.tcp_timestamps=1 for better entropy).Pro Tip: Deploy Intrusion Prevention Systems (IPS) like Snort with rules for anomalous RST volumes: alert tcp any any -> any any (flags:R; msg:"Excessive RSTs"; threshold:type limit, track by_dst, count 100, seconds 60;).
net.core.rmem_max) to handle window shrinks gracefully.Pro Tip: Use ss -t -a for connection state visibility; script alerts on excessive TIME-WAITs indicating scans.
| Threat | RFC-793 Weakness | Blue Team Counter | Tool/Example |
|---|---|---|---|
| SYN Flood | Unbounded LISTEN queue | SYN Cookies | sysctl net.ipv4.tcp_syncookies=1 |
| RST Injection | Mandatory RST on errors | Stateful Filtering | iptables -m state --state INVALID -j DROP |
| Sequence Prediction | Predictable ISNs | Timestamp Options | sysctl net.ipv4.tcp_timestamps=1 |
| Port Scanning | Verbose Responses | Rate Limiting | iptables -A INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT |
RFC-793's elegance endures, but its security oversights—born in an era of trusted ARPANET—fuel modern attacks. Red teams thrive on these for disruption; blue teams turn them into resilience through configuration and vigilance. Experiment in labs (e.g., with Mininet for TCP sims), and always reference the full RFC for nuances. For deeper dives, explore RFC-9293 (2020 TCP update).
Stay connected—securely.
Love it? Share this article: