The vulnerability stems from two key issues in the file upload handler:
MIME type detection initially used $_file (constructed from user-controlled filename) rather than $files['tmp_name'][$i], potentially leading to incorrect content type validation.
File extension extraction used pathinfo() on user-controlled filenames without proper sanitization, allowing extension spoofing.
The patch fixes both by using the temp file for MIME checks and parse_url for extension extraction. This combination of improper input validation in file processing directly enables stored XSS via malicious uploads.