Description
This script is vulnerable to unrestricted file upload. Various web applications allow users to upload files (such as pictures, images, sounds, ...). Uploaded files may pose a significant risk if not handled correctly. A remote attacker could send a multipart/form-data POST request with a specially-crafted filename or mime type and execute arbitrary code. Acunetix was able to upload a file containing executable code and get this code executed. Check Attack details for more information about this attack.
Remediation
Restrict file types accepted for upload: check the file extension and only allow certain files to be uploaded. Use a whitelist approach instead of a blacklist. Check for double extensions such as .php.png. Check for files without a filename like .htaccess (on ASP.NET, check for configuration files like web.config). Change the permissions on the upload folder so the files within it are not executable. If possible, rename the files that are uploaded.
References
Related Vulnerabilities
WordPress Plugin vSlider Multi Image Slider for WordPress Arbitrary File Upload (4.1.2)
Deserialization of Untrusted Data (Java JSON Deserialization) Fastjson
WordPress Plugin WP eCommerce Multiple Vulnerabilities (3.8.9.5)
WordPress Plugin Church Admin Arbitrary File Upload (1.2530)
WordPress Plugin Font Uploader 'font-upload.php' Arbitrary File Upload (1.2.4)