Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX Malicious Terminal Command (colon, brackets, curly brackets, apersand, etc) [duplicate]

Tags:

bash

macos

Ok, so someone "challenged" me to enter this into my OSX Terminal, but I have no idea what it would do:

WARNING to the reader: the following line can be harmful; do NOT enter it unless you know what you are doing:

:(){ :|:& };:

Any ideas?

like image 820
Colin Ramsay Avatar asked Jun 19 '09 11:06

Colin Ramsay


3 Answers

It's a fork bomb. Don't do it. (Actually, as GB pointed out quickly, the copy here started out as a broken fork bomb. It was missing its final colon.) Still, if someone says, "Try this command" while snickering, and you don't know what it does, common sense says...

Edit: The one you have here is pretty famous as a work of art by Jaromil, a digital artist.

like image 165
Telemachus Avatar answered Sep 22 '22 13:09

Telemachus


Breaking down the command so it's actually understandable:

:() #Define new function
    #named ':'
{ #Begin function definition
  #block
  :|:& #Pipe the very ':' function through itself,
        #creating two processes, and make the
        #resulting copy run in the background
        #(the & part)
} #End function definition block
;: #Call ':' for the first time, initiating a chain
   #reaction: each instance of ':' will create two
   #more instances, ad infinitum

Then again, from my experience Mac OS X happens to have a per-user limit for the number of processes one can execute, so unless you actually have the guts to run the fork bomb under a sudo -s or sudo -i shell, you should be fine.

like image 28
realkstrawn93 Avatar answered Sep 21 '22 13:09

realkstrawn93


It does nothing harmful, since Mac OS X has a (per-user) upper bound for number of processes.

like image 30
ilya n. Avatar answered Sep 22 '22 13:09

ilya n.