What is a fork bomb?

QuestionsQuestions8 SkillsProHello, Bash!Oct, 18 2025
0168

A fork bomb is a type of denial-of-service (DoS) attack that exploits the process creation capabilities of an operating system. It works by creating a large number of processes in a short amount of time, which can overwhelm the system's resources, such as CPU and memory.

The classic example of a fork bomb in Unix-like systems is the command:

:(){ :|:& };:

Here's how it works:

  1. : defines a function named :.
  2. Inside the function, it calls itself twice (:|:), creating two child processes.
  3. The & puts the processes in the background, allowing the function to be called repeatedly.
  4. The final ;: executes the function, starting the cycle.

As a result, the system quickly becomes overloaded with processes, leading to a crash or unresponsiveness. To mitigate the effects of a fork bomb, system administrators can set limits on the number of processes a user can create.

0 Comments

no data
Be the first to share your comment!