|
| 1 | +# Sink |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +| Property | Value | |
| 8 | +|----------|-------| |
| 9 | +| **OS** | Linux | |
| 10 | +| **Difficulty** | Insane | |
| 11 | +| **Tags** | #web #http-smuggling #aws #cloud #gitea #secrets-management | |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Summary |
| 16 | + |
| 17 | +Sink is an Insane Linux machine featuring HTTP request smuggling through a HAProxy/Gunicorn desync to hijack admin sessions, followed by exploitation of a Gitea instance containing AWS secrets. Privilege escalation involves abusing AWS Secrets Manager and KMS to decrypt sensitive credentials. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## External Writeup |
| 22 | + |
| 23 | +- [Full Writeup by 0xMMN](https://0xmmn.blogspot.com/2023/09/hackthebox-sink-machine-insane.html) |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Key Techniques |
| 28 | + |
| 29 | +- HTTP Request Smuggling (CL.TE desync) |
| 30 | +- HAProxy / Gunicorn misconfiguration |
| 31 | +- Session hijacking via smuggled requests |
| 32 | +- Gitea repository enumeration |
| 33 | +- AWS Secrets Manager enumeration |
| 34 | +- AWS KMS key decryption |
| 35 | +- Cloud credential chaining |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## Attack Path Overview |
| 40 | + |
| 41 | +1. **Enumeration** - Discover HAProxy fronting a Gunicorn backend with a web application |
| 42 | +2. **HTTP Request Smuggling** - Exploit CL.TE desync between HAProxy and Gunicorn to smuggle requests and steal admin session cookies |
| 43 | +3. **Admin Access** - Use hijacked session to access admin panel, discover Gitea credentials |
| 44 | +4. **Gitea Exploitation** - Enumerate Gitea repositories, find AWS access keys and secrets in commit history |
| 45 | +5. **AWS Secrets Manager** - Use discovered AWS credentials to list and retrieve secrets from AWS Secrets Manager |
| 46 | +6. **AWS KMS** - Decrypt encrypted secrets using AWS Key Management Service |
| 47 | +7. **Root** - Use decrypted credentials for root access |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Lessons Learned |
| 52 | + |
| 53 | +- HTTP request smuggling remains a critical vulnerability in proxy/backend architectures |
| 54 | +- Secrets stored in version control (even private repos) can be extracted from git history |
| 55 | +- AWS credential chains across services (IAM -> Secrets Manager -> KMS) can lead to full compromise |
| 56 | +- HAProxy and Gunicorn have known desync issues when Content-Length and Transfer-Encoding headers conflict |
0 commit comments