Back to Blog Home

Fork Bomb

Jay Mishra| Security | 6 months, 1 week



 

A fork bomb is a type of Denial of service attack wherein the program replicates itself in order to eat up system resources and crash the system. A simple example of a fork bomb is a indefinite self replicating while loop. A fork bomb forks the processes and leads to system through resource starvation. Only option to kill a fork bomb is to kill all the instances of program by rebooting the system.

 

Example of a fork bomb in python :

 

 import os
 while True:
     os.fork()

 

An example of fork bomb in Javascript :

 

function bomb() {
  setTimeout(function() {
    for (;;) {
      bomb();
    }
  }, 0);
}

 

 



Join 1000+ People Who Subscribe to Weekly Blog Updates

Back to Blog Home