Tweaking to get away from Application Layer DoS attacks

72
BSidesDetroit2012 Tweaking to get away from SlowDOS Sergey Shekyan, Senior Software Engineer June 2nd, 2012 Thursday, December 13, 12

description

Slides I presented at BSides Detroit 2012

Transcript of Tweaking to get away from Application Layer DoS attacks

Page 1: Tweaking to get away from Application Layer DoS attacks

BSidesDetroit2012Tweaking to get away from SlowDOS

Sergey Shekyan, Senior Software Engineer June 2nd, 2012

Thursday, December 13, 12

Page 2: Tweaking to get away from Application Layer DoS attacks

2BSIDES DETROIT 2012

2

Thursday, December 13, 12

Page 3: Tweaking to get away from Application Layer DoS attacks

2BSIDES DETROIT 2012

Denial of Service Attacks

2

Thursday, December 13, 12

Page 4: Tweaking to get away from Application Layer DoS attacks

2BSIDES DETROIT 2012

Denial of Service Attacks

2

Thursday, December 13, 12

Page 5: Tweaking to get away from Application Layer DoS attacks

3BSIDES DETROIT 2012

Types of attack

There is a variety of forms aiming at a variety of services:

−Traffic consuming attacks (DNS, firewall, router, load balancer, OS, etc.)−Application Layer attacks (web server, media server, mail server)

3

Thursday, December 13, 12

Page 6: Tweaking to get away from Application Layer DoS attacks

4BSIDES DETROIT 2012

Network Layer attacks

4

Thursday, December 13, 12

Page 7: Tweaking to get away from Application Layer DoS attacks

4BSIDES DETROIT 2012

Network Layer attacks

4

Thursday, December 13, 12

Page 8: Tweaking to get away from Application Layer DoS attacks

5BSIDES DETROIT 2012

Application Layer attacks

5

Thursday, December 13, 12

Page 9: Tweaking to get away from Application Layer DoS attacks

5BSIDES DETROIT 2012

Application Layer attacks

5

Thursday, December 13, 12

Page 10: Tweaking to get away from Application Layer DoS attacks

6BSIDES DETROIT 2012

What is low-bandwidth attack?

6

0

100

200

300

400

0 10 20 30 40

Slowloris GET Flood

Mbp

s/sec

Seconds

Thursday, December 13, 12

Page 11: Tweaking to get away from Application Layer DoS attacks

7BSIDES DETROIT 2012

§ DDoS attacks are affordable (from $5/hour)§ DDoS attack is a great way to promote your start-up (attacks on Russian travel

agencies are 5 times as frequent in high season)§ Longest attack detected by Kaspersky DDos Prevention System in the second

half of 2011 targeted a travel agency website and lasted 80 days 19 hours 13 minutes 05 seconds

§ Akamai reports DDoS attack incidents soar 2,000 percent in the past three years

DDoS economics

7

Thursday, December 13, 12

Page 12: Tweaking to get away from Application Layer DoS attacks

8BSIDES DETROIT 2012

Actual page from a forum offering DDoS services

§ We take projects with anti-DDoS§ Wholesale discounts§ We are clear against the law§ Best quality-to-dollar ratio§ $5/hour, $40/day, $260/week, $900/month

8

Thursday, December 13, 12

Page 13: Tweaking to get away from Application Layer DoS attacks

9BSIDES DETROIT 2012

Same botnet operator offering menu:

§ HTTP GET flood§ HTTP POST flood§ Download flood§ UDP flood§ SYN flood

9

Thursday, December 13, 12

Page 14: Tweaking to get away from Application Layer DoS attacks

10BSIDES DETROIT 2012

Application Layer DoS attacks

§ Slow HTTP headers attack (a.k.a. Slowloris)§ Slow HTTP message body attack (a.k.a Slow Post)§ Slow read HTTP attack (a.k.a. TCP Persist Timer exploit)

10

Thursday, December 13, 12

Page 15: Tweaking to get away from Application Layer DoS attacks

11BSIDES DETROIT 2012

Demo time

11

Thursday, December 13, 12

Page 16: Tweaking to get away from Application Layer DoS attacks

12BSIDES DETROIT 2012

What is common?

§ All mentioned attacks aim at draining the pool of concurrent connections (usually relatively small)

12

Thursday, December 13, 12

Page 17: Tweaking to get away from Application Layer DoS attacks

13BSIDES DETROIT 2012

HyperText Transfer Protocol (HTTP) Message syntax

Per RFC 2616

generic-message = start-line *(message-header CRLF) CRLF [ message-body ] start-line = Request-Line | Status-Line

13

Thursday, December 13, 12

Page 18: Tweaking to get away from Application Layer DoS attacks

14BSIDES DETROIT 2012

HyperText Transfer Protocol (HTTP) Message example

GET /page.htm HTTP/1.1CRLFHost: www.example.com:8080CRLFContent-Length: 25CRLFCRLFOptional Message Body

14

Thursday, December 13, 12

Page 19: Tweaking to get away from Application Layer DoS attacks

15BSIDES DETROIT 2012

Slowloris

§Low bandwidth attack that sends HTTP requests with incomplete headers. Continues to send headers at regular intervals to keep the sockets active§First mentioned by Adrian Ilarion Ciobanu in 2007 and implemeted by Robert Hansen in 2009

15

Thursday, December 13, 12

Page 20: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

Client Server

Thursday, December 13, 12

Page 21: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

Client Server

Thursday, December 13, 12

Page 22: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

59  seconds  later

Client Server

Thursday, December 13, 12

Page 23: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

X-­‐4rete:  fdsgvry\r\n

59  seconds  later

Client Server

Thursday, December 13, 12

Page 24: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

X-­‐4rete:  fdsgvry\r\n

59  seconds  later

59  seconds  later

Client Server

Thursday, December 13, 12

Page 25: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

X-­‐4rete:  fdsgvry\r\n

X-­‐4rete:  fdsgvry\r\n

59  seconds  later

59  seconds  later

Client Server

Thursday, December 13, 12

Page 26: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

X-­‐4rete:  fdsgvry\r\n

X-­‐4rete:  fdsgvry\r\n

59  seconds  later

59  seconds  later

59  seconds  later

Client Server

Thursday, December 13, 12

Page 27: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

X-­‐4rete:  fdsgvry\r\n

X-­‐4rete:  fdsgvry\r\n

X-­‐egyr7j:  8ih\r\n

59  seconds  later

59  seconds  later

59  seconds  later

Client Server

Thursday, December 13, 12

Page 28: Tweaking to get away from Application Layer DoS attacks

16BSIDES DETROIT 2012

How slowloris works

16

GET  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nX-­‐sadwqeq:  dfg4t3\r\n

X-­‐4rete:  fdsgvry\r\n

X-­‐4rete:  fdsgvry\r\n

X-­‐egyr7j:  8ih\r\n

59  seconds  later

59  seconds  later

59  seconds  later

...

Client Server

Thursday, December 13, 12

Page 29: Tweaking to get away from Application Layer DoS attacks

17BSIDES DETROIT 2012

Slow POST

§ Attack that sends HTTP requests with complete headers but incomplete message body. Continues to send data at regular intervals to keep the sockets active

§ Discovered by Wong Onn Chee and popularized by Tom Brennan in 2009

17

Thursday, December 13, 12

Page 30: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

Client Server

Thursday, December 13, 12

Page 31: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

Client Server

Thursday, December 13, 12

Page 32: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

\r\n

Client Server

Thursday, December 13, 12

Page 33: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

59  seconds  later

\r\n

Client Server

Thursday, December 13, 12

Page 34: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

foo=bar\r\n

59  seconds  later

\r\n

Client Server

Thursday, December 13, 12

Page 35: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

foo=bar\r\n

59  seconds  later

59  seconds  later

\r\n

Client Server

Thursday, December 13, 12

Page 36: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

foo=bar\r\n

&Owkuvj5=POaLLI\r\n

59  seconds  later

59  seconds  later

\r\n

Client Server

Thursday, December 13, 12

Page 37: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

foo=bar\r\n

&Owkuvj5=POaLLI\r\n

59  seconds  later

59  seconds  later

59  seconds  later

\r\n

Client Server

Thursday, December 13, 12

Page 38: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

foo=bar\r\n

&Owkuvj5=POaLLI\r\n

&uWat9wGqrP4SxV=SN3q\r\n

59  seconds  later

59  seconds  later

59  seconds  later

\r\n

Client Server

Thursday, December 13, 12

Page 39: Tweaking to get away from Application Layer DoS attacks

18BSIDES DETROIT 2012

How Slow POST works

18

POST  /  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\nContent-­‐Length:  4096\r\nContent-­‐Type:  applicaRon/x-­‐www-­‐form-­‐urlencoded\r\n

foo=bar\r\n

&Owkuvj5=POaLLI\r\n

&uWat9wGqrP4SxV=SN3q\r\n

59  seconds  later

59  seconds  later

59  seconds  later

...

\r\n

Client Server

Thursday, December 13, 12

Page 40: Tweaking to get away from Application Layer DoS attacks

19BSIDES DETROIT 2012

Slow Read

§ Attack that keeps server sockets busy by maliciously throttling down the receipt of large HTTP responses

§ Uses known Network Layer flaws to aim Application Layer§ First mentioned by Outpost24 in sockstress. Implemented as part of nkiller2 by Fotis

Hantzis, a.k.a. ithilgore in 2009

19

Thursday, December 13, 12

Page 41: Tweaking to get away from Application Layer DoS attacks

20BSIDES DETROIT 2012

Related TCP details

 

§“Window size (16 bits) – the size of the receive window, which specifies the number of bytes (beyond the sequence number in the acknowledgment field) that the sender of this segment is currently willing to receive” – Wikipedia

20

Thursday, December 13, 12

Page 42: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

Client Server

Thursday, December 13, 12

Page 43: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

Thursday, December 13, 12

Page 44: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

Thursday, December 13, 12

Page 45: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

Thursday, December 13, 12

Page 46: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  message

Thursday, December 13, 12

Page 47: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  messageKernel  to  app:  I  can  send  only  32  bytes  now

Thursday, December 13, 12

Page 48: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  messageKernel  to  app:  I  can  send  only  32  bytes  now

bi g p a g e. h t m l

Thursday, December 13, 12

Page 49: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  messageKernel  to  app:  I  can  send  only  32  bytes  now

Got  it,  wait  for  now  (ACK  window  0)

bi g p a g e. h t m l

Thursday, December 13, 12

Page 50: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  messageKernel  to  app:  I  can  send  only  32  bytes  now

Got  it,  wait  for  now  (ACK  window  0)

90

Are  you  ready  to  receive  more  bytes?

bi g p a g e. h t m l

Thursday, December 13, 12

Page 51: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  messageKernel  to  app:  I  can  send  only  32  bytes  now

Got  it,  wait  for  now  (ACK  window  0)

90

Are  you  ready  to  receive  more  bytes?

OK,  give  me  another  32  bytes

bi g p a g e. h t m l

Thursday, December 13, 12

Page 52: Tweaking to get away from Application Layer DoS attacks

21BSIDES DETROIT 2012

How Slow Read works

21

Recv  buff

er

Send

 buff

er

bigpage.html

Client Server

GET  bigpage.html  HTTP/1.1\r\nHost:  vulnerable-­‐server.com:80\r\n\r\n

BTW,  my  recv  window  is  only  32  bytes

HTTP/1.1  200  OK\r\nContent-­‐Length:  131072\r\nContent-­‐type:  text/html\r\n\r\n  messageKernel  to  app:  I  can  send  only  32  bytes  now

Got  it,  wait  for  now  (ACK  window  0)

90

Are  you  ready  to  receive  more  bytes?

OK,  give  me  another  32  bytes

...

bi g p a g e. h t m l

Thursday, December 13, 12

Page 53: Tweaking to get away from Application Layer DoS attacks

22BSIDES DETROIT 2012

Prerequisites for successful Slow Read attack

The larger server response is - increasing the chances of prolonging the connection§make server generate a data stream that doesn't fully fit into socket's send buffer (65536 bytes is default on most Linux systems /proc/sys/net/ipv4/tcp_wmem, if server doesn't set its own value)§Request large resource by naturally finding it and/or amplifying the response size by using HTTP pipelining. Dynamic resources are welcome.

22

Thursday, December 13, 12

Page 54: Tweaking to get away from Application Layer DoS attacks

22BSIDES DETROIT 2012

Prerequisites for successful Slow Read attack

The larger server response is - increasing the chances of prolonging the connection§make server generate a data stream that doesn't fully fit into socket's send buffer (65536 bytes is default on most Linux systems /proc/sys/net/ipv4/tcp_wmem, if server doesn't set its own value)§Request large resource by naturally finding it and/or amplifying the response size by using HTTP pipelining. Dynamic resources are welcome.

22

Rme

Thursday, December 13, 12

Page 55: Tweaking to get away from Application Layer DoS attacks

23BSIDES DETROIT 2012

Why is Slow Read is different?Traditional (slowloris/slowpost) DoS

§Customer stuck deciding what he wants §Makes an order§Pays §Takes the order §Next!

23

Thursday, December 13, 12

Page 56: Tweaking to get away from Application Layer DoS attacks

23BSIDES DETROIT 2012

Why is Slow Read is different?Traditional (slowloris/slowpost) DoS

§Customer stuck deciding what he wants §Makes an order§Pays §Takes the order §Next!

23

It  is  possible  to  idenRfy  and  isolate  slow  client  in  his  request  state

Thursday, December 13, 12

Page 57: Tweaking to get away from Application Layer DoS attacks

24BSIDES DETROIT 2012

Why Slow Read is different?Slow Read DoS

§Makes an order for party of 50§Pays §Cannot take the entire order with him, makes several trips to the car. §Next!

24

Thursday, December 13, 12

Page 58: Tweaking to get away from Application Layer DoS attacks

24BSIDES DETROIT 2012

Why Slow Read is different?Slow Read DoS

§Makes an order for party of 50§Pays §Cannot take the entire order with him, makes several trips to the car. §Next!

24

it  is  quite  late  to  do  anything,  as  the  request  was  already  accepted  and  processed

Thursday, December 13, 12

Page 59: Tweaking to get away from Application Layer DoS attacks

25BSIDES DETROIT 2012

Why is Slow Read is different?

§Makes an order for party of 50

§Pays §Cannot take the entire order with him, makes several trips to the car

§Next!

25

§Customer stuck deciding what he wants Makes an orderPays Takes the order Next!

Thursday, December 13, 12

Page 60: Tweaking to get away from Application Layer DoS attacks

26BSIDES DETROIT 2012

Why is Slow Read is different? (continued)

§ Defense mechanisms expect the crushing fist of malice to appear in the request

§ Instead, the entire transaction should be monitored

26

Thursday, December 13, 12

Page 61: Tweaking to get away from Application Layer DoS attacks

27BSIDES DETROIT 2012

§ There is a good chance that you are. Default configurations of nginx, lighttpd, IIS, Apache, Varnish cache proxy, Shoutcast streaming server - are vulnerable to at least one of the mentioned attacks

Am I vulnerable?

27

Thursday, December 13, 12

Page 62: Tweaking to get away from Application Layer DoS attacks

28BSIDES DETROIT 2012

§ Use available tools to simulate attacks. SlowHTTPTest covers all mentioned attacks and some more at http://slowhttptest.googlecode.com

§ Check out http://slowhammer.me soon to get access to your own whitehat botnet in the cloud

§ Use Qualys WAF or other firewalls that are supposed to protect, but test before you pay!

What should I do?

28

Thursday, December 13, 12

Page 63: Tweaking to get away from Application Layer DoS attacks

29BSIDES DETROIT 2012

Detection and Mitigation

§ Drop connections with abnormally small TCP advertised window(s)§ Set an absolute connection timeout, if possible§ Limit length, number of headers to accept§ Limit max size of message body to accept§ Drop connections with HTTP methods (verbs) not supported by the URL§ Limit accepted header and message body to a minimal reasonable length§ Define the minimum data rate, and drop connections that are slower than that rate

29

Thursday, December 13, 12

Page 64: Tweaking to get away from Application Layer DoS attacks

30BSIDES DETROIT 2012

Detection and Mitigation continued

§ Qualys Web Application Scanner passively detects the slow attack vulnerabilities§ ModSecurity v2.6 introduced a directive called SecWriteStateLimit that places a time limit

on the concurrent number of threads (per IP address)§ Snort is working on detecting connections with small TCP advertised window(s)§ Christian Folini introduced Flying Frog script at https://www.netnea.com

30

Thursday, December 13, 12

Page 65: Tweaking to get away from Application Layer DoS attacks

31BSIDES DETROIT 2012

Example of misconfiguration

§ Even if the server is configured to handle tens of thousands of concurrent connections, the OS might still create a bottleneck by limiting the server by the number of open file descriptors

31

Thursday, December 13, 12

Page 66: Tweaking to get away from Application Layer DoS attacks

32BSIDES DETROIT 2012

Are anti-DoS solutions going to help?

§Have no idea, test yourself!

32

Thursday, December 13, 12

Page 67: Tweaking to get away from Application Layer DoS attacks

33BSIDES DETROIT 2012

Who reacted first?

33

Thursday, December 13, 12

Page 68: Tweaking to get away from Application Layer DoS attacks

33BSIDES DETROIT 2012

Who reacted first?

33

Thursday, December 13, 12

Page 69: Tweaking to get away from Application Layer DoS attacks

33BSIDES DETROIT 2012

Who reacted first?

Those who really care - gamers!Open Transport Tycoon Deluxe found that by using a slow read type attack, it is possible to prevent anyone from joining a game server with virtually no resources.Patches for all affected version where released within a week!

33

Thursday, December 13, 12

Page 70: Tweaking to get away from Application Layer DoS attacks

34BSIDES DETROIT 2012

Summary

§ Even though the simpliest distributed DoS attacks are enough to knock down most web sites today, the nature of the attack will be sure to improve, and it’s better to be ready or, at least be aware of upcoming problems.

34

Thursday, December 13, 12

Page 71: Tweaking to get away from Application Layer DoS attacks

35BSIDES DETROIT 2012

References

ModSecurity Advanced Topic of the Week: Mitigation of 'Slow Read" Denial of Service Attackhttp://blog.spiderlabs.com/2012/01/modsecurity-advanced-topic-of-the-week-mitigation-of-slow-read-denial-of-service-attack.htmlDDoS attacks in H2 2011http://www.securelist.com/en/analysis/204792221/DDoS_attacks_in_H2_2011The State of the Internethttp://www.akamai.com/stateoftheinternet/Evaluation of slowhttptest against servers protected by CloudFlarehttp://samsclass.info/123/proj10/slow-read.htmlBlog posts on hardening web servershttps://community.qualys.com/blogs/securitylabs/

35

Thursday, December 13, 12

Page 72: Tweaking to get away from Application Layer DoS attacks

Thank [email protected]

@sshekyan

Thursday, December 13, 12