You’ll Get Forked if You Try This

I was having a discussion about code obscurity relative to different programming languages and had to mention this particular piece of malicious code from the unix shell.

WARNING! – DO NOT RUN THIS COMMAND – YOU WILL LIKELY BRING DOWN YOUR SYSTEM BEFORE YOU CAN RECOVER:

This is a fork bomb and works like this:

:(){ :|:& };:

The :() defines a function called ':'
The {:|: &} says to run the function : and sends the output to the : function again.
That allows it to run in the background which prevents the children from being killed once the parents are auto-killed. 
The ; is a command separator and the following : calls the function the first time and initiates the chain reaction.

The worst/best part of this is there’s nothing about this sort of code that requires and administrative/root privilege to run.

Facebooktwittermail
Tagged with: , , , , , ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.