Skip to content

In-depth lesson · File upload

Root causes

Every point the File upload reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 24 of 24
  1. A privileged service wrote its log into a user-writable directory without checking for reparse points, so a symlink redirected the write.

    Seen in 2 reports
  2. The upload checked only the declared content type and not the real content or extension, so executable class files were stored and served.

    Seen in 1 report
  3. An unauthenticated endpoint took the filename and extension from the request without validation, allowing traversal and arbitrary writes.

    Seen in 1 report
  4. Attachments were stored in a shared bucket under a key based only on the original filename, with no per-user prefix, so a later upload replaced the earlier object.

    Seen in 1 report
  5. The profile picture upload did not validate file type, so a script file disguised as an image was saved and executed.

    Seen in 1 report
  6. The remote avatar URL path skipped the file type checks that the direct upload path applied.

    Seen in 1 report
  7. The extension check could be defeated by a trailing space and the upload directory executed server-side scripts.

    Seen in 1 report
  8. The handler only looked at the filename extension and did not stop uploaded files being served as active content.

    Seen in 1 report
  9. The server did not validate type or extension and served uploaded files with a content type that allowed HTML execution.

    Seen in 1 report
  10. The snippet feature did not enforce that the displayed file type matched the actual content.

    Seen in 1 report
  11. The option-parsing check only rejected one ordering of the flags and the header-writing path could rename over an existing file without the usual existence check.

    Seen in 1 report
  12. The application did not escape double quotes in the filename before inserting it into the Content-Disposition header.

    Seen in 1 report
  13. The web server was misconfigured to allow unauthenticated PUT requests, enabling arbitrary file writes.

    Seen in 1 report
  14. The server relied only on a client-side JavaScript check for allowed file types.

    Seen in 1 report
  15. Rails Active Storage direct upload routes were left publicly accessible, letting any authenticated user create blobs and obtain signed upload URLs.

    Seen in 1 report
  16. The validator checked the extension after the null byte while the web server used the full filename and executed the dangerous part.

    Seen in 1 report
  17. A newer version of the plantuml extension enabled a block macro processor by default, permitting arbitrary local file reads.

    Seen in 1 report
  18. The counter function set document attributes without checking whether they were locked, overriding security-sensitive settings.

    Seen in 1 report
  19. The output path from the libcurl option was passed straight to fopen with no validation.

    Seen in 1 report
  20. The file move method failed to re-check the user's original save choice against the new filename and directory.

    Seen in 1 report
  21. The save layer stripped percent patterns and then re-attached the pre-sanitisation extension, producing a double extension.

    Seen in 1 report
  22. The Vips transformer inherited a base validation that only blocked one option instead of applying the allowlist and denylist used by the ImageMagick transformer.

    Seen in 1 report
  23. The cache file was opened in write mode before validating the path, so fopen followed the symlink and truncated the target.

    Seen in 1 report
  24. The upload check trusted an image-size function that treats Flash files as valid images and served them from the same origin.

    Seen in 1 report