Cyborg
Executive summary — Cyborg is an Easy Linux room on TryHackMe that chains a web information leak, hash cracking and an encrypted backup. The app exposes a Squid proxy configuration containing anAPR1hash that we crack with John; that password turns out to be the passphrase of a Borg repository downloaded from the admin panel, from which we recover SSH credentials for useralex. Once inside, the final escalation abuses a script runnable as root viasudo. A Web → Borg → SSH → Root journey.
| Platform | TryHackMe |
| Operating system | Linux |
| Difficulty | Easy |
| Room | Cyborg |
| Target IP | MACHINE_IP |
Attack map
[80/HTTP] web application
| /etc/squid/passwd exposed -> APR1 hash (music_archive)
v
[CRACK] john + rockyou -> music_archive:squidward
| download archive.tar from /admin -> Borg repository
v
[BORG] borg extract (passphrase: squidward) -> alex's note.txt
| recovered SSH credentials
v
[SSH] alex@MACHINE_IP -> user.txt
| sudo -l -> abusable root-run script (PATH / writable)
v
[ROOT] root.txt1. Reconnaissance
We start by mapping the attack surface with a full TCP scan, running default scripts and version detection:
sudo nmap -sC -sV -T4 -p- MACHINE_IPWhy these flags:
-sC→ runs the default NSE scripts (banners, HTTP titles, etc.).-sV→ identifies each service's version.-p-→ scans all 65535 TCP ports, not just the top 1000.-T4→ aggressive timing template (fast but not reckless).
Relevant result: 22/tcp (SSH) and 80/tcp (HTTP) are open.
Analysis: with SSH and a web service exposed, the entry vector is almost certainly the web application; SSH is saved for later, once we hold credentials.
2. Web enumeration and hash retrieval
We brute-force common and interesting paths with a directory-enumeration tool:
gobuster dir -u http://MACHINE_IP/ -w /usr/share/wordlists/dirb/common.txt -x php,txtTwo paths stand out: /admin (an authentication panel) and /etc, which turns out to be browsable and mirrors the box's real OS filesystem — a serious misconfiguration on its own. Walking into /etc/squid/ we find Squid's configuration and password file served directly over HTTP. We fetch the password file:
curl -s http://MACHINE_IP/etc/squid/passwd | tee passwd.hashThe content is an MD5-crypt (APR1) hash for user music_archive — the $apr1$... format used by Apache/Squid for basic authentication.
Public background — how Squid stores this: Squid'sbasic_authscheme doesn't check credentials itself; it delegates to an external helper (commonlybasic_ncsa_auth), wired up insquid.confwith a line such asauth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd. That helper reads a standard htpasswd-format file — the same format Apache uses for HTTP Basic Auth — where each line isuser:$apr1$salt$hash. APR1 ("Apache MD5") is MD5 run through roughly 1,000 salted iterations: slower to crack than raw MD5, but still far weaker than modern KDFs like bcrypt/scrypt/yescrypt — well within reach ofjohn/hashcat(mode1600) against a wordlist likerockyou.
The lesson here: serving internal configuration files (/etc/squid/) through the web server is a serious information leak. They should never be reachable from the document root.3. Cracking the APR1 hash with John
With the hash in a file, we run John the Ripper against the rockyou wordlist. John auto-detects the APR1 format:
john passwd.hash --wordlist=/usr/share/wordlists/rockyou.txt
john --show passwd.hashResult:
music_archive:squidwardKeep this password:squidwardis not justmusic_archive's credential; later on it turns out to be the passphrase of the Borg repository. Password reuse is what chains the whole box together.
4. Downloading and extracting the site archive
In the site's admin panel (http://MACHINE_IP/admin, Archive → Download section) there is a downloadable archive.tar. We unpack it:
# after downloading archive.tar from http://MACHINE_IP/admin
tar -xvf archive.tarInside we find a Borg repository at home/field/dev/final_archive, with the typical Borg files: README, config, data/, index, nonce and integrity/hint files.
What Borg is:borgbackupis a deduplicating, encrypted backup tool. In its defaultrepokey/keyfileencryption modes, the repository key is derived from the passphrase (via PBKDF2) and used to drive AES-256 in CTR mode for confidentiality plus HMAC-SHA256 for integrity/authentication of every chunk. That is exactly why a repository is not read “by hand”: without the correct passphrase the on-diskdata/,indexandnoncefiles are opaque ciphertext, and only theborgclient can unwrap them.
5. Listing and extracting the Borg repository
We install borgbackup if missing and list the repository. The passphrase is the password we cracked earlier, squidward:
sudo apt-get update && sudo apt-get install -y borgbackup
borg list ./home/field/dev/final_archive
borg extract ./home/field/dev/final_archive::music_archiveWhy it works: borg list shows the repository's archives (snapshots) — here, one named music_archive. borg extract dumps its contents into the current directory. When prompted for the passphrase, we enter squidward.
After extracting, we inspect the recovered files looking for credentials:
grep -Rni "alex" .
cat home/alex/Documents/note.txtThe recovered note contains SSH credentials for user alex.
Chain so far: Squid hash leak → cracking → Borg passphrase → SSH credential theft from a backup. A “minor” flaw (exposed config file) becomes system access.
6. SSH access and user flag
With the recovered credentials, we log in over SSH as alex:
ssh alex@MACHINE_IPAnd read the user flag:
cat ~/user.txt7. Privilege escalation
First reflex after landing a user: check what we can run with sudo without a password:
sudo -lThe box escalates through a script executed with root privileges (something like backup.sh) that is abusable. Depending on how it is configured, the vector fits one of these two classic patterns:
- PATH injection: if the root script calls a binary by name (no absolute path), we create a malicious binary with that name and prepend its directory to
PATHbefore invoking it. - Writable script: if the script —or a file it executes— sits in a writable path, we replace it with one that spawns a shell.
Consistent approach: enumeratesudo -l, locate root-run scripts that are readable/writable, and analyze how they usePATHand which commands they invoke. That is where the escalation lives.
Once exploited, we confirm privileges and read the root flag:
id
cat /root/root.txtVulnerability summary
| Phase | Component | Vulnerability | Impact |
|---|---|---|---|
| Web | HTTP server | Squid configuration file (/etc/squid/passwd) exposed over HTTP | Leak of music_archive's APR1 hash |
| Credentials | APR1 hash | Weak password crackable with rockyou | Reused passphrase (squidward) |
| Backup | Borg repository | Encrypted backup downloadable with a known passphrase | SSH credentials for alex |
| PrivEsc | sudo / root-run script | Script runnable as root, abusable via PATH or write access | Execution as root |
Lessons learned
- Config leak: never serve internal files (
/etc/squid/) from the document root. A leaked hash is a starting point. - Password reuse:
squidwardwas both a web credential and the Borg passphrase. A single weak password toppled several layers. - Backups as a target: an encrypted backup is not safe if the passphrase is weak or stored elsewhere. They hold juicy secrets (here, SSH credentials).
- Sudoers hygiene: allowing a poorly written root-run script (PATH-based calls, writable files) is equivalent to handing out a root shell. Audit it.