HTB: Seal
| ターゲット // Seal | |
|---|---|
| Platform | HTB |
| OS | Linux |
| Difficulty | Medium |
| IP | 10.129.95.190 |
Enumeration#
Nmap#
▶ Nmap output
PORT STATE SERVICE
22/tcp open ssh
443/tcp open https
8080/tcp open http-proxy
Port 8080 - GitBucket#
A GitBucket instance with open registration. After registering, we get access to repository info and commit history.
Digging through the commits reveals Tomcat credentials:
| |
Port 443 - Web App + Tomcat#
Directory fuzzing reveals the standard Tomcat management endpoints (/manager, /admin), but they return 403.
Foothold#
Tomcat 403 Bypass#
The Tomcat manager console at /manager/html is blocked with 403. However, there’s a well-known path normalization bypass (credit to Orange Tsai):
https://seal.htb/manager/html --> 403
https://seal.htb/manager..;/html --> 200
With access to the Tomcat manager, deploy a WAR reverse shell:
| |
Upload, deploy, trigger – we get a shell as tomcat.
Lateral Movement#
Symlink + Ansible Backup#
The target user is luis. Poking around reveals an Ansible playbook at /opt/backups/playbook/run.yml:
| |
Key detail: copy_links=yes means the synchronize task follows symlinks. And we have write access to the uploads directory within the dashboard path.
Create a symlink pointing to luis’s home directory:
| |
Wait for the next backup run, then grab the archive from /opt/backups/archives/. It now contains luis’s entire home directory, including SSH keys.
SSH in as luis.
Privilege Escalation#
Ansible Playbook as Root#
| |
Create a malicious playbook that copies bash and sets the SUID bit:
| |
| |
Proof#
user.txt: [redacted]
root.txt: [redacted]
Key Takeaways#
- Always check Git history for leaked credentials – commit logs don’t lie
- Tomcat path normalization bypass (
..;/) is a classic technique worth remembering - Ansible
synchronizewithcopy_links=yesis exploitable if you can plant symlinks in the source directory ansible-playbookwith sudo is essentially unrestricted root command execution