Summary
DeepWiki-Open contains an arbitrary file read vulnerability in its unauthenticated /ws/chat WebSocket endpoint. Because repo_url can be interpreted as an unrestricted filesystem path, an attacker may read files with supported extensions, including source code, configuration data, secrets, and credentials.
Affected context
The vulnerability occurs in deployments exposing the /ws/chat WebSocket endpoint without authentication or equivalent access controls. It becomes risky when the endpoint accepts attacker-controlled repository or filesystem path values, resolves them on the server, and lacks containment within an approved repository or workspace directory.
Exploit preconditions
- Attack surface: The unauthenticated
/ws/chatWebSocket endpoint - Required access: Network access to the exposed endpoint; no authentication may be required
- Trigger point: Processing a client-supplied
repo_urlvalue as a filesystem path - Why exploitation is possible: The path is not reliably confined to an intended repository or workspace, allowing access to readable files with supported extensions
Why this happens
The underlying bug is external control over a file name or path without sufficient validation and containment. The application treats a client-controlled repo_url as a server-side filesystem location and can read files outside the intended repository boundary. This maps to CWE-73: External Control of File Name or Path, with the resulting behavior resembling path traversal and arbitrary file disclosure.
Potential impact
- Attackers may read application source code and internal configuration
- Exposed files could contain hardcoded credentials, API keys, or other secrets
- Disclosure may enable follow-on access to databases, cloud services, or internal systems
- Sensitive repository and deployment information could be used to support further attacks
General mitigation guidance
Mitigation generally focuses on reducing trust in client-supplied paths and enforcing a narrow filesystem boundary.
Common defensive patterns include:
- Resolve requested paths against a fixed, approved workspace and verify that the canonical result remains within that boundary
- Prefer repository identifiers or server-managed handles over raw filesystem paths
- Apply strict allowlists for repositories, directories, and file types without treating extensions as a substitute for containment
- Run the service with least-privilege filesystem permissions and separate sensitive files from its runtime workspace
- Require authentication and authorization before exposing repository or file-reading functionality
- Avoid returning unnecessary file contents and apply appropriate response-size and rate limits
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis rules for filesystem APIs receiving values derived from WebSocket, HTTP, or other client input
- Code review checks for missing canonicalization, prefix validation, or workspace-boundary enforcement
- Runtime monitoring for unusual file-read requests, access to paths outside approved roots, and repeated enumeration of supported extensions
- Policy enforcement requiring authentication and authorization for repository inspection endpoints
- Automated security testing that supplies out-of-bound path values and verifies that only approved workspace content is accessible

