Hi y'all,
I was chatting to a work colleague today and conversation went down a path which included bash fork bombs (I don't know how it went there, but it did), and it turns out my colleague had heard of them, and even knew that they did stuff to a computer, but didn't really know what it did exactly, and what that would look like in real life.
With that in mind, I created a VM and recorded a short video (< 2 min i think) showing exactly what happens when such a fork bomb is run on a computer.
The video can be watched on YouTube here;
https://youtu.be/CmWgXMC9pe8
The video can be watched on Odysee here ;
https://erb.pw/y/forkbomb
I hope that this video is of some use.
I will go over the basics of what a fork bomb is, and how it works;
Here's the fork bomb:
:(){ :|: & };;
Breaking this down, what it is doing is defining a bash function, we can do this for anything like this;
myfunction() {
# some code here
}
in this case, the function name is just ":" (a colon). The code inside the function, the stuff that the function does, is calls itself (recursion) and then pipes any output from stdout caused by itself into the stdin of itself;
:|:
We would normally do something like this;
echo "hello world"|base64
echo "hello world" would make "hello world" come out of stdout, and we are piping that into base64.
The "&" in the fork bomb is used to put the command immediately before it into the background. We can do something similar with say nautilus. Openning a terminal and running "nautilus . &" would run the file manager, and give control back to the terminal that called it, not using the "&" would lock the terminal that called the file manager until the file manager closed.
After the function has been defined, we immediately use the function.
I hope this explains what the fork bomb is, and hopefully you can understand why it causes the issue you see in the video.
---
|14Best regards,
|11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N
|07── |08[|10eml|08] |
15ml@erb.pw |07── |08[|10web|08] |15www.erb.pw |07───┐ |07── |08[|09fsx|08] |1521:1/158 |07── |08[|11tqw|08] |151337:1/101 |07┬──┘ |07── |08[|12rtn|08] |1580:774/81 |07─┬ |08[|14fdn|08] |152:250/5 |07───┘
|07── |08[|10ark|08] |1510:104/2 |07─┘
... Don't sweat the petty things and don't pet the sweaty things
--- Mystic BBS v1.12 A47 2021/12/13 (Linux/64)
* Origin: thE qUAntUm wOrmhOlE, rAmsgAtE, uK. bbs.erb.pw (1337:1/101)