Summary
A path traversal vulnerability in gpt-crawler allows unauthenticated attackers to control the destination used for crawl output files. By supplying an absolute path or parent-directory segments, an attacker may overwrite files with content retrieved from attacker-controlled URLs.
Affected context
The vulnerability occurs in gpt-crawler deployments using the POST /crawl endpoint through version 1.5.1. It becomes risky when the endpoint accepts the outputFileName parameter without constraining it to an intended output directory, resolving canonical paths, or enforcing an allowlisted filename policy.
Exploit preconditions
- Attack surface: The POST /crawl HTTP endpoint
- Required access: No authentication is required when the endpoint is reachable
- Trigger point: Processing the attacker-controlled outputFileName parameter during a crawl request
- Why exploitation is possible: The application does not adequately distinguish safe relative output names from absolute paths or parent-directory traversal references, allowing writes outside the intended directory
Why this happens
The underlying bug is improper limitation of a user-controlled filesystem path, mapping to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
The application uses outputFileName as a destination without consistently enforcing directory boundaries and safe path semantics. When path input is trusted before canonicalization and policy validation, filesystem operations may target locations outside the intended output area.
Potential impact
- An attacker may overwrite existing application or configuration files
- The service may experience denial of service or corrupted runtime state
- Sensitive files could be damaged, depending on process permissions
- Overwritten files could influence application behavior or downstream jobs
- The vulnerability could contribute to code execution if a writable file is later interpreted as executable configuration or code
General mitigation guidance
Mitigation generally focuses on treating outputFileName as an untrusted identifier rather than a filesystem path.
Common defensive patterns include:
- Restricting writes to a dedicated, non-sensitive output directory
- Rejecting absolute paths, parent-directory traversal, separators, and platform-specific path forms where they are not required
- Canonicalizing paths before authorization and verifying that the resolved destination remains within the permitted directory
- Prefering server-generated filenames or opaque object identifiers over client-selected paths
- Enforcing strict input schemas and allowlists for permitted filename characters
- Running the service with the minimum filesystem permissions needed for crawling
- Separating downloaded content from executable, configuration, and application directories
- Applying storage isolation and monitoring write operations involving sensitive locations
How teams detect issues like this
Organizations can detect this vulnerability class through:
- Static analysis rules for filesystem writes that use request parameters or other untrusted input
- Code review checks for missing canonicalization, directory-boundary validation, and filename allowlists
- API tests covering absolute paths, parent-directory references, encoded separators, and platform-specific path syntax
- Runtime monitoring for unexpected writes outside designated storage directories
- Policy enforcement requiring service accounts and containers to use restricted, non-sensitive filesystems
- Automated security review tools that identify path construction from HTTP request data

