Skip to content

In-depth lesson · Path traversal

Typical fixes

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

Back to the lesson 1 to 50 of 98
  1. Resolve the final path and confirm it stays inside the intended directory before any read, write or delete.

    Seen in 91 reports
  2. Reject archive entries whose names contain traversal sequences or absolute paths before extraction.

    Seen in 19 reports
  3. Detect symlink entries correctly and check the resolved target stays inside the extraction directory before writing or deleting.

    Seen in 19 reports
  4. Validate that each archive entry path resolves inside the intended extraction directory before writing.

    Seen in 17 reports
  5. Use an allow-list of permitted modules or files instead of passing request values into includes.

    Seen in 16 reports
  6. Improve handling and validation of symbolic links before file operations and during restore.

    Seen in 8 reports
  7. Resolve symlinks and verify the real path stays within the served or shared directory.

    Seen in 6 reports
  8. Validate that deletion paths and glob patterns only match files inside the managed directory.

    Seen in 6 reports
  9. Do not store credentials in cleartext on the server.

    Seen in 5 reports
  10. Sanitise client-supplied filenames and reject absolute paths before building the save path.

    Seen in 5 reports
  11. Normalise paths fully, including drive names, internal dots and alternate data stream suffixes, before validation.

    Seen in 4 reports
  12. Add improved path validation in components that handle paths from apps or archives.

    Seen in 4 reports
  13. Properly validate and restrict file paths in search, error reporting, DNS and compressed folder handling.

    Seen in 4 reports
  14. Validate archive entry names for parent segments and absolute paths, and handle both slash styles, before extracting.

    Seen in 4 reports
  15. Reject null bytes and normalise paths rather than deleting traversal substrings in a single pass.

    Seen in 3 reports
  16. Treat both forward and backslashes as separators when checking for traversal, and handle drive-relative paths correctly.

    Seen in 3 reports
  17. Route every file system function through the shared path validation helper and keep a reference to the original resolve function.

    Seen in 3 reports
  18. Disable the at-file expansion feature in the CLI argument parser.

    Seen in 3 reports
  19. Apply the same traversal checks to the URI fragment as to the query string.

    Seen in 3 reports
  20. Sanitise metadata used to build output filenames and reject traversal sequences.

    Seen in 3 reports
  21. Validate entry paths in archives before extraction, including when alternate data streams are present.

    Seen in 3 reports
  22. Do not expose development servers to the network, and match deny lists against normalised paths on all platforms.

    Seen in 3 reports
  23. Normalise attachment filenames and check the final path stays inside the user's save folder.

    Seen in 3 reports
  24. Decode before running the path safety check, or normalise and re-check after decoding.

    Seen in 3 reports
  25. Take the dispatch path from the real request URL rather than from attacker-settable headers.

    Seen in 2 reports
  26. Anchor the symlink name check to the end of the string and purge upload directories when a project is deleted.

    Seen in 2 reports
  27. Sanitise traversal sequences in file names and match extensions exactly without trailing whitespace.

    Seen in 2 reports
  28. Properly escape rewrite substitution output when it uses backreferences or variables.

    Seen in 2 reports
  29. Encode user-controlled path segments when building backend request paths in the front end.

    Seen in 2 reports
  30. Improve validation of file paths to keep apps within their sandbox.

    Seen in 2 reports
  31. Normalise and decode request paths once, then check them against the web root.

    Seen in 2 reports
  32. Run every template candidate through the same path-safety check and restrict it to the active theme directories.

    Seen in 2 reports
  33. Normalise and validate paths before use so they cannot escape the intended directory or the trust check.

    Seen in 2 reports
  34. Validate paths taken from RichMedia annotations and portfolio metadata before file operations.

    Seen in 2 reports
  35. Check that paths from model files stay inside the expected directory.

    Seen in 2 reports
  36. Sanitise entry filenames before joining them to the extraction path.

    Seen in 2 reports
  37. Check for parent-directory components after decoding the server-supplied filename.

    Seen in 2 reports
  38. Control user-supplied file names and paths so writes stay inside the intended directory.

    Seen in 2 reports
  39. Normalise and confine user-supplied pathnames to the intended directory.

    Seen in 2 reports
  40. Fix the guard so it compares against the intended base rather than itself, and check after decoding.

    Seen in 2 reports
  41. Normalise and decode request paths consistently in the proxy and the backend so traversal cannot slip between them.

    Seen in 2 reports
  42. Run the ignore check on the same decoded path that is used to serve the file.

    Seen in 1 report
  43. Compare paths with a trailing directory separator rather than a plain string prefix.

    Seen in 1 report
  44. Perform the nonce check before the vulnerable file operation.

    Seen in 1 report
  45. Do not include file contents in error messages returned to users.

    Seen in 1 report
  46. Compare URL schemes case-insensitively when blocking dangerous schemes.

    Seen in 1 report
  47. Re-validate the cache key after variable expansion rather than before.

    Seen in 1 report
  48. Check that file paths in a crash report intent belong to actual crash dumps before deleting them.

    Seen in 1 report
  49. Reject hard links in untrusted archives that point outside the extraction directory.

    Seen in 1 report
  50. Make the location path and alias path trailing slashes consistent.

    Seen in 1 report