Summary
A path traversal vulnerability in lollms allows unauthenticated users to access files outside the intended web application directory. The issue becomes risky when encoded traversal sequences are accepted by the SPA catch-all route and later resolved as filesystem paths without containment checks.
Affected context
The vulnerability occurs in the SPA catch-all route in backend/routers/ui.py when user-controlled URL path data is joined directly with a filesystem location. Deployments may be exposed when encoded dot-dot segments bypass framework-level normalization and the resulting path is resolved by filesystem APIs without restricting it to the intended web root.
Exploit preconditions
- Attack surface: The unauthenticated SPA catch-all HTTP route
- Required access: Network access to the affected lollms web interface; no valid account may be necessary
- Trigger point: Processing a request path while locating a static or SPA resource
- Why exploitation is possible: User-controlled path components are combined with a filesystem path without sufficient sanitization, canonicalization, or containment validation
Why this happens
The underlying bug is improper validation of filesystem path input. The route treats URL-derived data as a trusted relative path, allowing encoded traversal components to survive initial request handling and be interpreted by pathlib during path resolution.
This maps to CWE-23: Relative Path Traversal, where attacker-controlled path elements can navigate outside the directory intended by the application. The insecure pattern is direct path construction from untrusted input without canonicalizing the result and verifying that it remains beneath an approved base directory.
Potential impact
- An attacker may read sensitive application or operating-system files
- Credentials, tokens, configuration values, or source code could be disclosed
- Exposed files could support further attacks against the host or connected services
- Confidentiality of data stored on the server could be reduced
General mitigation guidance
Mitigation generally focuses on reducing trust in request paths and enforcing filesystem boundaries.
Common defensive patterns include:
- Resolve candidate paths against a fixed, trusted base directory
- Verify the canonical result remains within the permitted directory before access
- Prefer an allowlist of known static resources or route identifiers over arbitrary path input
- Normalize and validate URL and filesystem representations consistently
- Reject traversal markers and encoded variants as defense-in-depth, without relying on filtering alone
- Serve static content through a component with well-defined root-directory containment
- Run the service with the least filesystem privileges required
How teams detect issues like this
Organizations can look for path traversal risks through:
- Static analysis that flags direct concatenation or joining of request paths with filesystem paths
- Code review checks for missing canonicalization and base-directory containment validation
- Tests covering encoded separators, dot segments, repeated traversal components, and alternate path representations
- Web-server monitoring for requests containing encoded traversal indicators or unusual static-resource paths
- Policy enforcement requiring approved static-file serving abstractions and security tests for file access routes
Automated code review and security scanning tools may help identify unsafe path construction patterns, but runtime testing should also verify containment behavior.

