Table of Contents
Markup is a Windows machine that contains a misconfigured http server, which reveals the SSH key. You can find out more about these next.
Enumeration
Click on the spawn machine to find the Target IP address.
As always, we begin by scanning the target for open ports.
Let's navigate to the webpage using the Mozilla Firefox browser:
The webpage features the landing page for an online shopping company. A login screen is presented to us.
A username and password are being requested. Let’s try to
attempt some default credentials for the Mega shopping service to get login
access.
Let’s try to log in with some default credentials like,
After manually attempting, we land on a successful login. The correct combination is admin: password .
We are presented with the customer store panel.
Foothold
The website has some basic functionality that allows you to
place orders.
Start Burp suite, and capture the request:
If we capture the request and take a look at it with Burp we can see that the data is processed in XML format. Furthermore, let’s try if there is an XXE (XML External Entity) vulnerability that exists or not.
- Learn More:
XML External Entity (XXE) Injection
This resource delves into XML External Entity (XXE) injection, a vulnerability that allows attackers to exploit applications that parse XML input. It explains how XXE attacks work, their impact, and methods to prevent them.
XML external entity (XXE) injection
An XML External Entity attack is a type of attack against an application that parses XML input. This attack occurs when XML input containing a reference to an external entity is processed by a weakly configured XML parser. This attack may lead to the disclosure of confidential data, denial of service, server-side request forgery, port scanning from the perspective of the machine where the parser is located, and other system impacts.
We can perform an XML injection (XXE External Entity
Injection) attack to receive the contents of the win.ini file.
Now send this to the repeater using ctrl + R . Our assumption was true, it reveals that the web server contains XXE vulnerability .
From the Nmap scan, we confirmed that the Port 22 SSH server is running on the Windows server. What if I found user details then probably we could find out the SSH key. I found a user denial from the source code of the webpage.
So change the code and give the SSH path where the key is stored. The SSH private keys are usually stored in C:\Users\username\ dot ssh\id_rsa .
We got an Open-SSH private key code. So, I grabbed the key and saved it in a file called id_rsa using the nano text editor.
So next we try to SSH to the server with daniel's key.
You can find out the user flag from the desktop:
Privilege Escalation
Escalating the privilege is quite easy, you just need to
upload the winPEAS.exe file to the desktop and then execute it. Which will automatically
reveal the administrative username and password. Let’s see how it works.
Windows Privilege Escalation using WinPEAS
Previously, I had a copy of the winPEAS.exe file on c:\xampp\htdocs of the xampp server and, start the Apache server.
Switch back to the SSH shell run the PowerShell command and then upload winPEAS.exe using wget.
Execute the winPEASx64.exe :
Analyze and you can find out the password from the Administrator.
We have now an Administrator username and password, so let’s connect with SSH.
You can find out the root flag from the desktop:
Task Solutions
TASK 1: What version of Apache is running on the target's port 80?
Ans. 2.4.41TASK 2: What username:password combination logs in successfully?
Ans. admin:passwordTASK 3: What is the word at the top of the page that accepts user input?
Ans. orderTASK 4: What XML version is used on the target?
Ans. 1.0TASK 5: What does the XXE / XEE attack acronym stand for?
Ans. XML External EntityTASK 6: What username can we find on the webpage's HTML code?
Ans. DanielTASK 7: What is the file located in the Log-Management folder on the target?
Ans. job.batTASK 8: What executable is mentioned in the file mentioned before?
Ans. wevtutil.exe