DoS your local | fork() Bomb

Arpit Jain
Calvin Codes
Published in
2 min readNov 5, 2018

--

What is DoS?

Any system/server, service or network has a limited set of resources to serve any process or request. In other words, resources are not infinite.

Denial-of-service (DoS) is a type of malicious attack which tries to exhaust the system of all its available resources. And to do so, it bombards the system with a lot of processes (or requests or traffic), and thus all of the system’s resources get consumed in serving these processes.

Gotcha eat them all

Now that your system has spent all its resources in serving these malicious processes/requests, this is how it responds to any new incoming request:

literally, your system can’t! but it depends on many factors, including the OS.

What is fork()?

As explained in the Linux man page, fork() creates a new process by duplicating the calling process. The new process is referred to as the child process. The calling process is referred to as the parent process.

In short, fork() creates a CLONE of the process, in which it was called.

no no no no no no no!!!

fork() Bomb

Goal: Utilize all the resources of the system.
Goal Simplified: Create a lot of processes.

If we write a program which creates a child process upon execution, such that the child process also does the same, i.e., creates another child process upon execution, and the subsequent child process also does the same, and so on and on. That’s it, goal achieved.

DO NOT TRY THIS AT HOME!

If you are still curious, this is how your system might behave if you run this. 😝

running a fork() bomb on my local

Do comment your queries and feel free to connect with me on LinkedIn.

--

--

Arpit Jain
Calvin Codes

Scalability & Big Data Enthusiast | Microsoft | Sumo Logic | UW Madison | Myntra | IIT Guwahati