High severityJavaScript / TypeScriptSSRF & Path TraversalHIGH confidence
Path Traversal Tainted Input
Untrusted request data flows into a filesystem path, enabling path traversal (../) and arbitrary file access.
Standards mapping
- OWASP Top 10
- A01:2021 - Broken Access Control
- OWASP ASVS
- V12.3.1 (L1)
Vulnerable vs. safe
Flagged by this check
fs.readFile(req.query.file, "utf8", cb);Passes - the safe pattern
fs.readFile(path.basename(req.query.file), "utf8", cb);Why it matters & how to fix it
Untrusted request data flows into a filesystem path, enabling path traversal (../) and arbitrary file access. Resolve the path and confirm it stays within an intended base directory, and strip to path.basename() where only a filename is expected.
References
Rule ID integsec-js-path-traversal-taint - 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 TraversalSSRF Outbound Request Tainted Input
- Python - SSRF & Path TraversalPath Traversal
- Python - SSRF & Path TraversalSSRF HTTP Request
- Java - SSRF & Path TraversalPath Traversal Tainted Input
- Java - SSRF & Path TraversalSSRF Tainted Input