Request To File Access
Untrusted request input flows into a filesystem path, enabling path traversal (CWE-22) that can read or overwrite files outside the intended directory via '../' sequences.
Standards mapping
- OWASP Top 10
- A01:2021 - Broken Access Control
- OWASP ASVS
- V12.3.1 (L1)
Vulnerable vs. safe
var text = File.ReadAllText("/data/" + name);var text = File.ReadAllText(Path.Combine("/data", safe));Why it matters & how to fix it
Untrusted request input flows into a filesystem path, enabling path traversal (CWE-22) that can read or overwrite files outside the intended directory via '../' sequences. Do not pass user input to Path.Combine or File APIs directly: map to a safe identifier, then canonicalize with Path.GetFullPath and verify the result stays under an allowed base directory.
References
Rule ID integsec.csharp.pathtraversal.request-to-file-access - 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 TraversalPath Traversal
- Python - SSRF & Path TraversalSSRF HTTP Request
- Java - SSRF & Path TraversalPath Traversal Tainted Input