security
security_error
ai_generated
true
Security: Path traversal attempt detected: ../../../etc/passwd
ID: security/path-traversal-dotdot
88%Fix Rate
87%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
Path traversal via ../ sequences allows reading files outside intended directory.
genericWorkarounds
-
92% success Resolve path and verify it starts with allowed base directory
realpath = os.path.realpath(path); assert realpath.startswith(BASE_DIR)
-
90% success Use allowlist of valid filenames instead of accepting arbitrary paths
Map user input to predefined file identifiers
Dead Ends
Common approaches that don't work:
-
Block literal ../ string only
85% fail
Attackers use URL encoding (%2e%2e%2f), double encoding, or OS-specific separators.
-
Use regex blacklist for dangerous paths
80% fail
Blacklists are always incomplete - new bypass techniques emerge regularly.