DoS your local | fork() Bomb
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.
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:
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.
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. 😝
Do comment your queries and feel free to connect with me on LinkedIn.