/

CVE-2026-50006

Severity:

CRITICAL RISK

(9.1)

Path Traversal (CWE-22) in Anyquery MySQL-Compatible Server

CVE-2026-50006

Deferred

Vulnerability type

Category:

Path Traversal and Arbitrary File Write

CWE:

CWE-22, CWE-73, CWE-284, CWE-434, CWE-862

Impact:

Remote Arbitrary File Creation or Overwrite

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Anyquery versions before 0.4.5 allow unauthenticated SQL submitted through the MySQL-compatible server port to direct SQLite's ATTACH DATABASE operation to arbitrary writable filesystem paths. A remote attacker may create or overwrite files with attacker-controlled database content, causing filesystem integrity loss or denial of service; remote code execution is conditional on another service interpreting the file or on access to a suitably privileged target.

Affected context

The issue occurs in Anyquery deployments that expose the MySQL-compatible server port and forward unauthenticated SQL to SQLite without restricting filesystem targets used by database attachment operations. Risk depends on the permissions of the Anyquery server process, the files and directories it can write, and whether other services consume files in those locations.

Exploit preconditions

  • Attack surface: Anyquery's network-accessible MySQL-compatible server port
  • Required access: Network reachability; authentication is not required by the affected interface
  • Trigger point: SQLite database attachment through SQL handled by the Anyquery server
  • Filesystem condition: The Anyquery process must have write permission to the selected target path
  • Why exploitation is possible: User-controlled SQL can influence a filesystem destination without an effective allowlist or confinement policy

Why this happens

The underlying bug is insufficient restriction of filesystem paths accepted by SQLite database attachment functionality. Unauthenticated SQL is treated as trusted database control input, allowing a remote party to select writable locations outside the intended data directory and populate resulting files with controlled content. This behavior aligns primarily with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related weaknesses involving externally controlled filenames and missing authorization checks.

Potential impact

  • Arbitrary files may be created in locations writable by the Anyquery process.
  • Existing writable files may be overwritten or corrupted.
  • Filesystem integrity may be lost.
  • The Anyquery host or service may experience denial of service.
  • Other applications may consume attacker-controlled files.
  • Remote code execution could occur if a written file is interpreted by another service or reaches a suitably privileged execution path.

General mitigation guidance

Mitigation generally focuses on removing unauthenticated database access and constraining all database-related filesystem operations.

Common defensive patterns include:

  • Require authentication and authorization before accepting SQL over network interfaces.
  • Disable or restrict database attachment functionality when it is not required.
  • Resolve and validate paths against a dedicated, non-sensitive data directory.
  • Apply canonicalization, allowlists, and filesystem sandboxing rather than trusting client-supplied paths.
  • Run Anyquery with a dedicated least-privilege account and minimal write permissions.
  • Separate service data from directories consumed by interpreters, loaders, or other privileged services.
  • Use read-only mounts and operating-system confinement controls where feasible.

How teams detect issues like this

Detection can combine application, host, and source analysis:

  • Monitor unauthenticated connections and unusual SQL activity on the MySQL-compatible port.
  • Alert on database files or unexpected file types appearing outside approved Anyquery data directories.
  • Review file creation and overwrite events performed by the Anyquery service account.
  • Use static analysis and code review rules to identify unrestricted database attachment APIs, client-controlled paths, and missing authorization checks.
  • Enforce policies that prohibit network-exposed unauthenticated SQL services and writes to sensitive or service-consumed directories.
  • Neutral automated security review tools may help identify path-handling and authorization gaps during development.

Sources

SourceLink
github.comgithub.com/julien040/anyquery/commit/27f84fc168310455eaf81ec4ba87eed20298670c
github.comgithub.com/julien040/anyquery/releases/tag/0.4.5
github.comgithub.com/julien040/anyquery/security/advisories/GHSA-xrcf-6jh3-ggvx

Frequently asked

questions

Yes, when the MySQL-compatible server port is network-reachable and accepts unauthenticated SQL. The practical impact remains limited by the filesystem permissions of the Anyquery process.

The attacker generally needs network access to the affected server port. No valid application credentials are required when the interface is configured as described.

Require authentication and authorization for SQL access, restrict or disable attachment operations, and confine all writable database paths to a dedicated approved directory.

Not necessarily. The primary effect is arbitrary file creation or overwrite. Code execution could occur only if another service interprets the written file or if the process can write to a target that enables execution.

Treat client-controlled SQL and paths as untrusted, enforce path allowlists and canonicalization, apply least privilege, and monitor service-account writes outside approved storage locations.

Find out what's already
exploitable in your codebase.