The Uptime Engineer
👋 Hi, I am Yoshik Karnawat
Don’t scroll past, this week’s 180 second read might just save you hours at work.
Facts About Fork Bombs
The first fork bomb attack happened in 1969 before the internet even existed
A single fork bomb process can spawn over 1 million child processes in under 60 seconds
Most Linux systems allow 128,038 processes by default, fork bombs hit this limit in seconds
Fork bomb attacks on Linux increased 226% from Q1 2023 to Q1 2024
You've probably heard the phrase "fork bomb" before.
Maybe on Reddit. Maybe from a coworker who crashed their laptop once.
But here's what most engineers don't realize:
It's not a virus. It's not malware. It's just a function that eats itself.
And on Linux, it's terrifyingly easy to trigger.
Let me show you why.
What is a fork bomb?
A fork bomb is a denial-of-service attack that uses one command to crash your system.
It works by creating processes that create more processes. Forever.
Each new process spawns two more.
Those spawn two more.
And so on.
Within seconds, your CPU, memory, and process table are completely full.
Your keyboard stops responding.
Your mouse freezes.
Even Ctrl+Alt+Del won't save you.
You're forced to hard reboot and you'll probably lose data.
The Scary Part?
It's six characters.
Here's the entire attack in bash:
:(){ :|:& };:That's it.
No complex exploit. No root access needed. Just six strange looking characters.
Let me break it down:
:() → Defines a function named :
{ :|:& } → The function calls itself twice (recursively)
; → Separates the definition from execution
: → Runs the function
When you hit Enter, destruction.
The function runs.
It calls itself.
Each copy calls itself twice more.
Exponential growth.
Within 10 seconds, you've got thousands of processes.
Within 30 seconds, your system is dead.
And yes, it works in every language. Bash isn't special. Fork bombs work anywhere you can spawn processes.
Python example:
import os
while True: os.fork()Why it's so dangerous
Most DoS attacks come from outside your system.
Fork bombs come from inside.
That means:
No firewall will stop it
No intrusion detection will catch it
No network filtering will help
And here's the kicker: sometimes it's accidental.
How to protect yourself
You can't prevent fork bombs entirely.
But you can limit the damage.
Limit processes per user using ulimit command
Set system-wide limits via /etc/security/limits.conf
Block root access
What to do if you're hit
If a fork bomb triggers, your system will freeze.
No SSH. No terminal. No control.
Your only option: hard reboot.
And fork bombs work because most systems don't cap process creation.
So if you're running Linux servers in production, check your limits.
Because six characters shouldn't be able to crash your entire infrastructure.
Until next time,
Yoshik Karnawat (The Uptime Engineer)
