Summary
A path traversal vulnerability in InvoicePlane's Guest module get_file handler allows attackers to manipulate the requested filename to escape the intended directory and read arbitrary files on the server.
When exploited, unauthenticated users may access sensitive files such as configuration data and database credentials simply by crafting malicious file paths.
Affected context
This vulnerability occurs in InvoicePlane installations that expose the Guest-facing file download endpoint (the get_file method of the Get controller).
The issue manifests when user-supplied filenames are used to locate files on disk without normalizing or strictly validating the path against an expected base directory.
Any deployment reachable over a network where the Guest interface is accessible to unauthenticated users can be affected, particularly when configuration or credential files are stored on the same filesystem.
Exploit preconditions
- Attack surface: Public web interface, specifically the Guest module's file retrieval endpoint.
- Required access: No authentication required; attacker only needs HTTP access to the affected route.
- Trigger point: Supplying a crafted filename parameter (e.g., using directory traversal sequences) to the
get_filemethod. - Why exploitation is possible: The server-side logic treats the user-controlled filename as a trusted filesystem path, failing to canonicalize, constrain, or validate it against a strict directory whitelist before accessing the file.
Why this happens
The root cause is improper handling of user-controlled path input in the file retrieval logic.
The get_file method in the Guest controller constructs a filesystem path directly from a request parameter without enforcing that the resulting path stays within an allowed directory.
This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where path traversal sequences (such as ../) or absolute paths allow attackers to break out of the intended directory and read arbitrary files.
Insecure patterns include string concatenation for paths, absence of canonical path checks, and lack of enforcement of a fixed document root for downloadable resources.
Potential impact
- Disclosure of configuration files that may contain database credentials or API keys.
- Exposure of application logs that could reveal stack traces, internal paths, or other sensitive operational data.
- Access to source code files, increasing the likelihood of discovering additional vulnerabilities.
- Leakage of environment-specific secrets or deployment metadata stored on the same server.
- Potential pivot to further compromise (e.g., using exposed credentials to access databases or other services).
General mitigation guidance
Effective mitigation centers on treating file paths as sensitive and tightly constraining where the application can read from:
- Resolve and canonicalize any user-supplied path and enforce that it resides within a predefined base directory (e.g., a dedicated uploads or documents directory).
- Avoid constructing filesystem paths via naive string concatenation; instead use framework or language-standard path utilities that respect directory boundaries.
- Implement an allowlist of valid file identifiers (e.g., IDs or tokens mapped to stored filenames) instead of exposing raw filenames to clients.
- Store configuration files, credentials, and environment secrets outside of web-accessible directories and segregate them from user-controlled file storage areas.
- Apply the principle of least privilege to the web server and application process so they can only read directories that are strictly necessary for operation.
How teams detect issues like this
Detection typically involves a combination of code inspection and behavioral monitoring:
- Static analysis: Flag code paths where request parameters are concatenated into file paths without canonicalization or directory checks; pattern-match on uses of filesystem APIs that take user input directly.
- Code review: Look for controllers or endpoints that serve downloads or read files using user-controlled inputs, verifying they enforce base-directory restrictions and avoid relative path traversal.
- Security testing: Use dynamic analysis or automated scanners to probe file download endpoints with traversal patterns and observe whether unexpected files (config, /etc/ files, or application sources) are accessible.
- Logging and monitoring: Monitor access logs for suspicious filename patterns (e.g., sequences of
../, URL-encoded traversal, or requests for sensitive known filenames) and treat them as indicators of probing or active exploitation.

