Top Banner
Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security Prof. Vern Paxson TAs: Jethro Beekman, Mobin Javed, Antonio Lupher, Paul Pearce & Matthias Vallentin http://inst.eecs.berkeley.edu/~cs161/ February 19, 2013
42

Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Sep 06, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Firewalls, con’t /Denial-of-Service (DoS)

CS 161: Computer Security

Prof. Vern Paxson

TAs: Jethro Beekman, Mobin Javed,Antonio Lupher, Paul Pearce

& Matthias Vallentin

http://inst.eecs.berkeley.edu/~cs161/

February 19, 2013

Page 2: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Goals For Today

• Finish discussion of network control:– Virtual private networks– Application-layer proxies– Pros & Cons of firewalls

• Discuss Denial-of-Service (DoS):attacks on availability

– Mostly network-based, but also OS

Page 3: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Network Control & Tunneling• Tunneling = embedding one protocol inside another

– Sender and receiver at each side of the tunnel bothcooperate (so it’s not useful for initial attacks)

• Traffic takes on properties of outer protocol– Including for firewall inspection, which generally can’t

analyze inner protocol (due to complexity)

• Tunneling has legitimate uses– E.g., Virtual Private Networks (VPNs)

o Tunnel server relays remote client’s packetso Makes remote machine look like it’s local to its home networko Tunnel encrypts traffic for privacy & to prevent meddling

Page 4: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Secure External Access to Inside Machines

• Often need to provide secure remote access to anetwork protected by a firewall– Remote access, telecommuting, branch offices, …

• Create secure channel (Virtual Private Network, or VPN)to tunnel traffic from outside host/network to insidenetwork– Provides Authentication, Confidentiality, Integrity– However, also raises perimeter issues (Try it yourself at http://www.net.berkeley.edu/vpn/)

InternetCompany

Yahoo

UserVPN server

Fileserver

Page 5: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Application Proxies• Can more directly control applications by requiring

them to go through a proxy for external access– Proxy doesn’t simply forward, but acts as an application-

level middleman

• Example: SSH gateway– Require all SSH in/out of site to go through gateway– Gateway logs authentication, inspects decrypted text– Site’s firewall configured to prohibit any other SSH

access

Page 6: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

SSH Gateway Example

host-to-gatewaySSH session

gateway-to-remote host SSH session

applicationgateway

Firewallallow <port=22, host=1.3.5.7>

drop <port=22>

1.3.5.7

Page 7: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Application Proxies• Can more directly control applications by requiring

them to go through a proxy for external access– Proxy doesn’t simply forward, but acts as an application-

level middleman

• Example: SSH gateway– Require all SSH in/out of site to go through gateway– Gateway logs authentication, inspects decrypted text– Site’s firewall configured to prohibit any other SSH

access

• Provides a powerful degree of monitoring/control• Costs?

– Need to run extra server(s) per app (possible bottleneck)– Each server requires careful hardening

Page 8: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Why Have Firewalls BeenSuccessful?

• Central control – easy administration and update– Single point of control: update one config to change

security policies

– Potentially allows rapid response

• Easy to deploy – transparent to end users– Easy incremental/total deployment to protect 1,000’s

• Addresses an important problem– Security vulnerabilities in network services are

rampant

– Easier to use firewall than to directly secure code …

Page 9: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Firewall Disadvantages?

• Functionality loss – less connectivity, less risk– May reduce network’s usefulness– Some applications don’t work with firewalls

• Two peer-to-peer users behind different firewalls

• The malicious insider problem– Deployment assumes insiders are trusted

• Malicious insider (or anyone gaining control of internal machine)can wreak havoc

• Firewalls establish a security perimeter– Like Eskimo Pies: “hard crunchy exterior, soft creamy

center”– Threat from travelers with laptops, cell phones, …

Page 10: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

5 Minute Break

Questions Before We Proceed?

Page 11: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Attacks on Availability

• Denial-of-Service (DoS, or “doss”): keepingsomeone from using a computing service

• How broad is this sort of threat?– Very: huge attack surface

• We do though need to consider our threat model …– What might motivate a DoS attack?

Page 12: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 13: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 14: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 15: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 16: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 17: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 18: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 19: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 20: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 21: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 22: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 23: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 24: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of
Page 25: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Motivations for DoS

• Showing off / entertainment / ego• Competitive advantage

– Maybe commercial, maybe just to win

• Vendetta / denial-of-money• Extortion• Political statements• Impair defenses• Espionage• Warfare

Page 26: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Attacks on Availability

• Denial-of-Service (DoS, or “doss”): keepingsomeone from using a computing service

• How broad is this sort of threat?– Very: huge attack surface

• We do though need to consider our threat model …– What might motivate a DoS attack?

• Two basic approaches available to an attacker:– Deny service via a program flaw (“*NULL”)

• E.g., supply an input that crashes a server• E.g., fool a system into shutting down

– Deny service via resource exhaustion (“while(1);”)• E.g., consume CPU, memory, disk, network

Page 27: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

DoS Defense in General Terms

• Defending against program flaws requires:– Careful authentication

• Don’t obey shut-down orders from imposters

– Careful coding/testing/review– Consideration of behavior of defense mechanisms

• E.g. buffer overflow detector that when triggered haltsexecution to prevent code injection ⇒ denial-of-service

• Defending resources from exhaustion can bereally hard. Requires:– Isolation mechanisms

• Keep adversary’s consumption from affecting others

– Reliable identification of different users• Know who the adversary is in the first place!

Page 28: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

DoS & Operating Systems

• How could you DoS a multi-user Unix system on whichyou have a login?– #rm‐rf/

• (if you have root - but then just “halt” works well!)– charbuf[1024];

intf=open("/tmp/junk");while(1)write(f,buf,sizeof(buf));

• Gobble up all the disk space!– while(1)fork();

• Create a zillion processes!

– Create zillions of files, keep opening, reading, writing, deleting• Thrash the disk

– … doubtless many more

• Defenses?– Isolate users / impose quotas

Page 29: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

DoS & Networks

• How could you DoS a target’s Internet access?– Send a zillion packets at them– Internet lacks isolation between traffic of different

users!

• What resources does attacker need to pull thisoff?– At least as much sending capacity (“bandwidth”) as

the bottleneck link of the target’s Internet connection• Attacker sends maximum-sized packets

– Or: overwhelm the rate at which the bottleneckrouter can process packets

• Attacker sends minimum-sized packets!– (in order to maximize the packet arrival rate)

Page 30: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Defending Against Network DoS

• Suppose an attacker has access to a beefy system withhigh-speed Internet access (a “big pipe”).

• They pump out packets towards the target at a veryhigh rate.

• What might the target do to defend against theonslaught?

– Install a network filter to discard any packets that arrive withattacker’s IP address as their source

• E.g., drop * 66.31.1.37:* -> *:*• Or it can leverage any other pattern in the flooding traffic that’s not

in benign traffic

– Filter = isolation mechanism

– Attacker’s IP address = means of identifying misbehaving user

Page 31: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Filtering Sounds Pretty Easy …

• … but it’s not. What steps can the attacker taketo defeat the filtering?– Make traffic appear as though it’s from many hosts

• Spoof the source address so it can’t be used to filter– Just pick a random 32-bit number of each packet sent

• How does a defender filter this?– They don’t!– Best they can hope for is that operators around the world

implement anti-spoofing mechanisms (today about 75% do)

– Use many hosts to send traffic rather than just one• Distributed Denial-of-Service = DDoS (“dee-doss”)• Requires defender to install complex filters• How many hosts is “enough” for the attacker?

– Today they are very cheap to acquire … :-(

Page 32: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

It’s Not A “Level Playing Field”

• When defending resources from exhaustion,need to beware of asymmetries, whereattackers can consume victim resources withlittle comparable effort– Makes DoS easier to launch– Defense costs much more than attack

• Particularly dangerous form of asymmetry:amplification– Attacker leverages system’s own structure to pump

up the load they induce on a resource

Page 33: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Amplification: Network DoS

• One technique for magnifying flood traffic:leverage Internet’s broadcast functionality

Page 34: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Amplification: Network DoS

• One technique for magnifying flood traffic:leverage Internet’s broadcast functionality

• How does an attacker exploit this?– Send traffic to the broadcast address and spoof it

as though the DoS victim sent it– All of the replies then go to the victim rather than the

attacker’s machine– Each attacker pkt yields dozens of flooding pkts

• Another example: DNS lookups– Reply is often much bigger than request– So attacker spoofs request seemingly from the target

• Small attacker packet yields large flooding packet

smurfattack

Page 35: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Transport-Level Denial-of-Service• Recall TCP’s 3-way connection establishment

handshake– Goal: agree on initial sequence numbers

• So a single SYN from an attacker suffices to forcethe server to spend some memory

Client (initiator)

SYN, SeqNum = x

SYN + ACK, SeqNum = y, Ack = x + 1

ACK, Ack = y + 1

Server

Server creates stateassociated withconnection here

Attacker doesn’teven need tosend this ack

Page 36: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

TCP SYN Flooding

• Attacker targets memory rather thannetwork capacity

• Every (unique) SYN that the attacker sendsburdens the target

• What should target do when it has no morememory for a new connection?

• No good answer!– Refuse new connection?

• Legit new users can’t access service

– Evict old connections to make room?• Legit old users get kicked off

Page 37: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

TCP SYN Flooding, con’t

• How can the target defend itself?

• Approach #1: make sure they havetons of memory!

– How much is enough? Depends onresources attacker can bring to bear

Page 38: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

TCP SYN Flooding, con’t

• Approach #2: identify bad actors & refuse theirconnections– Hard because only way to identify them is based on IP

address• We can’t for example require them to send a password because

doing so requires we have an established connection!

– For a public Internet service, who knows whichaddresses customers might come from?

– Plus: attacker can spoof addresses since they don’tneed to complete TCP 3-way handshake

• Approach #3: don’t keep state! (“SYN cookies”;only works for spoofed SYN flooding)

Page 39: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

SYN Flooding Defense: Idealized

Client (initiator)

SYN, SeqNum = x

S+A, SeqNum = y, Ack = x + 1, <State>

ACK, Ack = y + 1, <State>

Server

• Server: when SYN arrives, rather than keepingstate locally, send it to the client …

• Client needs to return the state in order toestablished connection

Server only savesstate here

Do not save statehere; give to client

Page 40: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

SYN Flooding Defense: Idealized

Client (initiator)

SYN, SeqNum = x

S+A, SeqNum = y, Ack = x + 1, <State>

ACK, Ack = y + 1, <State>

Server

• Server: when SYN arrives, rather than keepingstate locally, send it to the client …

• Client needs to return the state in order toestablished connection

Server only savesstate here

Do not save statehere; give to client

Problem: the world isn’t so ideal!

TCP doesn’t include an easy way toadd a new <State> field like this.

Is there any way to get the samefunctionality without having tochange TCP clients?

Page 41: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

Practical Defense: SYN Cookies

Client (initiator)

SYN, SeqNum = x

SYN and ACK, SeqNum = y, Ack = x + 1

ACK, Ack = y + 1

Server

• Server: when SYN arrives, encode connectionstate entirely within SYN-ACK’s sequence # y– y = encoding of necessary state, using server secret

• When ACK of SYN-ACK arrives, server onlycreates state if value of y from it agrees w/ secret

Server only createsstate here

Do not createstate here

Instead, encode it here

Page 42: Firewalls, con’t / Denial-of-Service (DoS) · 2013. 2. 19. · Firewalls, con’t / Denial-of-Service (DoS) CS 161: Computer Security ... Goals For Today •Finish discussion of

SYN Cookies: Discussion

• Illustrates general strategy: rather than holdingstate, encode it so that it is returned whenneeded

• For SYN cookies, attacker must complete3-way handshake in order to burden server– Can’t use spoofed source addresses

• Note #1: strategy requires that you haveenough bits to encode all the state– (This is just barely the case for SYN cookies)

• Note #2: if it’s expensive to generate or checkthe cookie, then it’s not a win