24
Communication Networks (0368-3030) / Fall 2013 The Blavatnik School of Computer Science, Tel-Aviv University Allon Wagner

Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Communication Networks (0368-3030) / Fall 2013

The Blavatnik School of Computer Science, Tel-Aviv University

Allon Wagner

Page 2: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Several slides adapted from a presentation made by Dan Touitou on behalf of Cisco.

Page 3: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

3 3 3 © 2004 Cisco Systems, Inc. All rights reserved. Infrastructure Security, 3/04

How do DDoS Attacks Start ?

DNS Email

‘Zombies’

‘Zombies’

Innocent PCs & Servers turn into ‘Zombies’

Page 4: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

4 4 4 © 2004 Cisco Systems, Inc. All rights reserved. Infrastructure Security, 3/04

The Effects of DDoS Attacks

Server-level DDoS attacks

Bandwidth-level DDoS attacks

DNS Email

Infrastructure-level DDoS attacks

Attack Zombies:

Massively distributed

Spoof Source IP

Use valid protocols

Page 5: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Motivation to attack

• Economically driven ▫ Extortion

▫ Zombie armies for hire

• Cyber-vandalism

• Cyber-terrorism / Cyber-war

• Backdrop for a more sophisticated attack ▫ For example, an attacker brings a target down, and can

then hijack its identity

Page 6: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

6 6 6 © 2004 Cisco Systems, Inc. All rights reserved. Infrastructure Security, 3/04

Blackholing

Server1 Victim Server2

. . . .

. . . .

R3

R1

R2

R5 R4

R R R

1000 1000

FE

peering

100

= Disconnecting the

customer

Page 7: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Three-way handshake & SYN-Flood attacks

Transport Layer

3-7

Host 1 Host 2 time

SYN =1 (SEQ = x)

SYN = 1 ACK = 1 (SEQ = y, ACK = x+1)

ACK = 1 (SEQ = x+1, ACK = y+1)

state saved!

Page 8: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SYN Cookies – the idea

Transport Layer

3-8

Host 1 Host 2 time

SYN =1 (SEQ = x)

SYN = 1 ACK = 1 (SEQ = 𝑓 𝑥 , ACK = x+1)

ACK = 1 (SEQ = x+1, ACK = 𝑓 𝑥 + 1)

stateless

Page 9: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SYN Cookies (somewhat simplified)

• A client sends a SYN packet. • The server does not choose a random SEQ for its reply.

Instead, it calculates a 𝐻 𝑥 - a cryptographic hash of: ▫ 𝑡 – a slowly increasing time function (e.g increases every 64

seconds) ▫ Server’s IP and port ▫ Client’s IP and port ▫ 𝑠 - a secret ▫ 𝑥 – client’s ISN

• The SEQ returned in the SYN+ACK packet is the concatenation 𝑡, 𝐻 𝑥 .

Page 10: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SYN Cookies (somewhat simplified)

• When a new client sends an ACK with ACK=y, the server decreases 1 and obtains: ▫ 𝑡 – allows it to ensure this is a recent request

▫ the supposed hash result 𝐻′ 𝑥

• It can recompute 𝐻 𝑥

• If 𝐻 𝑥 = 𝐻′ 𝑥 the client is legitimate and a TCP connection is opened

Page 11: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Exercise

• Why is 𝑡 included in the cryptographic hash? • To prevent replay attacks. • Assume that Eve (an Evil attacker) wants to mount a DDoS

attack against a server that does not include 𝑡 in its hashes. Eve (and Eve’s zombies) create millions of legitimate connections over a period of time, and collects 𝐻(𝑥) matching their data.

• When Eve wants to attack, she sends all these past requests simultaneously ▫ ACKs imitating the 3rd step of the threeway-handshake along

with their correct 𝐻(𝑥). ▫ Plaintext field 𝑡 simply says “now”.

• The server cannot tell these are old requests.

Page 12: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Exercise (cont.)

• Why is 𝑡 also given in plaintext?

• Because once a server gets the 3rd ack of the three-way handshake, it cannot know when the SYN-ACK reply was given to the client ▫ i.e., what 𝑡 was used to generate 𝐻 𝑥

• A malicious client still cannot forge 𝐻 𝑥 because it doesn’t know 𝑠.

Page 13: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Anti-spoofing

• Spoofing – masquerading as a different network user ▫ IP spoofing

▫ DNS spoofing

▫ ARP spoofing

▫ …

• Malicious clients spoof IP addresses in order to mount DoS attacks.

• An idea to prevent (or at least hinder) spoofing: respond to the client in a way that forces it to reply.

Page 14: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

14 14 14 © 2004 Cisco Systems, Inc. All rights reserved. Infrastructure Security, 3/04

Anti-Spoofing Defense - One example: HTTP

Source Guard Target

Antispoofing only when under attack • Authenticate source on initial query • Subsequent queries verified

1. SYN cookie alg.

2. Redirect rqst

3. Close connection

Client authenticated

Page 15: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

15 15 15 © 2004 Cisco Systems, Inc. All rights reserved. Infrastructure Security, 3/04

RST cookies – how it works

Source Guard Target

Client authenticated

Page 16: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

16 16 16 © 2004 Cisco Systems, Inc. All rights reserved. Infrastructure Security, 3/04

syn

Reply

Reply

Repeated IP - UDP

Authenticated IP

Client Guard Target

Antispoofing only when under attack • Authenticate source on initial query • Subsequent queries verified

Anti-Spoofing Defense - One example: DNS Client-Resolver (over UDP)

Ab.com rqst UDP/53

Page 17: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Extra slides SQL Injections - from an old talk I gave in the school

Page 18: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

Our Objective – Prevent SQL

Injection and XSS Attacks

Secure Network

HTTP access Web

server DB

Page 19: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SQL-Injection

• Benign:

– SELECT * FROM users WHERE name=‘alice’ AND password=‘1234’

• Malicious:

– SELECT * FROM users WHERE name=‘alice’

AND password=‘1234’ OR ‘a’=‘a’

• We got ourselves a list of usernames and their respective passwords, and can access the DB

Page 20: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SQL-Injection (cont.)

• Benign:

– SELECT phone FROM clients WHERE name=‘alice’

• Malicious:

– SELECT phone FROM clients WHERE name=‘alice’; UPDATE clients SET

debt=0 WHERE name=‘eve’;--’

• Information tampering. Can also be used for

DB mutilation and information disclosure

Page 21: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SQL-Injection - Audit Evasion

• Benign:

– SELECT phone FROM clients WHERE name=‘alice’

• Malicious:

– SELECT phone FROM clients WHERE name=‘alice’; UPDATE clients SET

debt=0 WHERE name=‘eve’;--’

• A skilled DBA will be able to track this!

Page 22: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

SQL-Injection – Audit Evasion

(cont.)

• Benign:

– SELECT phone FROM clients WHERE name=‘alice’

• Malicious:

– SELECT phone FROM clients WHERE name=‘alice’; UPDATE clients SET

debt=0 WHERE name=‘eve’;

--sp_password’

• MS SQL Server 2000 prior to SP3

Page 23: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

XSS – Cross Site Scripting

• Aim: Getting the victim’s web browser to

execute malicious code

• Many variants. An example:

– Alice’s server hosts an innocent web forum

Page 24: Communication Networks (0368-3030) / Fall 2013allonwag/comnet2014A/Recitations/Comnet_Recit… · Attack Zombies: Massively ... •The SEQ returned in the SYN+ACK packet is the concatenation

XSS – An Example

A post with

malicious code

Bob’s browser

Mallory

Bob browses the

forum’s pages

Alice’s trusted

web server