File upload
Last updated
Last updated
Upload forms that allow to upload files are interesting to investigate.
Find the webserver language
PHP, Python, etc
Check for filters on the form
Allowed to upload any file?
Only checks file extension?
Bypass filter
Change magic number of file using hexeditor
Change file name and add file extension (example.jpg.php)
Bypass file extension filters:
Add pixel to reverse shell to make it look like a image:
GIF89a; header
GIF89a is a GIF file header. If uploaded content is being scanned, sometimes the check can be fooled by putting this header item at the top of shellcode:
Sometimes the server is configured to prevent execution of user-supplied files. We can maybe bypass the location to upload somewhere else using path traversal:
Response:
Now go to the upper directory of avatars, maybe something like /files and /files/exploit.php.