Summary
A path traversal vulnerability in Cast LocalVideo allows unauthenticated remote attackers to read arbitrary files from the server. The issue becomes risky when attacker-controlled path values are passed to file-serving functionality without normalization or access restrictions.
Affected context
The vulnerability occurs in the application's file-serving handler when the user-supplied req.body.dir parameter is passed directly to res.sendFile().
Deployments may be affected when this endpoint is remotely reachable, does not require authentication, and lacks canonicalization or validation of requested paths. Absolute paths and traversal sequences such as ../ can allow requests to escape the intended directory.
Exploit preconditions
- Attack surface: Remotely accessible file-serving endpoint
- Required access: No authentication may be required
- Attacker-controlled input: The
req.body.dirrequest parameter - Trigger point: Construction of the path passed to
res.sendFile() - Why exploitation is possible: The handler accepts path values without sufficient sanitization, allowing traversal outside the intended directory
Why this happens
The underlying bug is improper limitation of a user-controlled pathname before it is used for file access. Passing the request value directly to a file-serving API permits absolute paths or parent-directory components to influence the resolved filesystem location.
This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly called path traversal. The insecure pattern is trusting externally supplied paths without canonicalization, containment checks, and enforcement of an approved base directory.
Potential impact
- An attacker may read sensitive application files
- Server configuration, credentials, or environment data could be disclosed
- Source code and internal deployment information may be exposed
- Disclosed secrets could enable follow-on compromise of connected systems
- Privacy, integrity, and availability may be affected indirectly
General mitigation guidance
Mitigation generally focuses on removing direct trust in client-supplied filesystem paths.
Common defensive patterns include:
- Resolve requested paths against a fixed, approved base directory
- Canonicalize paths before checking containment
- Reject absolute paths, traversal components, and unexpected encodings
- Prefer opaque file identifiers or an allowlisted mapping over raw path input
- Apply authentication and authorization where file access is not intended to be public
- Run the service with least-privilege filesystem permissions
- Avoid exposing sensitive directories through static or dynamic file-serving handlers
How teams detect issues like this
Organizations can detect path traversal risks through:
- Static analysis rules for user input flowing into filesystem APIs such as
sendFile,readFile, or equivalent functions - Code review checks for raw request parameters used in path construction
- Tests covering absolute paths, parent-directory segments, encoded traversal, and symlink behavior
- Runtime monitoring for repeated requests containing traversal indicators or unexpected filesystem targets
- Policy enforcement requiring canonicalization and base-directory containment before file access
- Automated security review tools that identify tainted data flows into file APIs

