Medium severityJavaScript / TypeScriptSSRF & Path TraversalMEDIUM confidence
Path Join With Request
path.join()/path.resolve() combines a base directory with request-derived input; without validation this permits path traversal.
Standards mapping
- OWASP Top 10
- A01:2021 - Broken Access Control
- OWASP ASVS
- V12.3.1 (L1)
Vulnerable vs. safe
Flagged by this check
const filePath = path.join(__dirname, "uploads", req.params.file);Passes - the safe pattern
const staticPath = path.join(__dirname, "public", "index.html");Why it matters & how to fix it
path.join()/path.resolve() combines a base directory with request-derived input; without validation this permits path traversal. Normalize the result and verify it is still prefixed by the intended base directory.
References
Rule ID integsec-js-path-join-with-request - 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 Traversal Tainted Input
- 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