From Remote Code Execution to Data Base Pwnage
A profile picture upload accepted a PHP file containing a shell payload, which executed on the server and allowed the attacker to read database credentials. The attacker then connected to the MySQL server, created an admin user, and logged into the WordPress dashboard.
medium.com
Published on medium.com
Let’s Hack the University by RCE-ing… because education should be interactive, right?
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the file upload feature did not validate file type or content, allowing a PHP script to be stored and executed by the web server.
Impact
An attacker could execute commands on the server, access the database, and create an admin account to take over the WordPress site.
What the attacker needed
A user account; access to profile settings
The fix
The upload feature should validate file type and content, store uploads outside the web root, and disable script execution in upload directories.
How it was found
- Log in and go to Profile Settings.
- Find the profile picture upload option.
- Upload a PHP file containing a shell payload instead of an image.
- Open the stored profile image link in a new tab.
- Run shell commands through the uploaded file.
- Use the enumerated credentials to connect to the MySQL server.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The website let a user upload a file as a profile picture but did not check that it was really an image. Because the server ran PHP, the uploaded file could run commands on the server, and the attacker used that to reach the database and take over the site.
What is File upload?
An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.