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.
-
Resolve the final path and confirm it stays inside the intended directory before any read, write or delete.
Seen in 91 reports
-
Reject archive entries whose names contain traversal sequences or absolute paths before extraction.
Seen in 19 reports
-
Detect symlink entries correctly and check the resolved target stays inside the extraction directory before writing or deleting.
Seen in 19 reports
-
Validate that each archive entry path resolves inside the intended extraction directory before writing.
Seen in 17 reports
-
Use an allow-list of permitted modules or files instead of passing request values into includes.
Seen in 16 reports
-
Improve handling and validation of symbolic links before file operations and during restore.
Seen in 8 reports
-
Resolve symlinks and verify the real path stays within the served or shared directory.
Seen in 6 reports
-
Validate that deletion paths and glob patterns only match files inside the managed directory.
Seen in 6 reports
-
Do not store credentials in cleartext on the server.
Seen in 5 reports
-
Sanitise client-supplied filenames and reject absolute paths before building the save path.
Seen in 5 reports
-
Normalise paths fully, including drive names, internal dots and alternate data stream suffixes, before validation.
Seen in 4 reports
-
Add improved path validation in components that handle paths from apps or archives.
Seen in 4 reports
-
Properly validate and restrict file paths in search, error reporting, DNS and compressed folder handling.
Seen in 4 reports
-
Validate archive entry names for parent segments and absolute paths, and handle both slash styles, before extracting.
Seen in 4 reports
-
Reject null bytes and normalise paths rather than deleting traversal substrings in a single pass.
Seen in 3 reports
-
Treat both forward and backslashes as separators when checking for traversal, and handle drive-relative paths correctly.
Seen in 3 reports
-
Route every file system function through the shared path validation helper and keep a reference to the original resolve function.
Seen in 3 reports
-
Disable the at-file expansion feature in the CLI argument parser.
Seen in 3 reports
-
Apply the same traversal checks to the URI fragment as to the query string.
Seen in 3 reports
-
Sanitise metadata used to build output filenames and reject traversal sequences.
Seen in 3 reports
-
Validate entry paths in archives before extraction, including when alternate data streams are present.
Seen in 3 reports
-
Do not expose development servers to the network, and match deny lists against normalised paths on all platforms.
Seen in 3 reports
-
Normalise attachment filenames and check the final path stays inside the user's save folder.
Seen in 3 reports
-
Decode before running the path safety check, or normalise and re-check after decoding.
Seen in 3 reports
-
Take the dispatch path from the real request URL rather than from attacker-settable headers.
-
Anchor the symlink name check to the end of the string and purge upload directories when a project is deleted.
-
Sanitise traversal sequences in file names and match extensions exactly without trailing whitespace.
-
Properly escape rewrite substitution output when it uses backreferences or variables.
-
Encode user-controlled path segments when building backend request paths in the front end.
-
Improve validation of file paths to keep apps within their sandbox.
-
Normalise and decode request paths once, then check them against the web root.
-
Run every template candidate through the same path-safety check and restrict it to the active theme directories.
-
Normalise and validate paths before use so they cannot escape the intended directory or the trust check.
-
Validate paths taken from RichMedia annotations and portfolio metadata before file operations.
-
Check that paths from model files stay inside the expected directory.
-
Sanitise entry filenames before joining them to the extraction path.
-
Check for parent-directory components after decoding the server-supplied filename.
-
Control user-supplied file names and paths so writes stay inside the intended directory.
-
Normalise and confine user-supplied pathnames to the intended directory.
Seen in 2 reports
-
Fix the guard so it compares against the intended base rather than itself, and check after decoding.
-
Normalise and decode request paths consistently in the proxy and the backend so traversal cannot slip between them.
-
Run the ignore check on the same decoded path that is used to serve the file.
Seen in 1 report
-
Compare paths with a trailing directory separator rather than a plain string prefix.
Seen in 1 report
-
Perform the nonce check before the vulnerable file operation.
Seen in 1 report
-
Do not include file contents in error messages returned to users.
Seen in 1 report
-
Compare URL schemes case-insensitively when blocking dangerous schemes.
Seen in 1 report
-
Re-validate the cache key after variable expansion rather than before.
Seen in 1 report
-
Check that file paths in a crash report intent belong to actual crash dumps before deleting them.
Seen in 1 report
-
Reject hard links in untrusted archives that point outside the extraction directory.
-
Make the location path and alias path trailing slashes consistent.
Seen in 1 report