Bash fork() bomb

Today, I stumbled onto the following nasty bit of shell code in SECURITY Limit User Processes over on the Gentoo Wiki. No, I haven’t switched to Gentoo.

:(){ :|:& };:

Warning, this will cause your shell to create processes as fast as it can; most likely grinding your computer to a halt if you don’t have the appropriate limits set.

After spending some time trying to figure out what this command was doing assuming the colon was functioning as a no-op, I did a quick Google search and found this nice explanation of what it actually does. So, today I learned that Bash allows functions to be defined which override built-in commands.


Posted

in

by

Tags:

Comments

2 responses to “Bash fork() bomb”

  1. John Avatar

    Well, I appreciate your blog. I have spent the last few hours learning & playing – mostly playing with Gentoo..:-)

  2. Stephen Avatar
    Stephen

    That’s amazing :)

Leave a Reply

Your email address will not be published. Required fields are marked *