Approx. read time: 7.5 min.
Post: Fork Bomb Batch File Virus
Fun Prank: The Fork Bomb Batch File
Want to prank your friends harmlessly? Try the Fork Bomb Batch File! Itβs like a mini DDoS attack on your own system, but it wonβt cause any permanent damage. Just make sure no one loses unsaved work.
The Prank
The Fork Bomb batch file creates multiple processes to consume all available system memory, eventually causing the computer to crash. Itβs more annoying than harmful.
Steps to Create the Prank
- Create a Batch File: Open Notepad and copy the code below.
%0|%0
- Save the File: Save it as
RUNME.BAT
(make sure itβs a.BAT
file). - Run the Prank: Give it to a friend and watch the fun unfold.
Note: This prank works on Microsoft Windows Operating Systems.
Making it More Fun
To make the prank even more interesting, place the batch file on a USB stick and add an AUTORUN.INF
file to automatically run the batch file when the USB is inserted into a Windows computer.
How It Works – Fork Bomb Batch File Virus
To understand the Fork Bomb batch file better, let’s break down a more detailed version of the code.
Step-by-Step Explanation
:thestart
start %0
goto thestart
- Label:
:thestart
– Creates a label calledthestart
. - Start Command:
start %0
– Starts another instance of the batch file. - Loop:
goto thestart
– Jumps back to the label, creating an infinite loop.
What Happens?
- Multiple Processes: Each process starts another, doubling the number of processes each time.
- System Overload: The computerβs memory quickly fills up, causing it to slow down and eventually crash.
Symptoms
- The machine will become sluggish.
- It might slow down significantly.
- It could halt or restart.
- Any running environment (sandbox) might terminate or restart.
Illustration – Fork Bomb Batch File Virus
Here’s a visual representation of the Fork Bomb:

Fork Bomb Batch File Virus Illustration: Every child becomes a parent exponentially wasting memory.

Fork Bomb Batch File Virus runs in windows with task manager loaded
Exponential Growth
After a few iterations, the number of processes grows exponentially:
- 1 iteration: 2 processes.
- 2 iterations: 4 processes.
- 10 iterations: 1024 processes.
- 100 iterations: 1.267 nonillion processes (10^30).
The system will crash before reaching 50 iterations.
Protection – Fork Bomb Batch File Virus
To protect against fork bombs:
- Antivirus: Most antivirus programs can detect and warn about this script.
- Limit Processes: On Linux, use the
ulimit
command to limit the number of processes a user can create.
Example: ulimit -u 30
(limits to 30 processes).
Have fun pranking safely! Remember, itβs all in good fun, and no harm should come to anyoneβs data.
Fork bomb

InΒ computing, aΒ fork bombΒ (also calledΒ rabbit virus) is aΒ denial-of-service (DoS) attackΒ wherein aΒ processΒ continually replicates itself to deplete available system resources, slowing down or crashing the system due toΒ resource starvation.
History
Around 1978, an early variant of a fork bomb called wabbit was reported to run on aΒ System/360. It may have descended from a similar attack calledΒ RABBITSΒ reported from 1969 on aΒ Burroughs 5500Β at theΒ University of Washington.[1]
Implementation – Fork Bomb Batch File Virus
Fork bombs operate both by consumingΒ CPUΒ time in the process ofΒ forking, and by saturating theΒ operating system's process table.[2][3]Β A basic implementation of a fork bomb is anΒ infinite loopΒ that repeatedly launches new copies of itself.
InΒ Unix-like operating systems, fork bombs are generally written to use the forkΒ system call.[3]Β As forked processes are also copies of the first program, once they resume execution from the next address at theΒ frame pointer, they continue forking endlessly within their own copy of the same infinite loop; this has the effect of causing anΒ exponential growthΒ in processes. As modern Unix systems generally use aΒ copy-on-writeΒ resource management technique when forking new processes,[4]Β a fork bomb generally will not saturate such a system's memory.
Microsoft WindowsΒ operating systems do not have an equivalent functionality to the Unix fork system call;[5]Β a fork bomb on such an operating system must therefore create a new process instead of forking from an existing one.
A classic example of a fork bomb is one written inΒ Unix shellΒ :();:
, possibly dating back to 1999,[6]Β which can be more easily understood as
fork()
fork
In it, a function is defined (fork()
) as calling itself (fork
), thenΒ pipingΒ (|
) its result into itself, all in a backgroundΒ jobΒ (&
).
The code using a colonΒ :
Β as the function name is not valid in a shell as defined by POSIX, which only permits alphanumeric characters and underscores in function names.[7]Β However, its usage is allowed inΒ GNU BashΒ as an extension.[8]
Prevention
As a fork bomb's mode of operation is entirely encapsulated by creating new processes, one way of preventing a fork bomb from severely affecting the entire system is to limit the maximum number of processes that a single user may own. On Linux, this can be achieved by using theΒ ulimitΒ utility; for example, the commandΒ ulimit -u 30
Β would limit the affected user to a maximum of thirty owned processes.[9]Β OnΒ PAM-enabled systems, this limit can also be set inΒ /etc/security/limits.conf
,[10]Β and on *BSD, the system administrator can put limits inΒ /etc/login.conf
.[11]Β Modern Linux systems also allow finer-grained fork bomb prevention throughΒ cgroupsΒ and process number (PID) controllers.[12]
See also – Fork Bomb Batch File Virus
References – Fork Bomb Batch File Virus
- ^Β Raymond, Eric S.Β (October 1, 2004).Β "wabbit". The Jargon Lexicon.Β ArchivedΒ from the original on May 15, 2012. RetrievedΒ October 15,Β 2013.
- ^Β Ye, Nong (2008).Β Secure Computer and Network Systems: Modeling, Analysis and Design. John Wiley & Sons. p.Β 16.Β ISBNΒ 978-0470023242.
- ^Β Jump up to:aΒ bΒ Jielin, Dong (2007).Β Network Dictionary. p.Β 200.Β ISBNΒ 978-1602670006.
- ^Β Dhamdhere, Dhananjay M.Β (2006).Β Operating Systems: A Concept-based Approach. McGraw-Hill Higher Education. p.Β 285.Β ISBNΒ 0-07-061194-7.
- ^Β Hammond, Mark (2000).Β Python Programming On Win32: Help for Windows Programmers. "O'Reilly Media, Inc.". p.Β 35.Β ISBNΒ 1565926218.
- ^Β Michal Zalewski (August 19, 1999).Β "[RHSA-1999:028-01] Buffer overflow in libtermcap tgetent()".Β Newsgroup:Β muc.lists.bugtraq. RetrievedΒ December 10,Β 2022.Β
bash$Β :();:}
- ^Β "The Open Group Base Specifications Issue 7, 2018 edition IEEE Std 1003.1β’-2017 Section 3.235". The Open Group/IEEE.Β
Name: In the shell command language, a word consisting solely of underscores, digits, and alphabetics from the portable character set. The first character of a name is not a digit.
- ^Β "The GNU Bash Reference Manual, Section 3.3". RetrievedΒ December 11,Β 2022.Β
When the shell is in POSIX mode (see Bash POSIX Mode), fname must be a valid shell name and may not be the same as one of the special builtins (see Special Builtins). In default mode, a function name can be any unquoted shell word that does not contain '$'.
- ^Β Cooper, Mendel (2005).Β Advanced Bash Scripting Guide. pp.Β 305β306.Β ISBNΒ 1430319305.
- ^Β Soyinka, Wale (2012).Β Linux Administration: A Beginners Guide. McGraw Hill Professional. pp.Β 364β365.Β ISBNΒ 978-0071767590.
- ^Β Lucas, Michael W. (2007).Β Absolute FreeBSD: The Complete Guide to FreeBSD. No Starch Press. pp.Β 198β199.Β ISBNΒ 978-1593271510.
- ^Β "Process Number Controller in Documentation/ as appeared in Linux kernel 5.3". October 8, 2019.Β ArchivedΒ from the original on October 8, 2019. RetrievedΒ October 8,Β 2019.
External links – Fork Bomb Batch File Virus
- Fork bomb examplesΒ onΒ GitHub
Related Videos:
Related Posts:
JavaScript infinite alert prank lands 13-year-old Japanese girl in hot water
Protect Your Points: The Real Cost of Email Bombing and How to Fight Back
What Are the Fundamentals and Differences Between Linux and Unix Operating Systems?
Introduction to Batch File Viruses
Exploring Islam: History, Contributions, and Dispelling Misconceptions
Coding Autorun.inf Script Virus
Introduction to Batch File Viruses