SlideShare a Scribd company logo
The Hangover
A “modern” (?) high performance approach to build an offensive computing tool!




                                                                            Nelson Brito
                                                                nbrito[at]sekure[dot]org
Agenda

• 0000 – Introduction             • 0101 – Results

• 0001 – Motivation               • 0110 – Demonstration

• 0010 – “Hello World” Examples   • 0111 – Conclusions

• 0011 – Lessons Learned          • 1000 – Questions and Answers

• 0100 – Comparison
0000 – Introduction
Denial-of-Service
0001 – Motivation
Goals
• Firstly, the primary goal of this research was to build a
  “PERFECT” tool to use in my daily tasks.

• Secondly, provide me enough knowledge and perspective of
  how network devices and computer systems behave under this
  type of attack.

• Thirdly, prove that DoS was and still is a BIG ISSUE to whole
  Internet infrastructure.

• Lastly, but not least:
   – “The best is yet to come!”
      • http://fnstenv.blogspot.com/2010/08/best-is-yet-to-come.html
   – “A fake version of T50!!!”
      • http://fnstenv.blogspot.com/2010/10/fake-version-of-t50.html
Why Denial-of-Service?
• Is there anything more offensive than a   • But, what are the real damages? What
  DoS, anyways?                               are the real motivations? Image?
    – Bear in mind: DoS means “Stress         Revenge? Financial? Political? Hactivism?
       Testing” for this presentation.
                                            • DoS attacks are significantly harmful,
• DoS tools are necessary weapons in a        because they violate one of the three key
  cyber warfare…                              concepts of security that are common to
                                              risk management… Which one?
• Attacks against the infrastructure are         – Confidentiality
  more common than many people might             – Integrity
  think, and, when they happen, people         – Availability
  will certainly be aware of.



All the codes in this presentation were written in C language
 and tested on real machines, rather than virtual machines.
0010 – “Hello World” Examples
“Hello World” Example 01


main()                     loop()
 Signal()                   while()
 kill()                       malloc()
                              memset()
                              memcpy()
                              Signal()
                              alarm()
“Hello World” Example 02


main()                     loop()
 Signal()                   while()
 kill()                       memset()
                              memcpy()
                              Signal()
                              alarm()
“Hello World” Example 03


main()                     loop()
 Signal()                   while()
 kill()                       memcpy()
                              Signal()
                              alarm()
“Hello World” Example 04


main()                     loop()
 while()                    malloc()
   loop()                   memset()
                            memcpy()
“Hello World” Example 05


main()                     loop()
 while()                    memset()
   loop()                   memcpy()
“Hello World” Example 06


main()                     loop()
 while()                    memcpy()
   loop()
“Hello World” Examples Applied


Dell Latitude E6400       Dell Inspiron 910
0011 – Lessons Learned
Also known as “Tips and Tricks”
What is the “high-performance” definition?


English Language                            Computer Science
• Adj.                                      • A code and/or program that solves any
   – 1. Modified to give superior             problem faster and more efficiently than
       performance:                           ordinary codes / programs.
         • “a     high-performance   car”
           superior – of high or superior   • A code and/or program which use all –
           quality or performance;            or as much as possible – computer’s
         • “superior wisdom derived from      resources available.
           experience”;
         • “superior math students”.
SOCKET(2)
• T50 Sukhoi PAK FA is capable to:
   – Send protocol packets: ICMP, IGMP, TCP and UDP.
         • NO BIG DEAL, right?
   – Send ALL of them “ALMOST” on the same time – protocol “T50”!
         • BIG DEAL! 8)

• How many sockets should the code use to send ALL of them “ALMOST” on the
  same time?
    – 1 socket file descriptor
   –   2 socket file descriptors
   –   4 socket file descriptors
   –   8 socket file descriptors
   –   16 socket file descriptors
   –   32 socket file descriptors
   –   64 socket file descriptors
   –   NONE

• “Just one socket file descriptor? Really?”
SOCKET(2) & SETSOCKOPT(2)
socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds;

[...]


   if((fd = socket(AF_INET,   SOCK_RAW, IPPROTO_RAW))    == -1)
       exit(EXIT_FAILURE);


   if(setsockopt(fd, IPPROTO_IP,    IP_HDRINCL,   nptr, sizeof(n)) < 0)
       exit(EXIT_FAILURE);

[...]
GETSOCKOPT(2) & SETSOCKOPT(2)
socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds;

[...]

   len = sizeof(n);

   if(getsockopt(fd, SOL_SOCKET,   SO_SNDBUF,   &n, &len) == -1)
       exit(EXIT_FAILURE);

   for(n   += 128 ; n < 1048576 ; n += 128){
        if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &n,   len) == -1){
            if(errno == ENOBUFS)
               break;
            exit(EXIT_FAILURE);
        }
   }

[...]
FCNTL(2)
socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds;

[...]

   flags = fcntl(fd, F_GETFL, 0);

   if(fcntl(fd, F_SETFL,      flags|O_NONBLOCK)      == -1)
       exit(EXIT_FAILURE);

[...]
IOCTL(2)
socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds;

[...]


   if(ioctl(fd, FIONBIO,      &n)   == -1)
       exit(EXIT_FAILURE);

[...]
SIGNAL(2) & SENDTO(2)

• “Signals are used to notify a process or thread of a particular
 event. Many computer science researchers compare signals with
 hardware interrupts, which occur when a hardware subsystem,
 such as a disk I/O (input/output) interface, generates an
 interrupt to a processor when the I/O completes.”
  – Linux Journal (Issue 73, May 2000) – By Moshe Bar

• “Signals also have been used to communicate and synchronize
 processes and to simplify interprocess communications (IPCs).
 Although we now have advanced synchronization tools and
 many IPC mechanisms, signals play a vital role in Linux for
 handling exceptions and interrupts. Signals have been used for
 approximately 30 years without any major modifications.”
  – Linux Journal (Issue 107, March 2003) – By B. Thangaraju
SIGNAL(2) & SENDTO(2)
[...]


   signal(SIGPIPE,   SIG_IGN);

[...]


redo:
   if(sendto(fd, &p, p_sz, 0|MSG_NOSIGNAL, &sin, sizeof(sin)) == -1){
        if(errno == EPERM)
           goto redo;
        else
          exit(EXIT_FAILURE);
   }

[...]
SELECT(2)
socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds;

[...]

while(flood || threshold--){
   FD_ZERO(&wfds);
   FD_SET(fd, &wfds);


   if(select(fd     + 1, NULL, &wfds, NULL, NULL)        == -1)
        exit(EXIT_FAILURE);

   if(FD_ISSET(fd, &wfds)){

[...]
PSELECT(2)
socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds;

[...]

while(flood || threshold--){
   FD_ZERO(&wfds);
   FD_SET(fd, &wfds);


   if(pselect(fd     + 1, NULL, &wfds, NULL, NULL, NULL)        == -1)
        exit(EXIT_FAILURE);

   if(FD_ISSET(fd, &wfds)){

[...]
SLEEP(3)
• Should the code “sleep()”?
  – Yes
  – No

• Should the code “usleep()”?
  – Yes
  – No

• Should the code “nanosleep()”?
  – Yes
  – No

• The code must       never     SLEEP(3),   USLEEP(3)   or
  NANOSLEEP(3).
RAND(3)

• “short” (16-bit)
  – Which one is faster creating random?
     • ((rand()&0xffff)<<8)+(rand()&0xffff)
     •1+(short)(65535.0*rand()/(RAND_MAX+1.0))


• “int” (32-bit)
  – Which one is faster creating random?
     • ((rand()&0xffffffff)<<16)+(rand()&0xffffffff)
     •1+(int)(4294967295.0*rand()/(RAND_MAX+1.0))
RAND(3)


Dell Latitude E6400   Dell Inspiron 910
What else?
• Choose using local variables rather than global variables.

• Choose using “__inline__” in header file (*.h) and “inline” in source code
  (*.c), enabling GCC switch options:
   – “-finline-functions” (-O3)
   – “-fkeep-inline-functions”

• Choose using “void” if you do not have to check the “return()” of some
  “function()”.

• Should the code use “unsigned” or “signed”?

• Should the code use “fork()” or “pthread_*()”?

• Etc... And by “etc…” I mean…

• Ohh… I almost forgot!!! Make the code RFC 1918 Compliance.
0100 – Comparison
com.par.i.son


English Language                              C Language (Operators)
• n.                                          • To test for equality is “==”.
    1.                                        • To test for inequality is “!=”.
         a.The act of comparing or the        • Other operators:
           process of being compared.            – “<” (less than)
       b. A statement or estimate of             – “>” (greater than)
           similarities and differences.         – “<=” (less than or equals)
    2. The quality of being similar or           – “>=” (greater than or equals)
        equivalent;       likeness:      no
        comparison between the two
        books.
    3. …
com.par.i.son

TCP Flood                           UDP Flood
• C4 by live                        • Geminid by live
• Geminid by live                   • B52 by Nelson Brito
• Mausezahn by Herbert Haas
                                    • Mausezahn by Herbert Haas
• F22 by Nelson Brito
• [L]OTUS by labsec team            • HPING3 by Salvatore Sanfilippo*
• HPING3 by Salvatore Sanfilippo*

ICMP Flood                          IGMP
• Geminid by live                   • STRESSER-0.7 by Shen139?
• Mausezahn by Herbert Haas            – Please, don’t be silly!!!
• HPING3 by Salvatore Sanfilippo*
Methodology
Why do I keep saying “ALMOST”?
0101 – Results
Minimum Frame Size (MFS)
• The maximum packet size is 1518 bytes, although to allow the Q-tag for Virtual
  LAN and priority data in 802.3ac it is extended to 1522 bytes.

• If the upper layer protocol submits a protocol data unit (PDU) less than 64 bytes,
  802.3 will pad the data field to achieve the minimum 64 bytes.

• The Minimum Frame Size will then always be of 64 bytes, but…
   – The Minimum Frame Size is related to the distance which the network spans, the type of
     media being used and the number of repeaters which the signal may have to pass
     through to reach the furthest part of the LAN.
Maximum Packets per Second (PPS) – 64 bytes


100BASE-TX               1000BASE-T
• 100 Mbps               • 1 Gbps
• 100,000,000 bits/sec   • 1,000,000,000 bits/sec
• 12,500,000 bytes/sec   • 125,000,000 bytes/sec
• 195,312.50 pps         • 1,953,125.00 pps
Maximum Packets per Second (PPS) – 88 bytes


100BASE-TX               1000BASE-T
• 100 Mbps               • 1 Gbps
• 100,000,000 bits/sec   • 1,000,000,000 bits/sec
• 12,500,000 bytes/sec   • 125,000,000 bytes/sec
• 142,045.50 pps         • 1,420,455.00 pps
TCP Flood


100BASE-TX   1000BASE-T
UDP Flood


100BASE-TX   1000BASE-T
ICMP Flood


100BASE-TX   1000BASE-T
0110 – Demonstration
T50 Sukhoi PAK FA Mixed Packet Injector Tool


Dell Latitude E6400                       Dell Latitude D620
•   Intel® Core™ 2 Duo P8400 (2.26 GHz)   • Intel® Core™ Duo T5600 (1.83 GHz)
•   Memory 4GB RAM                        • Memory 2GB RAM
•   Ubuntu Desktop Linux 10.04 64-bit     • Microsoft Windows 7 32-bit
•   Intel® 82567LM Gigabit Controller     • Broadcom NetXtreme 57xx Gigabit
•   1 Gbps Network                          Controller
•   Cross-over Cable (CAT-5e)             • 1 Gbps Network
                                          • Cross-over Cable (CAT-5e)




                          http://j.mp/T50-Demo
                              Demonstration!
0111 – Conclusions
Conclusions
• Can be applied to any DoS:             • Can be considered a cyber warfare’s
   – Peer-to-Peer Attacks                  weapon?
   – Application Level Attacks              – Yes, it can be considered like one.
   – Distributed Attacks
   – Reflected Attacks                   • It is just a matter of time to things get
   – Level-2 Attacks                       worse on the Internet.
   – Degradation-of-Service Attacks
   – DNS Amplifiers Attacks              • A DoS can be perpetrated overnight!


• Is DoS and DDoS so 1990’s?             • What else?
    – Please, don’t be silly, again!!!



An attacker does not even need multiples zombies.
1000 – Questions & Answers
Any questions?
The hangover: A "modern" (?) high performance approach to build an offensive computing tool!

More Related Content

PDF
Protocol T50: Five months later... So what?
PDF
[PH-Neutral 0x7db] Exploit Next Generation®
PDF
Offensive cyber security: Smashing the stack with Python
PDF
A client-side vulnerability under the microscope!
PDF
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
PDF
HITBSecConf 2016-Create Your Own Bad Usb
PDF
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
PDF
BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector
Protocol T50: Five months later... So what?
[PH-Neutral 0x7db] Exploit Next Generation®
Offensive cyber security: Smashing the stack with Python
A client-side vulnerability under the microscope!
[ROOTCON13] Pilot Study on Semi-Automated Patch Diffing by Applying Machine-L...
HITBSecConf 2016-Create Your Own Bad Usb
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector

What's hot (20)

PDF
HES2011 - Aaron Portnoy and Logan Brown - Black Box Auditing Adobe Shockwave
PDF
VMs, Interpreters, JIT
PDF
Kernel Recipes 2015: Anatomy of an atomic KMS driver
PDF
john-devkit: 100 типов хешей спустя / john-devkit: 100 Hash Types Later
PDF
A22 Introduction to DTrace by Kyle Hailey
PDF
David-FPGA
PDF
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
PDF
Ricardo J. Rodríguez & Daniel Uroz - When ROP meets Turing: Automatic Generat...
PDF
Defcon 22-colby-moore-patrick-wardle-synack-drop cam
PDF
Mind your language(s), A Discussion about Languages and Security
PDF
Where destructors meet threads
PPT
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
PPTX
Slide cipher based encryption
PDF
Android Mind Reading: Android Live Memory Analysis with LiME and Volatility
PDF
The entropic principle: /dev/u?random and NetBSD by Taylor R Campbell
PPTX
1300 david oswald id and ip theft with side-channel attacks
PPT
Much ado about randomness. What is really a random number?
PDF
Practical Differential Fault Attack on AES
PPTX
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
PDF
Binary instrumentation - dc9723
HES2011 - Aaron Portnoy and Logan Brown - Black Box Auditing Adobe Shockwave
VMs, Interpreters, JIT
Kernel Recipes 2015: Anatomy of an atomic KMS driver
john-devkit: 100 типов хешей спустя / john-devkit: 100 Hash Types Later
A22 Introduction to DTrace by Kyle Hailey
David-FPGA
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
Ricardo J. Rodríguez & Daniel Uroz - When ROP meets Turing: Automatic Generat...
Defcon 22-colby-moore-patrick-wardle-synack-drop cam
Mind your language(s), A Discussion about Languages and Security
Where destructors meet threads
Ilfak Guilfanov - Decompiler internals: Microcode [rooted2018]
Slide cipher based encryption
Android Mind Reading: Android Live Memory Analysis with LiME and Volatility
The entropic principle: /dev/u?random and NetBSD by Taylor R Campbell
1300 david oswald id and ip theft with side-channel attacks
Much ado about randomness. What is really a random number?
Practical Differential Fault Attack on AES
Two Challenges of Stealthy Hypervisors Detection: Time Cheating and Data Fluc...
Binary instrumentation - dc9723
Ad

Viewers also liked (20)

ODP
Microsoft GDI+ JPEG Integer Underflow Vulnerability
PDF
Gestão de Patches e Vulnerabilidades
PDF
Permutation Oriented Programming: (Re)searching for alternatives!
PDF
Cloud: Should I Stay or Should I Go?
PDF
SyScan Singapore 2010 - Returning Into The PHP-Interpreter
PDF
Secure Application Development in the Age of Continuous Delivery
PDF
Exploit Next Generation®: Missão dada é missão cumprida!
PPTX
Hexadecimal (Calculations and Explanations)
PDF
Inception: Tips and tricks I’ve learned reversing vulnerabilities!
PDF
"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
PDF
The Departed: Exploit Next Generation® – The Philosophy
PDF
Permutation Oriented Programming
PPTX
Workforce Planning (Process, Labour Shortage, Excess Labour)
PPTX
Changes in working practices
PPTX
Programming Languages / Translators
PDF
The Caesar Cipher
PDF
Patch and Vulnerability Management
PPTX
FormacaoCrypto
PPTX
Product (Product Portfolio, Branding, USP, Product Depth and Breadth, Product...
PPTX
Microsoft GDI+ JPEG Integer Underflow Vulnerability
Gestão de Patches e Vulnerabilidades
Permutation Oriented Programming: (Re)searching for alternatives!
Cloud: Should I Stay or Should I Go?
SyScan Singapore 2010 - Returning Into The PHP-Interpreter
Secure Application Development in the Age of Continuous Delivery
Exploit Next Generation®: Missão dada é missão cumprida!
Hexadecimal (Calculations and Explanations)
Inception: Tips and tricks I’ve learned reversing vulnerabilities!
"Touching the UNTOUCHABLE" (YSTS Seventh Edition)
The Departed: Exploit Next Generation® – The Philosophy
Permutation Oriented Programming
Workforce Planning (Process, Labour Shortage, Excess Labour)
Changes in working practices
Programming Languages / Translators
The Caesar Cipher
Patch and Vulnerability Management
FormacaoCrypto
Product (Product Portfolio, Branding, USP, Product Depth and Breadth, Product...
Ad

Similar to The hangover: A "modern" (?) high performance approach to build an offensive computing tool! (20)

ODP
6. processes and threads
PPTX
Reverse Engineering the TomTom Runner pt. 1
PPTX
04_ForkPipe.pptx
PPT
[CCC-28c3] Post Memory Corruption Memory Analysis
PDF
Bit_Bucket_x31_Final
PDF
How shit works: the CPU
PDF
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
PDF
Golang Performance : microbenchmarks, profilers, and a war story
PPTX
BSides MCR 2016: From CSV to CMD to qwerty
PPTX
Exploring the Internet of Things Using Ruby
PPTX
IOT Firmware: Best Pratices
PPT
11_UNIX_Processes_Including_Select.ppt
PDF
[Ruxcon 2011] Post Memory Corruption Memory Analysis
PDF
TestowanieIoT2016
PPTX
Track c-High speed transaction-based hw-sw coverification -eve
PPTX
Process management
PPTX
An intro to programming
PDF
[HITB Malaysia 2011] Exploit Automation
PDF
[Kiwicon 2011] Post Memory Corruption Memory Analysis
PPTX
Audible Objects
6. processes and threads
Reverse Engineering the TomTom Runner pt. 1
04_ForkPipe.pptx
[CCC-28c3] Post Memory Corruption Memory Analysis
Bit_Bucket_x31_Final
How shit works: the CPU
The Dirty Little Secrets They Didn’t Teach You In Pentesting Class
Golang Performance : microbenchmarks, profilers, and a war story
BSides MCR 2016: From CSV to CMD to qwerty
Exploring the Internet of Things Using Ruby
IOT Firmware: Best Pratices
11_UNIX_Processes_Including_Select.ppt
[Ruxcon 2011] Post Memory Corruption Memory Analysis
TestowanieIoT2016
Track c-High speed transaction-based hw-sw coverification -eve
Process management
An intro to programming
[HITB Malaysia 2011] Exploit Automation
[Kiwicon 2011] Post Memory Corruption Memory Analysis
Audible Objects

More from Nelson Brito (9)

PDF
SQL Fingerprint NG - A Next Generation DB Scanner
PDF
Próximo passo evolutivo de um DB Scanner
PDF
Reversing Engineer: Dissecting a "Client Side" Vulnerability in the APT era
PDF
Inception: Support Slides
PDF
DoS: From "Galactic Network" to "Service Unavailable" (Support Slides)
PDF
Keynote: Where is my identity?
PDF
Worms 2.0: Evolution — From SyFy to "You Die"
PDF
Inception: A reverse-engineer horror History
PPT
Worms: Conheça o inimigo e defenda-se
SQL Fingerprint NG - A Next Generation DB Scanner
Próximo passo evolutivo de um DB Scanner
Reversing Engineer: Dissecting a "Client Side" Vulnerability in the APT era
Inception: Support Slides
DoS: From "Galactic Network" to "Service Unavailable" (Support Slides)
Keynote: Where is my identity?
Worms 2.0: Evolution — From SyFy to "You Die"
Inception: A reverse-engineer horror History
Worms: Conheça o inimigo e defenda-se

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
sap open course for s4hana steps from ECC to s4
Encapsulation_ Review paper, used for researhc scholars
Programs and apps: productivity, graphics, security and other tools
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation theory and applications.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Weekly Chronicles - August'25 Week I
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf

The hangover: A "modern" (?) high performance approach to build an offensive computing tool!

  • 1. The Hangover A “modern” (?) high performance approach to build an offensive computing tool! Nelson Brito nbrito[at]sekure[dot]org
  • 2. Agenda • 0000 – Introduction • 0101 – Results • 0001 – Motivation • 0110 – Demonstration • 0010 – “Hello World” Examples • 0111 – Conclusions • 0011 – Lessons Learned • 1000 – Questions and Answers • 0100 – Comparison
  • 6. Goals • Firstly, the primary goal of this research was to build a “PERFECT” tool to use in my daily tasks. • Secondly, provide me enough knowledge and perspective of how network devices and computer systems behave under this type of attack. • Thirdly, prove that DoS was and still is a BIG ISSUE to whole Internet infrastructure. • Lastly, but not least: – “The best is yet to come!” • http://fnstenv.blogspot.com/2010/08/best-is-yet-to-come.html – “A fake version of T50!!!” • http://fnstenv.blogspot.com/2010/10/fake-version-of-t50.html
  • 7. Why Denial-of-Service? • Is there anything more offensive than a • But, what are the real damages? What DoS, anyways? are the real motivations? Image? – Bear in mind: DoS means “Stress Revenge? Financial? Political? Hactivism? Testing” for this presentation. • DoS attacks are significantly harmful, • DoS tools are necessary weapons in a because they violate one of the three key cyber warfare… concepts of security that are common to risk management… Which one? • Attacks against the infrastructure are – Confidentiality more common than many people might – Integrity think, and, when they happen, people – Availability will certainly be aware of. All the codes in this presentation were written in C language and tested on real machines, rather than virtual machines.
  • 8. 0010 – “Hello World” Examples
  • 9. “Hello World” Example 01 main() loop() Signal() while() kill() malloc() memset() memcpy() Signal() alarm()
  • 10. “Hello World” Example 02 main() loop() Signal() while() kill() memset() memcpy() Signal() alarm()
  • 11. “Hello World” Example 03 main() loop() Signal() while() kill() memcpy() Signal() alarm()
  • 12. “Hello World” Example 04 main() loop() while() malloc() loop() memset() memcpy()
  • 13. “Hello World” Example 05 main() loop() while() memset() loop() memcpy()
  • 14. “Hello World” Example 06 main() loop() while() memcpy() loop()
  • 15. “Hello World” Examples Applied Dell Latitude E6400 Dell Inspiron 910
  • 16. 0011 – Lessons Learned Also known as “Tips and Tricks”
  • 17. What is the “high-performance” definition? English Language Computer Science • Adj. • A code and/or program that solves any – 1. Modified to give superior problem faster and more efficiently than performance: ordinary codes / programs. • “a high-performance car” superior – of high or superior • A code and/or program which use all – quality or performance; or as much as possible – computer’s • “superior wisdom derived from resources available. experience”; • “superior math students”.
  • 18. SOCKET(2) • T50 Sukhoi PAK FA is capable to: – Send protocol packets: ICMP, IGMP, TCP and UDP. • NO BIG DEAL, right? – Send ALL of them “ALMOST” on the same time – protocol “T50”! • BIG DEAL! 8) • How many sockets should the code use to send ALL of them “ALMOST” on the same time? – 1 socket file descriptor – 2 socket file descriptors – 4 socket file descriptors – 8 socket file descriptors – 16 socket file descriptors – 32 socket file descriptors – 64 socket file descriptors – NONE • “Just one socket file descriptor? Really?”
  • 19. SOCKET(2) & SETSOCKOPT(2) socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds; [...] if((fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1) exit(EXIT_FAILURE); if(setsockopt(fd, IPPROTO_IP, IP_HDRINCL, nptr, sizeof(n)) < 0) exit(EXIT_FAILURE); [...]
  • 20. GETSOCKOPT(2) & SETSOCKOPT(2) socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds; [...] len = sizeof(n); if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &n, &len) == -1) exit(EXIT_FAILURE); for(n += 128 ; n < 1048576 ; n += 128){ if(setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &n, len) == -1){ if(errno == ENOBUFS) break; exit(EXIT_FAILURE); } } [...]
  • 21. FCNTL(2) socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds; [...] flags = fcntl(fd, F_GETFL, 0); if(fcntl(fd, F_SETFL, flags|O_NONBLOCK) == -1) exit(EXIT_FAILURE); [...]
  • 22. IOCTL(2) socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds; [...] if(ioctl(fd, FIONBIO, &n) == -1) exit(EXIT_FAILURE); [...]
  • 23. SIGNAL(2) & SENDTO(2) • “Signals are used to notify a process or thread of a particular event. Many computer science researchers compare signals with hardware interrupts, which occur when a hardware subsystem, such as a disk I/O (input/output) interface, generates an interrupt to a processor when the I/O completes.” – Linux Journal (Issue 73, May 2000) – By Moshe Bar • “Signals also have been used to communicate and synchronize processes and to simplify interprocess communications (IPCs). Although we now have advanced synchronization tools and many IPC mechanisms, signals play a vital role in Linux for handling exceptions and interrupts. Signals have been used for approximately 30 years without any major modifications.” – Linux Journal (Issue 107, March 2003) – By B. Thangaraju
  • 24. SIGNAL(2) & SENDTO(2) [...] signal(SIGPIPE, SIG_IGN); [...] redo: if(sendto(fd, &p, p_sz, 0|MSG_NOSIGNAL, &sin, sizeof(sin)) == -1){ if(errno == EPERM) goto redo; else exit(EXIT_FAILURE); } [...]
  • 25. SELECT(2) socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds; [...] while(flood || threshold--){ FD_ZERO(&wfds); FD_SET(fd, &wfds); if(select(fd + 1, NULL, &wfds, NULL, NULL) == -1) exit(EXIT_FAILURE); if(FD_ISSET(fd, &wfds)){ [...]
  • 26. PSELECT(2) socket_t fd; int flags, n = 1, len, * nptr = &n; fd_set wfds; [...] while(flood || threshold--){ FD_ZERO(&wfds); FD_SET(fd, &wfds); if(pselect(fd + 1, NULL, &wfds, NULL, NULL, NULL) == -1) exit(EXIT_FAILURE); if(FD_ISSET(fd, &wfds)){ [...]
  • 27. SLEEP(3) • Should the code “sleep()”? – Yes – No • Should the code “usleep()”? – Yes – No • Should the code “nanosleep()”? – Yes – No • The code must never SLEEP(3), USLEEP(3) or NANOSLEEP(3).
  • 28. RAND(3) • “short” (16-bit) – Which one is faster creating random? • ((rand()&0xffff)<<8)+(rand()&0xffff) •1+(short)(65535.0*rand()/(RAND_MAX+1.0)) • “int” (32-bit) – Which one is faster creating random? • ((rand()&0xffffffff)<<16)+(rand()&0xffffffff) •1+(int)(4294967295.0*rand()/(RAND_MAX+1.0))
  • 29. RAND(3) Dell Latitude E6400 Dell Inspiron 910
  • 30. What else? • Choose using local variables rather than global variables. • Choose using “__inline__” in header file (*.h) and “inline” in source code (*.c), enabling GCC switch options: – “-finline-functions” (-O3) – “-fkeep-inline-functions” • Choose using “void” if you do not have to check the “return()” of some “function()”. • Should the code use “unsigned” or “signed”? • Should the code use “fork()” or “pthread_*()”? • Etc... And by “etc…” I mean… • Ohh… I almost forgot!!! Make the code RFC 1918 Compliance.
  • 32. com.par.i.son English Language C Language (Operators) • n. • To test for equality is “==”. 1. • To test for inequality is “!=”. a.The act of comparing or the • Other operators: process of being compared. – “<” (less than) b. A statement or estimate of – “>” (greater than) similarities and differences. – “<=” (less than or equals) 2. The quality of being similar or – “>=” (greater than or equals) equivalent; likeness: no comparison between the two books. 3. …
  • 33. com.par.i.son TCP Flood UDP Flood • C4 by live • Geminid by live • Geminid by live • B52 by Nelson Brito • Mausezahn by Herbert Haas • Mausezahn by Herbert Haas • F22 by Nelson Brito • [L]OTUS by labsec team • HPING3 by Salvatore Sanfilippo* • HPING3 by Salvatore Sanfilippo* ICMP Flood IGMP • Geminid by live • STRESSER-0.7 by Shen139? • Mausezahn by Herbert Haas – Please, don’t be silly!!! • HPING3 by Salvatore Sanfilippo*
  • 35. Why do I keep saying “ALMOST”?
  • 37. Minimum Frame Size (MFS) • The maximum packet size is 1518 bytes, although to allow the Q-tag for Virtual LAN and priority data in 802.3ac it is extended to 1522 bytes. • If the upper layer protocol submits a protocol data unit (PDU) less than 64 bytes, 802.3 will pad the data field to achieve the minimum 64 bytes. • The Minimum Frame Size will then always be of 64 bytes, but… – The Minimum Frame Size is related to the distance which the network spans, the type of media being used and the number of repeaters which the signal may have to pass through to reach the furthest part of the LAN.
  • 38. Maximum Packets per Second (PPS) – 64 bytes 100BASE-TX 1000BASE-T • 100 Mbps • 1 Gbps • 100,000,000 bits/sec • 1,000,000,000 bits/sec • 12,500,000 bytes/sec • 125,000,000 bytes/sec • 195,312.50 pps • 1,953,125.00 pps
  • 39. Maximum Packets per Second (PPS) – 88 bytes 100BASE-TX 1000BASE-T • 100 Mbps • 1 Gbps • 100,000,000 bits/sec • 1,000,000,000 bits/sec • 12,500,000 bytes/sec • 125,000,000 bytes/sec • 142,045.50 pps • 1,420,455.00 pps
  • 40. TCP Flood 100BASE-TX 1000BASE-T
  • 41. UDP Flood 100BASE-TX 1000BASE-T
  • 42. ICMP Flood 100BASE-TX 1000BASE-T
  • 44. T50 Sukhoi PAK FA Mixed Packet Injector Tool Dell Latitude E6400 Dell Latitude D620 • Intel® Core™ 2 Duo P8400 (2.26 GHz) • Intel® Core™ Duo T5600 (1.83 GHz) • Memory 4GB RAM • Memory 2GB RAM • Ubuntu Desktop Linux 10.04 64-bit • Microsoft Windows 7 32-bit • Intel® 82567LM Gigabit Controller • Broadcom NetXtreme 57xx Gigabit • 1 Gbps Network Controller • Cross-over Cable (CAT-5e) • 1 Gbps Network • Cross-over Cable (CAT-5e) http://j.mp/T50-Demo Demonstration!
  • 46. Conclusions • Can be applied to any DoS: • Can be considered a cyber warfare’s – Peer-to-Peer Attacks weapon? – Application Level Attacks – Yes, it can be considered like one. – Distributed Attacks – Reflected Attacks • It is just a matter of time to things get – Level-2 Attacks worse on the Internet. – Degradation-of-Service Attacks – DNS Amplifiers Attacks • A DoS can be perpetrated overnight! • Is DoS and DDoS so 1990’s? • What else? – Please, don’t be silly, again!!! An attacker does not even need multiples zombies.
  • 47. 1000 – Questions & Answers