Class Activity 11.1 - The Metaspolit Framework
Metasploit is a sophisticated tool. It can greatly enhance the efficiency of a pen test. It can also be extended to deal with new exploits as they are discovered. Before launching an exploit, it is advisable to look at the metasploit exploit ruby module description and code. In many cases, they credit the work of someone who took the time to find the exploit by hand.
Exploiting Cupcake with Metasploit
In the following file there is an illustration of the process of using the Metasploit Framework to achieve a foothold on Cupcake and escalating the privileges to root/administrator.
Ping host to see if its running
ping 10.0.5.23
Run Nmap Scan to discover ports
sudo nmap -sS -vvv 10.0.5.23
ports found:
22/tcp ssh
80/tcp http
Nmap to find more about open ports
sudo nmap -sC -sV 10.0.5.23 -p 80,22

Investigate Ports Manullay
From manual investigation we know that Apache 2.2.15 has the shellshock vulnerability
cgi-bin
CVE 2014-6278, 6271
Investigating Ports with Metasploit

Starting Metasploit
type
msfconsole
into the command line

in the console run
exploit(multi/http/apache_mod_cgi_bash_env_exec)
The type
options

Change the options

Start exploiting:

get server username with
getuid

Create a
shell
After “shell”, we can run commands on cupcake such as id, pwd

A more interative shell:

Gathering more information for escalation
cat etc/passwd
for the samwise username

uname -a
for the kernel version

Quick search for exploit of this kernel

You can find the dirty.c code in the link
40839 is given as the CVE number
Find the path to the exploit

Change the backup filename (so its not password.bak)

Upload the file

find the file

Compile, give execute permissions and run

enter new password and it will create the
firefart
user

Deliverable 1. A screenshot showing your session information from your foothold session and optionally, a screenshot showing your root shell.
use
su firefart
to now become the new root user!

Last updated