High severityPythonSSRF & Path TraversalMEDIUM confidence
Path Traversal
A user-controlled value is used to build a filesystem path, enabling path traversal (CWE-22).
Standards mapping
- OWASP Top 10
- A01:2021 - Broken Access Control
- OWASP ASVS
- V12.3.1 (L1)
Vulnerable vs. safe
Flagged by this check
return open(filename).read()Passes - the safe pattern
return open(secure_filename(filename)).read()Why it matters & how to fix it
A user-controlled value is used to build a filesystem path, enabling path traversal (CWE-22). Canonicalize the resolved path and confirm it stays within an intended base directory (e.g. os.path.realpath + startswith, or Path.resolve().is_relative_to(base)); reject '..' and absolute paths.
References
Rule ID integsec-python-path-traversal - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - SSRF & Path TraversalPath Join With Request
- JavaScript / TypeScript - SSRF & Path TraversalPath Traversal Tainted Input
- JavaScript / TypeScript - SSRF & Path TraversalSSRF Outbound Request Tainted Input
- Python - SSRF & Path TraversalSSRF HTTP Request
- Java - SSRF & Path TraversalPath Traversal Tainted Input
- Java - SSRF & Path TraversalSSRF Tainted Input