HowTo: Create a Linux Fork Bomb

Fork bomb is a form of denial-of-service attack against a computer system which makes use of the fork operation (or equivalent functionality), whereby a running process can create another running process.

Fork bombs typically do not spread as worms or viruses, but it works by creating a large number of processes very quickly in order to saturate the available space in the list of processes kept by the operating system.

If the process table becomes saturated, no new programs can start.

Once this code is executed, within seconds your system will freeze and then you have to hard boot the system.

A bash shell fork bomb may look like this:

:(){:|:&};:

The above can be explained as:

Function Description
🙁 ) define a function ‘:’ — so whenever we say ‘:’, execute this function
{ beginning of what to do when we say ‘:’
: load another copy of the ‘:’ function into memory…
| …and pipe its output to…
: …another copy of ‘:’ function, which has to be loaded into memory (therefore, ‘:|:’ simply gets two copies of ‘:’ loaded whenever ‘:’ is called)
& disown the functions — if the first ‘:’ is killed, all of the functions that it has started should NOT be auto-killed
} end of what to do when we say ‘:’
; Having defined ‘:’, we should now…
: …call ‘:’, initiating a chain-reaction: each ‘:’ will start two more

A more simple form, can be written as:

forkbomb() { forkbomb | forkbomb & } ; forkbomb
Was it useful? Share this post with the world!

4 Replies to “HowTo: Create a Linux Fork Bomb”

  1. :(){:|:&};: —- Is this the command i want to use in kali linux ??
    And also if i use this command my system will get hang right … How to make my target system to get hanged…Please tell me the command…

  2. U rather throw your laptop from 10th floor, more fun

    1. lol

  3. where’s the rest of it?

Leave a Reply