SiteShadow
Back to vulnerability library

CWE-36 Absolute Path Traversal

What this means

SiteShadow flagged code where untrusted input can influence an absolute file path (e.g., /etc/passwd, C:\Windows\...) rather than being constrained to an expected directory.

Why it matters

Absolute path access can expose sensitive files or system data.

Safer examples

1) Reject absolute paths outright

If an input should be a filename, reject values that are absolute paths.

2) Enforce a base directory (normalize + check)

from pathlib import Path

base = Path("/srv/uploads").resolve()
candidate = (base / filename).resolve()
if base not in candidate.parents:
    raise ValueError("Invalid path")

3) Prefer IDs over paths

Accept a file ID and map it to a server-known path.

How SiteShadow detects it (high level)

References

---

← Back to Vulnerability Library

Request access View coverage