Following the same flow as the previous section just by modifying a request:
We'll intercept an image upload request with Burp, replace the file content and filename with our PHP script's, and forward the request:
app will return: Ext not allowed
- Indicates webapp has file type validation on the backend
Two common types of validating exts on backend:
- Blacklist of types
- whitelist of types
Validation may also check filetype / file content for type matching. Weakest form of these is testing the file extension against a BLACKLIST of extensions to determine whether to block it
- This is because it is not comprehensive - some file extensions may be missed.
Fuzzing file upload extensions
PATT php and .net: https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Upload%20Insecure%20Files/Extension%20PHP/extensions.lst https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Upload%20Insecure%20Files/Extension%20ASP
Do a standard burp intruder attack to fuzz.
Then, upload a file using an allowed extension and see if any of them allow us to execute php code.
- Not all exts will work with all web server configurations
One such example is .phtml which php webservers often allow for code execution rights.