Hospital
Executive summary — Hospital is a Medium box with two worlds: a Linux container and the Windows host (a Domain Controller). A medical-report upload portal (8080) blocks
.phpbut accepts.phar, giving RCE aswww-datainside an Ubuntu 23.04 container. Its5.19.0-35kernel is vulnerable to GameOver(lay) (CVE-2023-2640/32629), combiningunshare, OverlayFS and misconfigured capabilities to escape the container and reach root, exposing/etc/shadow. We crackdrwilliams's password, reused on the Roundcube instance (443), where an email fromdrbrownasks for .eps files for GhostScript — CVE-2023-36664 lets us embed a PowerShell payload inside the.epsitself via a%pipe%directive, giving a shell asdrbrownon Windows. Since Apache/XAMPP runs as SYSTEM and its document root is writable, a webshell there executes with full privileges.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Medium |
| Status | Retired |
| Target IP | 10.129.229.189 |
Attack map
[Recon] 30 open ports -- Kerberos/LDAP/SMB/RDP/WinRM (Domain Controller)
+-> [8080] Medical-report upload portal -- blocks .php, allows .phar
|
[www-data] p0wny-shell.phar -> RCE in a Linux container (Ubuntu 23.04)
+-> stable reverse shell (named pipe + nc)
+-> kernel 5.19.0-35 -> GameOver(lay) (CVE-2023-2640 / CVE-2023-32629)
+-> unshare + overlayfs + setcap -> container escape -> root
|
[/etc/shadow] drwilliams hash -- John -> qwe123!@#
|
[443] Roundcube (webmail) -- login drwilliams:qwe123!@#
an email from drbrown asks for .eps files for GhostScript
|
[CVE-2023-36664] GhostScript command injection in .eps
PowerShell payload (UTF-16LE, base64) via a %pipe% directive
+-> attached and emailed -> executed by drbrown on Windows
|
[drbrown @ Windows] C:\xampp\htdocs is writable -- Apache/XAMPP runs as SYSTEM
+-> shell.php with shell_exec(powershell reverse shell)
+-> GET https://<TIP>/shell.php
|
[SYSTEM] root.txt
1. Reconnaissance
nmap -p- --min-rate=1000 -T4 -oN nmap_all_ports.txt 10.129.229.189
30 ports come up open. Among the relevant ones: 22 (SSH), 53 (DNS), 88 (Kerberos), 135 (MSRPC), 139 (NetBIOS), 389 (LDAP), 443 (HTTPS), 445 (SMB), 3389 (RDP), 5985 (WinRM), 8080 (HTTP) and 9389 (ADWS).
This combination — Kerberos + LDAP + SMB + ADWS — is the classic fingerprint of an Active Directory Domain Controller. The two web ports (
443/8080) are the realistic entry vector: we won't attack AD directly, but through the applications exposed on top of it.
nmap -p22,53,88,135,139,389,443,445,464,593,636,1801,2103,2105,2107,2179,3268,3269,3389,5985,6032,6404,6406,6407,6409,6613,6637,8080,9389 -sC -sV -oN nmap_services.txt 10.129.229.189
Port 443 serves a Roundcube instance — the login page reads "Hospital Webmail :: Welcome to Hospital Webmail". Port 8080 serves a "Hospital" application inviting users to upload medical records ("In order to get more personalized treatment, please upload your medical records") and allows open account registration — that open, unmoderated sign-up is the sign that the entry point is there.
Root Access unlocks the content you can't see — everything else on the site is already open.
See Root Access plansNo account? Create one free then upgrade from your console.