SlideShare a Scribd company logo
DDoS: practical survival
        guide
     Alexander Lyamin
  <la@highloadlab.com>
Q1 2012
•   Incidents:          365
•   Daily max:          12
•   Avg. botnet size:   2637
•   Max botnet size:    37834
2012: 1 Jan – 30 May
•   Incidents:          728
•   Daily max:          51
•   Avg. botnet size:   3288
•   Max botnet size:    116265
Daily
55
     Jan
50
     Feb
45
     Mar
40
     Apr
35
     May
30
25
20
15
10
5
0
Weekday distribution
20%            18.82%
18%
      15.93%                                                        15.52%
16%
                                                13.60%
14%                       12.77%     12.50%
12%                                                      10.85%
10%

8%

6%

4%

2%

0%
      Monday   Tuesday   Wednesday   Thursday   Friday   Saturday   Sunday
High speed attacks


            3.16%   >=1Gbps
   96.84%           <1Gbps
Spoofed source attacks
              29.67%



                       Spoofed
                       Full connect


     70.33%
Scary stuff

•   DNS: NIC, Masterhost, FastVPS.
•   DataCenters: CROC, WAhome.
•   “Invisible” russian elections botnets.
•   Minerbot.
New reality
• 1k botnet - 100-160 USD.
• Readily available botnet toolkits.
• Fall of prices - 20 USD/day.
New competition
Apache mod_evasive
Apache mod_evasive
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 8
DOSSiteCount 100
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 600
DOSEmailNotify secure@adminmail.com
</IfModule>
Apache mod_evasive
Positive             Negative
It works!            Apache
Iptables --string
Iptables --string
iptables -A INPUT -p tcp -m tcp --dport 80 -m string --string "GET / HTTP" --algo kmp --to
1024 -m recent --set --name httpddos --rsource

iptables -A INPUT -p tcp -m tcp --dport 80 -m string --string "GET / HTTP" --algo kmp --to
1024 -m recent --update --seconds 10 --hitcount 2 --name httpddos --rsource -j DROP
Iptables --string
Positive            Negative

It works.           Not always works. (fragmentet packets)

Its fast.           Not always fast. (kmp matched packets)

                    Orphaned sockets + retransmit.

                    Requires conntrack(statefull is bad).
NGINX testcookie_module
JS
Cookie/Redirect
NGINX testcookie_module
   testcookie_name BPC;
   testcookie_secret keepmescret;
   testcookie_session $remote_addr;
   testcookie_arg attempt;
   testcookie_max_attempts 3;
   testcookie_fallback /cookies.html?backurl=http://$host$request_uri;
   testcookie_get_only on;
location / {
    testcookie on;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://127.0.0.1:8080;
 }
Further reading: http://habrahabr.ru/post/139931/
NGINX testcookie_module
Positive                         Negative
It works.                        Doesn’t block traffic.*
NGINX.                           Alternates UX.
Its fast.                        Is not effective on FBS.
Predictable.
Expandable (Flash, QT checks).
                                 * That’s what ipset is for.
Neuron network PyBrain
Neuron network PyBrain
Request:
0.0.0.0 - - [20/Dec/2011:15:00:03 +0400] "GET /forum/rss.php?topic=347425 HTTP/1.0" 200 1685 "-" "Mozilla/5.0
(Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0»


Dictionary:
['__UA___OS_U', '__UA_EMPTY', '__REQ___METHOD_POST', '__REQ___HTTP_VER_HTTP/1.0', '__REQ___URL_
__NETLOC_', '__REQ___URL___PATH_/forum/rss.php', '__REQ___URL___PATH_/forum/index.php', '__REQ___URL
___SCHEME_', '__REQ___HTTP_VER_HTTP/1.1', '__UA___VER_Firefox/3.0', '__REFER___NETLOC_www.mozilla-
europe.org', '__UA___OS_Windows', '__UA___BASE_Mozilla/5.0', '__CODE_503', '__UA___OS_pl', '__REFER___PA
TH_/', '__REFER___SCHEME_http', '__NO_REFER__', '__REQ___METHOD_GET', '__UA___OS_Windows NT
5.1', '__UA___OS_rv:1.9', '__REQ___URL___QS_topic', '__UA___VER_Gecko/2008052906’

Further reading: http://habrahabr.ru/post/136237/
Neuron network PyBrain
Positive                 Negative
It works.                May not work.
Nerd award!              No historical analysis.
tcpdump
tcpdump
tcpdump -v -n -w attack.log dst port 80 -c 250
tcpdump -nr attack.log |awk '{print $3}' |grep -oE '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0-
9]{1,}' |sort |uniq -c |sort -rn
tcpdump
Positive       Negative
It works.      why tcpdump? Ask kernel (nicely)!
Cisco ASA
Cisco ASA
Cisco ASA
Positive                               Negative
It works.                              Performance is theoretical.
Expen$ive High Performance $olution.   Fun is real.
More recipes
Recipes VS LOIC/HOIC
•   HTTP1.0 + Host header
•   Header order signatures
•   Leading space character signature
•   Mod_security
•   Snort
More reading: http://blog.spiderlabs.com/2012/01/hoic-ddos-analysis-and-detection.html
Results?
•   Every solution works.
•   Not always.
•   Not for everyone.
•   UPTIME > DOWNTIME.
Definition of happiness
• Minimal FALSE POSITIVES.
• No vulnerabilities on lower levels.
• Up to challenge.
NGINX testcookie_module
One last thing…
              (protect your TCP stack)




                                                  29.67%

            3.16%

              >=1Gbps                                      Spoofed

96.84%        <1Gbps                                       Full connect


                                         70.33%
Have a fun ride!
Homework.
1. NGINX/ipset pre-installed.
2. No stateful firewalls.
3. Fortified TCP stack.
4. Dedicated IP per critical published service.
5. Blackhole communities present and tested.

More Related Content

PPTX
lightning talk proposal
PDF
DDoS: Practical Survival Guide
 
PDF
Owning the bad guys
PDF
HTTP For the Good or the Bad
PPT
Zombilizing The Web Browser Via Flash Player 9
PDF
Integrity protection for third-party JavaScript
PDF
Active Https Cookie Stealing
PDF
Comet: Making The Web a 2-Way Medium
lightning talk proposal
DDoS: Practical Survival Guide
 
Owning the bad guys
HTTP For the Good or the Bad
Zombilizing The Web Browser Via Flash Player 9
Integrity protection for third-party JavaScript
Active Https Cookie Stealing
Comet: Making The Web a 2-Way Medium

What's hot (20)

PDF
Be Mean to your Code with Gauntlt #txlf 2013
PDF
URL to HTML
PDF
Integrity protection for third-party JavaScript
PPTX
TLS - 2016 Velocity Training
KEY
Genkidama:実装と課題
PDF
mod_perl 2.0 For Speed Freaks!
PDF
Security and Privacy on the Web in 2015
PPT
5 things MySql
PPTX
Altitude San Francisco 2018: Programming the Edge
PDF
FastNetMonを試してみた
PDF
HTTP For the Good or the Bad - FSEC Edition
PDF
Velocity 2011 - Our first DDoS attack
PDF
Altitude SF 2017: QUIC - A low-latency secure transport for HTTP
PDF
Protect your edge BGP security made simple
PDF
Ripe71 FastNetMon open source DoS / DDoS mitigation
PDF
20190516 web security-basic
PDF
FastNetMon - ENOG9 speech about DDoS mitigation
PDF
Security and Privacy on the Web in 2016
PDF
Distributed Denial of Service Attack - Detection And Mitigation
PPT
Dos threats and countermeasures
Be Mean to your Code with Gauntlt #txlf 2013
URL to HTML
Integrity protection for third-party JavaScript
TLS - 2016 Velocity Training
Genkidama:実装と課題
mod_perl 2.0 For Speed Freaks!
Security and Privacy on the Web in 2015
5 things MySql
Altitude San Francisco 2018: Programming the Edge
FastNetMonを試してみた
HTTP For the Good or the Bad - FSEC Edition
Velocity 2011 - Our first DDoS attack
Altitude SF 2017: QUIC - A low-latency secure transport for HTTP
Protect your edge BGP security made simple
Ripe71 FastNetMon open source DoS / DDoS mitigation
20190516 web security-basic
FastNetMon - ENOG9 speech about DDoS mitigation
Security and Privacy on the Web in 2016
Distributed Denial of Service Attack - Detection And Mitigation
Dos threats and countermeasures
Ad

Similar to DDoS: practical survival (20)

PDF
Adversary Pattern Analysis - A Journey with APNIC Honeypot
PDF
IX 2020 - Internet Security & Mitigation of Risk Webinar: Linux Malware and D...
PPTX
Helen Tabunshchyk "Handling large amounts of traffic on the Edge"
PDF
Layer one 2011-gh0stwood-d-dos-attacks
PDF
How to secure your web applications with NGINX
PPTX
Hunting Botnets with Zmap
PDF
EuroBSDCon 2013 - Mitigating DDoS Attacks at Layer 7
PDF
Secured Internet Gateway for ISP with pfsense & FRR
PDF
12 Years in DNS Security As a Defender
PPTX
Attacks and their mitigations
PPTX
Tcpdump hunter
PDF
Network Threat Hunting Training - 202308.pdf
PPT
Hacking Cisco
PDF
OpenDNS Whitepaper: DNS's Role in Botnet C&C
PDF
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
PDF
Having Honeypot for Better Network Security Analysis
PPTX
Multi-Layer DDoS Mitigation Strategies
PDF
Network and DNS Vulnerabilities
PPT
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
PDF
Multi-Layer DDoS Mitigation Strategies
Adversary Pattern Analysis - A Journey with APNIC Honeypot
IX 2020 - Internet Security & Mitigation of Risk Webinar: Linux Malware and D...
Helen Tabunshchyk "Handling large amounts of traffic on the Edge"
Layer one 2011-gh0stwood-d-dos-attacks
How to secure your web applications with NGINX
Hunting Botnets with Zmap
EuroBSDCon 2013 - Mitigating DDoS Attacks at Layer 7
Secured Internet Gateway for ISP with pfsense & FRR
12 Years in DNS Security As a Defender
Attacks and their mitigations
Tcpdump hunter
Network Threat Hunting Training - 202308.pdf
Hacking Cisco
OpenDNS Whitepaper: DNS's Role in Botnet C&C
Robots against robots: How a Machine Learning IDS detected a novel Linux Botn...
Having Honeypot for Better Network Security Analysis
Multi-Layer DDoS Mitigation Strategies
Network and DNS Vulnerabilities
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Multi-Layer DDoS Mitigation Strategies
Ad

More from Positive Hack Days (20)

PPTX
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
PPTX
Как мы собираем проекты в выделенном окружении в Windows Docker
PPTX
Типовая сборка и деплой продуктов в Positive Technologies
PPTX
Аналитика в проектах: TFS + Qlik
PPTX
Использование анализатора кода SonarQube
PPTX
Развитие сообщества Open DevOps Community
PPTX
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
PPTX
Автоматизация построения правил для Approof
PDF
Мастер-класс «Трущобы Application Security»
PDF
Формальные методы защиты приложений
PDF
Эвристические методы защиты приложений
PDF
Теоретические основы Application Security
PPTX
От экспериментального программирования к промышленному: путь длиной в 10 лет
PDF
Уязвимое Android-приложение: N проверенных способов наступить на грабли
PPTX
Требования по безопасности в архитектуре ПО
PDF
Формальная верификация кода на языке Си
PPTX
Механизмы предотвращения атак в ASP.NET Core
PDF
SOC для КИИ: израильский опыт
PDF
Honeywell Industrial Cyber Security Lab & Services Center
PDF
Credential stuffing и брутфорс-атаки
Инструмент ChangelogBuilder для автоматической подготовки Release Notes
Как мы собираем проекты в выделенном окружении в Windows Docker
Типовая сборка и деплой продуктов в Positive Technologies
Аналитика в проектах: TFS + Qlik
Использование анализатора кода SonarQube
Развитие сообщества Open DevOps Community
Методика определения неиспользуемых ресурсов виртуальных машин и автоматизаци...
Автоматизация построения правил для Approof
Мастер-класс «Трущобы Application Security»
Формальные методы защиты приложений
Эвристические методы защиты приложений
Теоретические основы Application Security
От экспериментального программирования к промышленному: путь длиной в 10 лет
Уязвимое Android-приложение: N проверенных способов наступить на грабли
Требования по безопасности в архитектуре ПО
Формальная верификация кода на языке Си
Механизмы предотвращения атак в ASP.NET Core
SOC для КИИ: израильский опыт
Honeywell Industrial Cyber Security Lab & Services Center
Credential stuffing и брутфорс-атаки

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
20250228 LYD VKU AI Blended-Learning.pptx
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
Programs and apps: productivity, graphics, security and other tools
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Weekly Chronicles - August'25 Week I
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MIND Revenue Release Quarter 2 2025 Press Release

DDoS: practical survival

  • 1. DDoS: practical survival guide Alexander Lyamin <la@highloadlab.com>
  • 2. Q1 2012 • Incidents: 365 • Daily max: 12 • Avg. botnet size: 2637 • Max botnet size: 37834
  • 3. 2012: 1 Jan – 30 May • Incidents: 728 • Daily max: 51 • Avg. botnet size: 3288 • Max botnet size: 116265
  • 4. Daily 55 Jan 50 Feb 45 Mar 40 Apr 35 May 30 25 20 15 10 5 0
  • 5. Weekday distribution 20% 18.82% 18% 15.93% 15.52% 16% 13.60% 14% 12.77% 12.50% 12% 10.85% 10% 8% 6% 4% 2% 0% Monday Tuesday Wednesday Thursday Friday Saturday Sunday
  • 6. High speed attacks 3.16% >=1Gbps 96.84% <1Gbps
  • 7. Spoofed source attacks 29.67% Spoofed Full connect 70.33%
  • 8. Scary stuff • DNS: NIC, Masterhost, FastVPS. • DataCenters: CROC, WAhome. • “Invisible” russian elections botnets. • Minerbot.
  • 9. New reality • 1k botnet - 100-160 USD. • Readily available botnet toolkits. • Fall of prices - 20 USD/day.
  • 12. Apache mod_evasive <IfModule mod_evasive20.c> DOSHashTableSize 3097 DOSPageCount 8 DOSSiteCount 100 DOSPageInterval 2 DOSSiteInterval 2 DOSBlockingPeriod 600 DOSEmailNotify secure@adminmail.com </IfModule>
  • 13. Apache mod_evasive Positive Negative It works! Apache
  • 15. Iptables --string iptables -A INPUT -p tcp -m tcp --dport 80 -m string --string "GET / HTTP" --algo kmp --to 1024 -m recent --set --name httpddos --rsource iptables -A INPUT -p tcp -m tcp --dport 80 -m string --string "GET / HTTP" --algo kmp --to 1024 -m recent --update --seconds 10 --hitcount 2 --name httpddos --rsource -j DROP
  • 16. Iptables --string Positive Negative It works. Not always works. (fragmentet packets) Its fast. Not always fast. (kmp matched packets) Orphaned sockets + retransmit. Requires conntrack(statefull is bad).
  • 18. JS
  • 20. NGINX testcookie_module testcookie_name BPC; testcookie_secret keepmescret; testcookie_session $remote_addr; testcookie_arg attempt; testcookie_max_attempts 3; testcookie_fallback /cookies.html?backurl=http://$host$request_uri; testcookie_get_only on; location / { testcookie on; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:8080; } Further reading: http://habrahabr.ru/post/139931/
  • 21. NGINX testcookie_module Positive Negative It works. Doesn’t block traffic.* NGINX. Alternates UX. Its fast. Is not effective on FBS. Predictable. Expandable (Flash, QT checks). * That’s what ipset is for.
  • 23. Neuron network PyBrain Request: 0.0.0.0 - - [20/Dec/2011:15:00:03 +0400] "GET /forum/rss.php?topic=347425 HTTP/1.0" 200 1685 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0» Dictionary: ['__UA___OS_U', '__UA_EMPTY', '__REQ___METHOD_POST', '__REQ___HTTP_VER_HTTP/1.0', '__REQ___URL_ __NETLOC_', '__REQ___URL___PATH_/forum/rss.php', '__REQ___URL___PATH_/forum/index.php', '__REQ___URL ___SCHEME_', '__REQ___HTTP_VER_HTTP/1.1', '__UA___VER_Firefox/3.0', '__REFER___NETLOC_www.mozilla- europe.org', '__UA___OS_Windows', '__UA___BASE_Mozilla/5.0', '__CODE_503', '__UA___OS_pl', '__REFER___PA TH_/', '__REFER___SCHEME_http', '__NO_REFER__', '__REQ___METHOD_GET', '__UA___OS_Windows NT 5.1', '__UA___OS_rv:1.9', '__REQ___URL___QS_topic', '__UA___VER_Gecko/2008052906’ Further reading: http://habrahabr.ru/post/136237/
  • 24. Neuron network PyBrain Positive Negative It works. May not work. Nerd award! No historical analysis.
  • 26. tcpdump tcpdump -v -n -w attack.log dst port 80 -c 250 tcpdump -nr attack.log |awk '{print $3}' |grep -oE '[0-9]{1,}.[0-9]{1,}.[0-9]{1,}.[0- 9]{1,}' |sort |uniq -c |sort -rn
  • 27. tcpdump Positive Negative It works. why tcpdump? Ask kernel (nicely)!
  • 30. Cisco ASA Positive Negative It works. Performance is theoretical. Expen$ive High Performance $olution. Fun is real.
  • 32. Recipes VS LOIC/HOIC • HTTP1.0 + Host header • Header order signatures • Leading space character signature • Mod_security • Snort More reading: http://blog.spiderlabs.com/2012/01/hoic-ddos-analysis-and-detection.html
  • 33. Results? • Every solution works. • Not always. • Not for everyone. • UPTIME > DOWNTIME.
  • 34. Definition of happiness • Minimal FALSE POSITIVES. • No vulnerabilities on lower levels. • Up to challenge.
  • 36. One last thing… (protect your TCP stack) 29.67% 3.16% >=1Gbps Spoofed 96.84% <1Gbps Full connect 70.33%
  • 37. Have a fun ride!
  • 38. Homework. 1. NGINX/ipset pre-installed. 2. No stateful firewalls. 3. Fortified TCP stack. 4. Dedicated IP per critical published service. 5. Blackhole communities present and tested.