How To: Make a Simple UDP_Flooder in C pt1.

Make a Simple UDP_Flooder in C pt1.

Alright, this will be my first tutorial in C.

Note that this guide is written for Linux.

This won't be very easy if you don't know the basics of C, so if you don't I suggest looking into dontrustme's awesome C tutorials first.


Alright here is the deal, this UDP flooder should NEVER, EVER be used outside your LAN. The reason being, apart from the fact you shouldn't ofcourse use it illegally, that there is a chance your ISP will shut you down for breaking the terms of agreement.

How Does UDP Flooding Work?

UDP Works by sending lots of UDP packets to random closed ports on a server. The server will process each received UDP packet and send back an ICMP packet saying the port is closed. Because of all the trafic this creates the server will eventually be unable to process traffic, causing denial of service.

So What Do We Need?

We need a program that sends a lot of UDP packets to different ports.
in pseudo code:
#include socketheaders

struct sockaddr targetAddr

main() {
sock (udp)

targetAddr.ipaddr = <target ip>

while(true) {
. . for(i=10000;i<60000;i++) {
. . . . targetAddr.port = i
. . . . sendto(sock, msg, targetAddr)
. . }


That's right, home work! I want you to first try and write it yourself.

Check the following man pages:

man socket, man 2 socket, man 7 socket, man sendto

Also take a look in the header files, sys/socket.h, arpa/inet.h

In part two we will go trough my version of the program and ways to mitigate this attack ;)

That's it for now, good luck with coding ^^.

EDIT: Beej also has a great deal of info on sockets found here ~ thx dtm, for the suggestion

Want to start making money as a white hat hacker? Jump-start your hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from cybersecurity professionals.

Buy Now (90% off) >

Other worthwhile deals to check out:

Join the Next Reality AR Community

Get the latest in AR — delivered straight to your inbox.

Be the First to Comment

Share Your Thoughts

  • Hot
  • Latest