Brief analysis of File Upload vulnerability of OWASP Top 10 (II.)

Source: Internet
Author: User

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.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.