Summary
An unauthenticated path traversal vulnerability in jotty·page's /api/app-icons/[filename] endpoint allows attackers to read arbitrary files on the server by manipulating the filename route parameter.
Because the parameter is joined directly into a filesystem path without boundary validation, any publicly exposed instance may leak sensitive server-side files outside the intended data/uploads/app-icons/ directory.
Affected context
The issue affects self-hosted jotty·page instances that expose the /api/app-icons/[filename] route over a network and rely on it to serve application icon files from data/uploads/app-icons/.
The vulnerability is present when:
- User-supplied path segments are concatenated directly into filesystem paths, and
- There is no normalization or check that the resolved path stays under the intended
data/uploads/app-icons/directory.
Environments hosting sensitive configuration, logs, or credentials on the same filesystem are particularly at risk.
Exploit preconditions
- Attack surface: HTTP(S) interface, specifically the
/api/app-icons/[filename]endpoint. - Required access: No authentication or prior session is required; any network user who can reach the endpoint can send crafted requests.
- Trigger point: Supplying a crafted
filenamepath segment that includes directory traversal sequences or absolute/relative path tricks. - Why exploitation is possible: The server joins the
filenameparameter into a filesystem path without enforcing directory boundaries, canonicalizing paths, or rejecting traversal sequences, allowing access to files outsidedata/uploads/app-icons/.
Why this happens
This vulnerability stems from treating a user-controlled path component as a trusted filesystem path without proper validation or normalization.
The code path responsible for serving app icons:
- Takes the
filenameroute parameter directly from the HTTP request. - Uses it to construct a filesystem path under the assumption it remains inside
data/uploads/app-icons/. - Fails to enforce that the resolved path is confined to this directory.
Conceptually, this matches CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where directory traversal sequences (for example, using parent directory references) or crafted paths can escape the intended root.
Because the resulting path is then opened and returned in the HTTP response, it also maps to CWE-200: Exposure of Sensitive Information, as arbitrary readable files on the host may be disclosed.
Potential impact
- Disclosure of configuration files that may contain database credentials, API keys, or other secrets.
- Exposure of application logs that can reveal internal paths, stack traces, or user data.
- Leakage of system files (e.g., OS configuration, user account metadata) readable by the application process.
- Facilitation of further attacks, such as authentication bypass, account takeover, or command execution, using harvested secrets or internal information.
General mitigation guidance
Effective mitigation focuses on constraining how filesystem paths are derived from user input and strictly enforcing directory boundaries:
- Treat all path components derived from HTTP parameters as untrusted, even when seemingly simple (e.g., filenames).
- Normalize and canonicalize the requested path, then verify it remains within the intended base directory (such as
data/uploads/app-icons/) before access. - Maintain a fixed, server-side base directory and join only sanitized filenames (not arbitrary paths); reject inputs containing directory separators, traversal sequences, or disallowed characters.
- Consider using whitelisting strategies, such as mapping logical icon IDs to stored filenames, rather than allowing direct arbitrary filename access.
- Run the application under a dedicated, least-privileged account and limit file system permissions so that even if traversal occurs, access to sensitive OS or configuration files is restricted.
- Implement centralized helper utilities for safe path handling and reuse them across endpoints that touch the filesystem.
How teams detect issues like this
Organizations can look for directory traversal risks and unintended file exposure using multiple approaches:
- Static analysis: Configure rules to flag direct concatenation of request parameters (route segments, query strings) into filesystem operations (open, read, sendFile, etc.) without validation or canonicalization.
- Code review: Examine routes serving files from user-controlled names; verify that there is:
- A fixed base directory,
- Canonicalization of the constructed path, and
- A strict check that the resulting path resides under the base directory.
- Dynamic testing: Use web scanners or manual tests with traversal patterns (e.g., parent-directory references) against file-serving endpoints to detect unauthorized file access.
- Runtime monitoring: Inspect access logs for suspicious file requests, such as those containing traversal sequences, unusual extensions, or access to system paths, and generate alerts on such patterns.

