0x01.
In question one (see above), get the file suffix name $file_type = $_fiels[' file ' [' type '], by comparison with the whitelist, if the same, then take the name of the upload file suffix. As mentioned above, the MIME header spoofing problem (here does not consider renaming the file name problem), if the upload packet modifies the type of Content-type, $file _type to get the modified file type.
such as: Upload 1.php=>burpsuite intercept modified packet content-type is:image/jpg=> $file _type= "image/jpg", $file _name= "1.php".
1.gif89a file header bypass, the program rules can only upload GIF files, because the file type is also obtained through $file_type, the program determines whether the file header information to upload is a whitelist type.
Pseudo code: $filetype = Fileheaderread ($uploadFile); if $fileType = = ' gif89a ' echo ' upload success ';
Modify the header information in the upload Webshell, because the GIF code header information is gif89a, so Webshell code: gif89a<?php code?>
2. Blacklist bypass
List of types that are not allowed to be uploaded in advance, asp|aspx|jsp|php|asa| ....
Add upload shell.cer, or casing bypass, shell. Asp/shell.php ....
3. Suffix name Resolution vulnerability
Iis6.0/apache/nginx (PHP-FPM)
Common shell.asp;. Jpg,/shell.asp/shell.jpg,shell.php.xxx (Apache parse from right to left, unrecognized, skip to next parse)
4.0x00 truncation
Upload shell.php.jpg=>burpsuite interception, after. php with a space, in hexadecimal, the corresponding 0x20 modified to 0x00 (empty), the program when processing this file name, directly discard the following. jpg, save the file name is shell.php
5.apache rewrite file. htaccess. Move_uploaded_file () function, when moving a file, if the file exists, the new file overwrites the old file directly.
Brief analysis of File Upload vulnerability of OWASP Top 10 (II.)