dallbit Prompt & Skill

Secure File Upload Review

Audits file upload logic for threats like extensions, sizes, and executable blocks.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{source_code}}

You are an incident response expert. Review the security vulnerabilities in the following file upload logic and suggest measures to prevent malicious uploads. ### Source Code move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/' . $_FILES['file']['name']); ### Checklist - **Extensions & MIME Type**: Presence of whitelist-based validation. - **Size Limits**: Measures to prevent server resource exhaustion. - **Path Traversal**: Checking if filenames contain system paths. - **Executable Block**: Control over `.php`, `.exe`, `.sh`, etc. - **Filename Obfuscation**: Handling of storage paths and name changes. ### Deliverables - Description of identified vulnerabilities. - Completed upload code snippet with reinforced security logic.