Packetly Blog / Post

Packetly Blog

Explore our articles for the latest insights on securing digital content and preventing malware.

Back to Blog

Checking Uploads against OWASP CheckList

guides

February 14, 2025

OWASP, a trusted source of extensive resources, equips businesses with the knowledge and tools to secure their online presence. These resources cover a wide range of topics, from implementing secure password resets to critical security measures for handling file uploads—an area directly relevant to Packetly.

While essential in many applications, file uploads can be a gateway for significant security risks if mishandled. These risks include the distribution of malware, server-side attacks, and unauthorised data access. It's crucial to be aware of these potential dangers and take the necessary precautions.

Essential Security Checks for File Uploads

To ensure safe and secure file handling, developers should implement a series of rigorous checks when processing uploaded files:

1. Restrict Allowed File Extensions

  • Only permit file types that are explicitly required (e.g., .jpg, .png, .pdf).
  • Maintain an allowlist rather than a blocklist, as attackers can easily bypass a blocklist by changing file extensions.

2. Set File Size Limits

  • Define maximum file sizes to prevent denial-of-service (DoS) attacks and excessive resource usage.
  • Ensure server-side enforcement in addition to any client-side validation.

3. Sanitize and Validate File Names

  • Restrict filename length to avoid buffer overflow vulnerabilities.
  • Remove or escape special characters (../, \, %, :) to prevent path traversal attacks.
  • Normalise file names to prevent encoding tricks used to bypass security checks.

4. Verify File MIME Type

  • Don’t rely solely on file extensions—check the MIME type to confirm file content matches its extension.
  • Use server-side validation tools.

5. Scan for Malware & Threats

  • Consider integrating an API like Packetly to scan for viruses and inappropriate material.

6. Restrict Upload Locations & Storage

  • Store uploaded files outside the web root to prevent direct access via URL.
  • Use secure storage solutions like S3 with properly configured access controls.

7. Use Strong Access Controls

  • Ensure only authenticated and authorised users can upload files.
  • Implement temporary access tokens for secure file retrieval.

8. Prevent Direct Execution of Files

  • Restrict execution permissions for uploaded files to prevent server-side execution of malicious scripts.
  • Convert uploaded files to a secure format (e.g., sanitising PDFs) when applicable.

Conclusion: Compliance & Security – Why It Matters

Securing file uploads isn’t just about protecting your application from attacks—it’s also a compliance requirement for many businesses. Proper security controls are essential for meeting regulatory and industry standards if your company handles user-generated content, sensitive documents, or file uploads.

Proper file upload security is critical to compliance for organisations pursuing ISO 27001 or SOC 2 certification. Both standards emphasise data integrity, access controls, and risk mitigation, meaning organisations must demonstrate that their systems can handle uploads safely and prevent malicious files from compromising their infrastructure.

By following OWASP best practices and integrating automated file scanning solutions like Packetly, businesses can ensure:

  • Compliance with security frameworks (ISO 27001, SOC 2, GDPR, HIPAA)
  • Reduced risk of malware and data breaches
  • Protection against unauthorised access and execution of files
  • Stronger customer trust and security posture

Implementing a secure file upload strategy isn’t just best practice—it’s necessary for achieving and maintaining security compliance. Don’t let file uploads become a weak point in your security architecture—proactively scan, validate, and restrict uploaded files to keep your business and users safe.