Summary
Anyquery server versions before 0.4.5 expose file-backed SQLite virtual table modules through the unauthenticated MySQL-compatible server port. A remote attacker may use these modules to read files accessible to the Anyquery process when network access to the server is available.
Affected context
The issue occurs in Anyquery deployments where the MySQL-compatible server port is reachable and file-backed SQLite virtual table modules, such as csv_reader or log_reader, are exposed without authentication, authorization, or directory restrictions. The risk is higher when the server process can access sensitive operating-system files, application configuration, credentials, or private keys.
Exploit preconditions
- Attack surface: Anyquery's MySQL-compatible server port
- Required access: Network connectivity to the exposed port; authentication may not be required
- Trigger point: Processing SQL statements that create file-backed SQLite virtual tables
- Why exploitation is possible: User-controlled paths are passed to file-reading modules without sufficient authorization or directory-boundary enforcement
Why this happens
The vulnerability results from exposing file-backed virtual table modules through an unauthenticated SQL interface while allowing the requested file location to be selected by the client. This behavior maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related aspects of CWE-73: External Control of File Name or Path. The server treats attacker-influenced paths as trusted input and reads files using the permissions of its own process.
Potential impact
- Sensitive system or application configuration may be disclosed
- Credentials, tokens, or private keys could be exposed
- Database contents or operational logs may become readable
- Information disclosure could support follow-on attacks
- The confidentiality of files accessible to the server process may be reduced
General mitigation guidance
Mitigation generally focuses on reducing the file-reading capability exposed through network interfaces and enforcing strong trust boundaries around paths.
Common defensive patterns include:
- Requiring authentication and authorization before accepting SQL requests
- Disabling file-backed virtual table modules when they are not required
- Restricting readable paths to a dedicated, non-sensitive directory
- Canonicalizing and validating paths against an explicit allowlist
- Running the server with a least-privilege service account
- Isolating sensitive credentials and private keys from the service filesystem
- Limiting network exposure to trusted clients or protected network segments
- Applying secure-by-default configuration for server listeners and extensions
How teams detect issues like this
Organizations can identify this class of issue through:
- Static analysis for user-controlled paths passed to file or virtual table APIs
- Code review checks for unauthenticated database interfaces and unrestricted file modules
- Configuration audits for exposed MySQL-compatible ports and enabled file readers
- Policy enforcement requiring authentication, path allowlists, and least-privilege service accounts
- Runtime monitoring for unusual virtual table creation or reads of sensitive filesystem locations
- Automated security review tools that flag external path control and missing authorization checks

