Fork Bomb Attack: Definition And Examples (2021)

Ajay Ohri


A fork bomb is a program that hurts a system by making it run out of memory. The fork bomb is a type of DoS (denial-of-service) assault against a Linux-based system. It forks measures boundlessly to fill memory.


A fork bomb is a system call utilized in Linux and Unix systems that take a current interaction and duplicates it, shaping another process. This permits both processes to do exceptional tasks at the same time. A fork bomb is otherwise called a rabbit virus.

The system, in the long run, gets over-burden and can’t react to any input. As opposed to most DoS attacks, which regularly happen by flooding network or PC resources remotely, a fork bomb utilizes orders inside the framework it’s attempting to cut down. Once in a while, it can even act self-inflicted.

  1. Attack description
  2. Examples
  3. Mitigation methods

1. Attack description

In a fork bomb assault/attack, forestalling the creation of new cycles, self-recreating child processes devour framework resources, and impeding authentic programs from running.

Since a fork process consumes memory and CPU, system resources are regularly exhausted well before an operating system arrives at the greatest permitted measures. For most systems, a freeze goes on until a machine is restarted, and regularly a hard reboot is needed to recapture control. Data loss is almost certain. A few bits may have pre-set restrictions that at last permit an executive admittance to the system.

2. Examples

The accompanying characters include a fundamental Fork Bomb Linux shell script utilized to launch a fork bomb attack:

  1. : – runs the command, which is the recently made function –:
  2. ; – isolates the function characterizing a command to these left from the next command.
  3. & – runs the previous command in the background.
  4. :|: – runs the command recursively, which means the yield is piped to another variant of the command that runs in a subshell.
  5. {} – encases the commands that a function will run.
  6. :() – characterizes a function in Linux function, named:

Executing the command makes a child process, which at that point rehashes itself in an endless loop. The outcome is a system that can’t react because every one of its resources is utilized, making these unfilled processes. Fork examples code for bomb assault/attack in general/common programming languages include:

  1. C Fork Bomb
  2. Python Fork Bomb
  3. Ruby Fork Bomb
  4. Java Fork Bomb.

3. Mitigation methods

Forestalling fork bombs is finished by restricting the greatest number of cycles a user can claim. This is refined by: 

  1. Utilizing the Linux/Unix limit boundary to cover the number of processes a client can make. For instance, ulimit=30 limits a client to claiming 30 processes. Be that as it may, the fork bomb command is meeting explicit that the cut-off is reset after a meeting closes.
  2. Setting measure limits across a framework utilizing the/limits.conf file/security/etc. This is the favoured strategy since the setting can be carried out across all profiles, hence relieving the risk of altering every user—profile setting. 

It ought to be noticed that regardless of whether the right limits. conf setting is set up, a superuser and any cycle with administrative authority can, in any case, start a fork bomb attack.

Indeed, even with present-day operating systems, there is no ideal method to forestall a fork bomb. Nonetheless, implementing common security best practices and forestalling untrusted software to run on the root can hinder by far most fork bomb attack situations.


All Linux, Unix, or Unix-like operating systems are possibly defenseless against a fork bomb attack, including AIX, Red Hat, Debian, or Ubuntu. Windows operating systems are not vulnerable against a conventional fork bomb attack, as they can’t fork processes differently. This requires more perplexing programming than a conventional fork bomb.

So, have you made up your mind to make a career in Cyber Security? Visit our Master Certificate in Cyber Security (Red Team) for further help. It is the first program in offensive technologies in India and allows learners to practice in a real-time simulated ecosystem, that will give them an edge in this competitive world.



Related Articles

Please wait while your application is being created.
Request Callback