The form uses attributes such as accept=".jpg,.jpeg,.png" and a JavaScript function (checkFile()) to ensure that only images are selected. If we remove checkFile and accept, or modify the JS, we bypass it. Sometimes the Content-Type also needs to be modified.
Blacklist Filters
Sometimes extensions such as .php, php7, phps are filtered; this is weak because it does not consider other extensions that execute PHP and may be case-sensitive. Extension fuzzing with FFUF/Burp: .phar may work; upload a hello world and filter by the extension that returns it in the body. List: PayloadsAllTheThings / Extension PHP / extensions.lst.
Whitelist Filters
The server only allows specific extensions. Bypass with shell.jpg.php; sometimes Apache is misconfigured and shell.php.jpg works because it contains .php. Another technique is inserting characters:
txt
%20 %0a %00 %0d0a / .\ . … :
For example, shell.php%00.jpg.
Type Filters
Content-Type Header: the server compares it with image/jpg, image/jpeg, image/png, image/gif.
MIME-Type: a file whose contents start with GIF8 is identified as a GIF image.