Tuesday, June 14, 2016

METASPLOIT - Port Forwarding


- Layout for this exercise:

- In this attack Kali wants to access a web server on the Linux victim machine, using XP system as a pivot..

- First of all, a meterpreter session is achieved by exploiting the XP machine:

- We learn that XP has got two interfaces. The second interface is connected to the inner network

- The active meterpreter session is number 1:

- Using session 1 to add a route to

- Printing the route:

- Scanning from the active meterpreter session 1:

- Once discovered a TCP port scanning is performed, from port 1 to 500:

- Now, portforwarding is enabled to access the victim (IP on port 80) from local port 9999. In this way the attacker would receive on localhost:9999 the web service from

- Actually, a local listening port has been created on 9999. The forwarding connection will forward web services from to localhost:9999, although attacker and victim are not directly connected because they are in different networks. The meterpreter session performs the connection in the background:

- The attack is successful when connecting the attacker's browser to localhost:9999:

METASPLOIT - Double Pivoting


- Layout for this exercise:

- First, the XP system must be exploited, because it is the closest to the attacker, being located in the same network
It will used as the first pivot, for further attacks to other inside networks.

- Scanning available ports and services at pivot 1 XP::

- Let's try to attack XP on port 445, using the ms08_067_netapi exploit:

- Setting XP's IP as the RHOST:

- Launching the exploit,  a successful meterpreter session is achieved:

- Now, post exploitation shows that XP is connected to an inner network

- Scanning for machines inside, a new is discovered.
This is the pivot 2 to be used at the attack against the final victim:

- Backgrounding the session 1:

- So far, there is only one active meterpreter session 1:

- A route to the inner network is added using session 1:

- Printing the route:

- Backing:

- Nex step would be to exploit the intermediate machine, whose IP is For that purpose, let's discover open and available ports:

- Let's try to attack port 80 using a vulnerability at Bad Blue application, web server usually working on that port:

- Setting the remote host to the new discovered system:

- In this case, the meterpreter payload is set to bind_tcp, because otherwise (reverse_tcp) the final victim would not know how to go back to the attacker:

- Launching the exploit a second meterpreter session is opened. We learn that the pivot 2 is a Windows 7 system:

- Also, it is interesting to notice that W7 has got two interfaces, one the and the other connected to the innermost network, with IP

- Let's discover other machines inside the network As a  result, we learn that the final victim has got the IP

- Backgrounding the meterpreter session 2:

- Backing to the original msfconsole prompt:

- Now, there are 2 active meterpreter sessions:

- A second route is needed to access the innermost network, using meterpreter session 2:

- Now, the last step would be to attack the final victim, with IP To achieve this goal we need to know what ports are open and available to be attacked, running this auxiliary script:

- Let's try to attack port 21, usually devoted to FTP service, for instance using the exploit vsftpd_234_backdoor:

-Launching the exploit, the attack is successful because a third session shell is opened at the innermost victim:

- So finally there are 3 open and active sessions for the whole process:

- It is interesting to view how netstat shows all the connections from each computer. From the attacker's point of view:

- From the Linux innermost computer's point of view:

- From the XP's point of view:

- From W7's point of view:

Monday, June 13, 2016



- Layout for this exercise:

- First, let's exploit the pivot XP taking advantage of the netapi vulnerability:

- Setting the remote host to the XP's IP address:

-  Looking for a meterpreter session and a reverse_tcp shell:

- The local host is the attacker itself, due to the reverse shell:

- Once launched the exploit, the attack is successful and a meterpreter session is achieved:

- The pivot has got two interfaces, one with the outside network and the other with inside network

- Let's discover hosts inside the inside network Because corresponds to the pivot XP, the must belong to the innermost machine, the vitcim:

- Backgrounding the meterpreter session 1:

- So far, there is only one active meterpreter, number 1:

- A route is added to the inside network, using the active meterpreter session 1:

- Printing the route:

- Backing from the netapi exploit:

- Scanning open ports (just from 1 to 500) at the victim

- Several interesting ports are open, for instance TCP 21, usually dedicated to FTP service:

- Backing from the auxiliary script:

- Now, let's try attacking the FTP service on the victim:

- Setting the victim's IP as the remote host:

- Let's use the payload cmd/unix/interact to get a remote shell:

- Required options:

- Once the exploit is run the attack is successful because the remote shell is finally achieved, back from the victim's machine: