Denial of Service and Firewalls
CS 161 Summer 2022 - Lecture 22
Computer Science 161
Last Time: DNSSEC
2
Computer Science 161
Today: Denial of Service and Firewalls
3
Computer Science 161
Denial of Service (DoS)
4
Computer Science 161
Availability and Denial of Service (DoS)
5
Computer Science 161
DoS in the News
6
| |
Digital Hit Men for Hire | |
Brian Krebs | August 1, 2011 |
Cyber attacks designed to knock Web sites off line happen every day, yet shopping for a virtual hit man to launch one of these assaults has traditionally been a dicey affair. That’s starting to change: Hackers are openly competing to offer services that can take out a rival online business or to settle a score. There are dozens of underground forums where members advertise their ability to execute debilitating “distributed denial-of-service” or DDoS attacks for a price. DDoS attack services tend to charge the same prices, and the average rate for taking a Web site offline is surprisingly affordable: about $5 to $10 per hour; $40 to $50 per day; $350-$400 a week; and upwards of $1,200 per month. |
Computer Science 161
DoS in the News
7
| |
Extortion via DDoS on the rise | |
Denise Pappalardo and Ellen Messmer | May 16, 2005 |
Criminals are increasingly targeting corporations with distributed denial-of-service (DDoS) attacks designed not to disrupt business networks but to be used as tools to extort thousands of dollars from the companies. Those targeted are increasingly deciding to pay the extortionists rather than accept the consequences, experts say. While reports of this type of crime have circulated for several years, most victimized companies remain reluctant to acknowledge the attacks or enlist the help of law enforcement, resulting in limited awareness of the problem and few prosecutions. |
Computer Science 161
DoS in the News
8
| |
DDoS makes a phishing e-mail look real | |
Munir Kotadia | November 8, 2006 |
Just as Internet users learn that clicking on a link in an e-mail purporting to come from their bank is a bad idea, phishers seem to be developing a new tactic -- launch a DDoS attack on the Web site of the company whose customers they are targeting and then send e-mails "explaining" the outage and offering an "alternative" URL. |
Computer Science 161
DoS Attacks: Strategies
9
Computer Science 161
DoS Attacks: Strategies
10
Bottleneck
Computer Science 161
DoS Targets
11
Computer Science 161
Application-Level DoS
12
Computer Science 161
Application-Level DoS
13
Computer Science 161
Resource Consumption
14
int fd = open('/tmp/junk');
char buf[4096]
while (1) { write(fd, buf, 4096) };
while (1) { malloc(1000000000); }
while (1) { fork(); }
Exhausts filesystem space
Exhausts RAM
Exhausts processing threads
while (1) {
int fd = open(random_file());
write(fd, "abcde", 5);
close(fd);�}
Exhausts disk I/O operations
Computer Science 161
Algorithmic Complexity Attacks
15
| Expected runtime | Worst-case runtime |
Mergesort | O(n log n) | O(n log n) |
Quicksort | O(n log n) | O(n2) |
Computer Science 161
Application-Level DoS: Defenses
16
Computer Science 161
Application-Level DoS: Defenses
17
Computer Science 161
Network-Level DoS
18
Computer Science 161
Network-Level DoS
19
Computer Science 161
Distributed Denial-of-Service (DDoS)
20
Victim
Attacker
Attacker
Attacker
Attacker
Attacker
Attacker
Computer Science 161
Amplified Denial-of-Service
21
Attacker
DNS Name Server
Victim
From: Victim, To: Server
request
From: Server, To: Victim
RESPONSE
Computer Science 161
Amplified Denial-of-Service
22
Computer Science 161
Network-Level DoS: Defenses
23
Computer Science 161
Network-Level DoS: Defenses
24
Computer Science 161
SYN Flooding and SYN Cookies
25
Computer Science 161
SYN Flooding
26
Attacker
Server
SYN. Seq = x
SYN-ACK. Seq = y, Ack = x+1
ACK. Seq = x+1, Ack = y+1
Computer Science 161
SYN Flooding: Defenses
27
Computer Science 161
Idealized SYN Cookies
28
Client
Server
SYN. Seq = x
SYN-ACK. Seq = y. Ack = x+1. <State>
ACK. Seq = x+1, Ack = y+1. <State>. Data
The server generates state for the client but doesn’t save it, sending it to the client instead encoded with a secret
The client stores the state on behalf of the server and returns it in the ACK packet
Now that the handshake is complete, only now does the server allocate state for the connection, after checking the cookie against the secret
Issue: TCP doesn’t have a mechanism to store state! What field of the SYN-ACK packet could we store data in?
Computer Science 161
Practical SYN Cookies
29
Client
Server
SYN. Seq = x
SYN-ACK. Seq = <Encoded State>. Ack = x+1
ACK. Seq = x+1, Ack = <Encoded State>+1. Data
The server generates state for the client but doesn’t save it, encoding it in the sequence number with a secret
The client remembers the sequence number and returns it in the ACK number
Now that the handshake is complete, only now does the server allocate state for the connection, after checking the cookie against the secret
Computer Science 161
Practical SYN Cookies
30
Computer Science 161
Firewalls
31
Computer Science 161
Motivation: Scalable Defenses
32
Computer Science 161
Firewalls and Security Policies
33
Internet
Firewall
Computer Science 161
Firewalls and Security Policies
34
Internet
Firewall
Allow outbound traffic
Allow trusted inbound traffic
Deny other inbound traffic
Computer Science 161
Default Security Policies?
35
Computer Science 161
Stateless Packet Filters
36
Computer Science 161
Stateless Packet Filters
37
Computer Science 161
Stateful Packet Filters
38
Computer Science 161
Stateful Packet Filters
39
Computer Science 161
State in an FTP Rule
40
Computer Science 161
Subverting Packet Filters
41
From: A | To: B |
Seq = 4 | |
Hello world |
From: C | To: D |
Seq = 2 | |
Log in |
✓
From: C | To: D |
Seq = 8 | |
as root |
✗
✓
Computer Science 161
Subverting Packet Filters
42
o
r
o
t
Firewall
o
r
o
t
Seq = 6
Seq = 4
Seq = 5
Seq = 7
Computer Science 161
Subverting Packet Filters
43
n
r
o
i
o
c
e
t
Firewall
r
o
o
t
Seq = 4, TTL = 16
Seq = 4, TTL = 22
Seq = 5, TTL = 22
Seq = 5, TTL = 16
Seq = 6, TTL = 22
Seq = 6, TTL = 16
Seq = 7, TTL = 16
Seq = 7, TTL = 22
Computer Science 161
Subverting Packet Filters
44
n
r
o
i
o
c
e
t
Firewall
r
o
o
t
Seq = 4, TTL = 16
Seq = 4, TTL = 22
Seq = 5, TTL = 22
Seq = 5, TTL = 16
Seq = 6, TTL = 22
Seq = 6, TTL = 16
Seq = 7, TTL = 16
Seq = 7, TTL = 22
Computer Science 161
Other Types of Firewalls
45
Firewall
Client (outside)
Server (inside)
TCP
TCP
Computer Science 161
Alternatives to Allowing Firewall Traffic
46
Computer Science 161
Firewall Pros and Cons
47
Computer Science 161
Summary: Denial of Service
48
Computer Science 161
Summary: SYN Cookies
49
Computer Science 161
Summary: Firewalls
50
Computer Science 161