CVE-2026-50006
Executive Summary
CVE-2026-50006 is a critical unauthenticated path traversal / arbitrary file write vulnerability in Anyquery, an SQL query engine built on top of SQLite, affecting all versions prior to 0.4.5. The Anyquery server exposes a MySQL-compatible network port that forwards SQL statements to an underlying SQLite engine without restricting the filesystem targets permitted by the SQLite ATTACH DATABASE statement. A remote, unauthenticated attacker can therefore instruct SQLite to create a database file at any path writable by the Anyquery server process and write attacker-controlled table content into that file.
With a CVSS 3.1 base score of 9.1 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H), the vulnerability is trivially network-exploitable and requires no credentials or user interaction. The direct impact is arbitrary file creation or overwrite, resulting in filesystem integrity loss and denial of service; remote code execution is possible only in secondary conditions (e.g., another service later interpreting the written file, or the process holding privileges over a sensitive writable target). No public PoC, exploit code, or Nuclei template is currently available, and the vulnerability has not been added to CISA KEV. Anyquery is commonly deployed by data/analytics engineers and automation tooling, so exposed MySQL-compatible listener ports are the primary exposure surface.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
Anyquery is described as "an SQL query engine built on top of SQLite." The vulnerable component is the anyquery server, which exposes a MySQL-compatible server port. Client SQL sent to this port is forwarded to the backing SQLite engine. Critically, and as stated in the NVD description, prior to version 0.4.5 the server does not restrict ATTACH DATABASE filesystem targets.
SQLite's ATTACH DATABASE statement is a native SQL feature that binds an additional database file on disk to the running connection under an alias. The canonical form is ATTACH DATABASE '<path>' AS <alias>;. Once attached, the connection can create tables inside the attached database and write rows into them — the create and write operations are materialized as bytes written to the file at <path> on the host filesystem. In a plain SQLite embedding, the set of permissible attach paths is a policy decision made by the embedding application. Anyquery, having exposed this power to unauthenticated remote callers, effectively delegated filesystem write authority to any network client capable of speaking the MySQL wire protocol.
The vulnerability class is CWE-22 (Improper Limitation of a Pathname to a Restricted Directory, "Path Traversal"). Here the "traversal" is not a string-manipulation bypass of a prefix check; it is the complete absence of a target allow-list combined with exposure of a file-opening primitive (ATTACH DATABASE). The write primitive is content-controlled: the attacker determines the file payload because the data written into the attached database is SQL-defined table content. Where the target path already exists and is writable, SQLite's behavior around creating/overwriting database files determines whether integrity is altered or the file is rewritten; where the path does not exist, a new SQLite database file with attacker-controlled content is created.
The attack surface is the MySQL-compatible listener socket of the anyquery server process. Exploitation requires only network reachability to that port and no authentication, consistent with PR:N in the CVSS vector. Because SQLite executes against the privileges of the Anyquery server process, the set of writable paths equals the process's effective filesystem permissions — this is the sole real constraint on the attack. The CVSS subscores reflect exactly this: Confidentiality:None (the flaw is a write, not a read primitive), Integrity:High (arbitrary attacker-chosen file content), Availability:High (overwrite/denial of service), and Scope:Unchanged (the impact remains within the security authority/privileges of the vulnerable component).
The maintainers fixed the issue in version 0.4.5, presumably by restricting or validating ATTACH DATABASE targets server-side. Given the "CLAIMED — single source" patch confidence (2/4) sourced only from OSV, defenders should verify the fix behavior against their own deployment rather than assuming coverage.
Exploitation Scenarios
No public PoC or exploit code is available for CVE-2026-50006; the chain below is inferred directly from the vulnerability class and the NVD description, without inventing endpoints, function names, or parameters not present in the source text.
Reconnaissance / target identification. The attacker scans for hosts exposing the Anyquery MySQL-compatible server port. Because the port speaks the MySQL wire protocol, standard service fingerprinting applies: an unauthenticated MySQL client handshake or a Shodan-style query for MySQL services (
port:3306, server banner greps) identifies candidate listeners. Anyquery deployments placed on internet-facing hosts or shared internal networks without port restriction are the targets.Triggering the specific flaw class. The attacker opens a MySQL-protocol connection to the Anyquery server port and issues SQL that contains an
ATTACH DATABASEstatement. No authentication is required (PR:N). The server forwards the statement to SQLite verbatim, without applying a filesystem target restriction, so the attacker's chosen path is accepted.Payload / execution at the vulnerability-class level. Having attached a database file at an attacker-selected path writable by the Anyquery server process, the attacker creates a table under that alias and inserts rows, writing attacker-controlled content into the target file on disk. The primitive is arbitrary file creation or overwrite with attacker-supplied bytes. Note that this is a file-write primitive, not direct code execution; the payload is arbitrary file content, not a shellcode invocation path described by the advisory.
Post-exploitation impact. Successful exploitation yields filesystem integrity loss: unintended files appear, legitimate files can be overwritten (causing service disruption / denial of service). Remote code execution is explicitly conditional in the description — it becomes possible only where another service later interprets the written file, or where the process has a suitably privileged writable target. Attackers would therefore (a) blunt-force availability by overwriting config or data files, (b) plant content into paths consumed by other tooling (a second-stage interpretation dependency), or (c) establish persistence via files outside the Anyquery data directory, subject to the process's effective privileges.
Impact Assessment
Business impact centers on the integrity and availability of systems running Anyquery where the MySQL-compatible server port is network-reachable. The CVSS 3.1 vector is AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H, total 9.1 — network-exploitable, low complexity, no privileges, no user interaction. The subscores map cleanly to a high-integrity/high-availability write primitive: Integrity:High reflects attacker-controlled file content; Availability:High reflects destructive overwrite and corruption of databases or operational files; Confidentiality:None reflects the absence of a read primitive in the described flaw; Scope:Unchanged reflects containment within the privileges of the vulnerable component.
Blast radius is bounded by the filesystem permissions of the Anyquery server process — every path that user can write is in scope. This includes the process working directory, its data store, and any shared volumes, mounted secrets, or configuration locations the service account can reach. Because the write content is controlled, the impact extends beyond simple disk exhaustion to silent corruption of durable data.
Secondary RCE risk is real but conditional and should not be overstated: the NVD description ties code execution to an external interpreter consuming the written file or to a suitably privileged writable target. Enterprises must therefore treat this as a critical integrity/availability vulnerability with an environment-dependent escalation path, not as unconditional RCE. EPSS is 0.00973 (60.2nd percentile) and there is no KEV listing — near-term exploitation likelihood is currently low, but the low attack complexity and lack of authentication make weaponization attractive once a public PoC appears.
Detection Guidance
Sigma Rule
title: Anyquery Server Unauthenticated ATTACH DATABASE Abuse (CVE-2026-50006)
id: 9f1c2b74-2a6e-4f0b-9c1d-5e7a8d3b6c10
status: experimental
description: Detects ATTACH DATABASE statements targeting arbitrary filesystem paths reaching the anyquery server process, consistent with CVE-2026-50006 path traversal / arbitrary file write.
references:
- https://nvd.nist.gov/vuln/detail/CVE-2026-50006
author: valtersit.com
date: 2026/01/01
logsource:
product: anyquery
service: server
detection:
selection_attach:
CommandLine|contains: 'ATTACH'
selection_db:
CommandLine|contains:
- 'DATABASE'
- 'ATTACH DATABASE'
selection_path:
CommandLine|re: '(?i)ATTACH\s+DATABASE\s+[''"]?(/|\.\.|~|[A-Za-z]:\\)'
condition: selection_attach and selection_db and selection_path
falsepositives:
- Legitimate administrative use of ATTACH DATABASE against approved paths
- Backup or migration tooling that targets fixed, allow-listed locations
level: high
tags:
- attack.t1190
- cve.2026.50006
- cwe.22
YARA Rule
rule CVE_2026_50006_Anyquery_Attach_Abuse
{
meta:
author = "valtersit.com"
description = "Detects ATTACH DATABASE abuse payloads targeting arbitrary paths (CVE-2026-50006)"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2026-50006"
cve = "CVE-2026-50006"
date = "2026-01-01"
strings:
$attach = "ATTACH" ascii nocase wide
$db = "DATABASE" ascii nocase wide
$travers = "../" ascii wide
$root = "/etc/" ascii wide
$win = "\\Windows\\" ascii wide
condition:
uint16(0) == 0x4D5A or ( $attach and $db and 1 of ($travers, $root, $win) )
}
Suricata IDS Rule
alert tcp any any -> any 3306 ( \
msg:"CVE-2026-50006 Anyquery unauthenticated ATTACH DATABASE arbitrary file write attempt"; \
flow:established,to_server; \
content:"ATTACH"; nocase; \
content:"DATABASE"; nocase; distance:0; \
pcre:"/ATTACH\s+DATABASE\s+[\x27\x22]?(\/|\.\.\/|~|[A-Za-z]:\\\\)/i"; \
reference:cve,2026-50006; \
reference:url,nvd.nist.gov/vuln/detail/CVE-2026-50006; \
classtype:attempted-admin; \
sid:202650006; rev:1; )
Elastic Detection
process where event.type == "start" and
process.name in ("anyquery", "anyquery.exe") and
process.args : "*ATTACH*"
network where network.transport == "tcp" and destination.port == 3306 and
network.direction == "inbound" and
data : "*ATTACH DATABASE*"
Splunk SPL Query
index=anyquery OR index=network sourcetype=anyquery:server OR sourcetype=suricata
| search ("ATTACH DATABASE" OR "ATTACH\tDATABASE")
| regex _raw="(?i)ATTACH\s+DATABASE\s+['\"]?(/|\.\./|~|[A-Za-z]:\\)"
| stats count min(_time) as first_seen max(_time) as last_seen
values(src_ip) as source_ips values(dest_port) as dest_ports
by dest_ip user
| where count > 0
| sort - count
Wazuh OSSEC Rule
<group name="anyquery,cve-2026-50006,">
<rule id="202650" level="12">
<decoded_as>json</decoded_as>
<field name="query">\.</field>
<match>ATTACH</match>
<regex>ATTACH\s+DATABASE\s+['"]?(/|\.\./|~|[A-Za-z]:\\)</regex>
<description>CVE-2026-50006: Anyquery unauthenticated ATTACH DATABASE arbitrary file write attempt</description>
<mitre>
<id>T1190</id>
</mitre>
<group>cve_2026_50006,path_traversal,</group>
</rule>
<rule id="202651" level="14">
<if_sid>202650</if_sid>
<match>ATTACH DATABASE</match>
<description>CVE-2026-50006: confirmed ATTACH DATABASE filesystem target abuse against Anyquery server port</description>
<mitre>
<id>T1190</id>
</mitre>
<group>cve_2026_50006,</group>
</rule>
</group>
Mitigation & Patch Guidance
Patch confidence: 2/4 (CLAIMED — single source claims patch, not independently confirmed; source: OSV).
Immediate mitigations.
- Remove Anyquery's MySQL-compatible server port from untrusted network reach. Bind the listener to loopback only where feasible, and enforce host/network firewalling so only trusted administration hosts can reach it.
- Never expose the server port to the internet. Treat it as an administrative interface, not an application API.
- Run Anyquery under a dedicated least-privilege service account with a minimal writable footprint — do not run it as root or with broad filesystem write access — to constrain the blast radius of arbitrary file writes.
- Audit existing deployments for unexplained files or modified database/config artifacts that could indicate prior exploitation.
Patch / upgrade steps.
- Upgrade Anyquery to version 0.4.5 or later, which the advisory states fixes the issue by restricting
ATTACH DATABASEfilesystem targets. - Because the fix is single-source claimed (2/4 confidence), independently validate post-upgrade behavior: confirm that
ATTACH DATABASErequests against paths outside an approved set are rejected by the server. - Re-verify any pinned/containerized distributions actually resolve to ≥ 0.4.5, since the OSV package range is reported as unfixed in the provided data.
- Upgrade Anyquery to version 0.4.5 or later, which the advisory states fixes the issue by restricting
Long-term hardening.
- Apply an allow-list model for all file-targeting SQL features exposed to remote callers; a denylist of traversal sequences is insufficient against an unfiltered
ATTACH DATABASEprimitive. - Enforce authentication and network access control on any SQL listener that can reach the filesystem.
- Deploy the Sigma/Suricata/Wazuh rules above with alerting to monitor for
ATTACH DATABASEabuse and unexpected file creation in sensitive directories. - Maintain filesystem integrity monitoring on Anyquery data, config, and shared volumes to detect overwrite or unexpected file creation.
- Apply an allow-list model for all file-targeting SQL features exposed to remote callers; a denylist of traversal sequences is insufficient against an unfiltered
References
- NVD — CVE-2026-50006: https://nvd.nist.gov/vuln/detail/CVE-2026-50006
- OSV Advisory (patch source, single-source claim): https://osv.dev/vulnerability/CVE-2026-50006
- CWE-22 — Improper Limitation of a Pathname to a Restricted Directory: https://cwe.mitre.org/data/definitions/22.html
- MITRE ATT&CK T1190 — Exploit Public-Facing Application: https://attack.mitre.org/techniques/T1190/
- MySQL Client/Server Protocol (attack surface context for port 3306): https://dev.mysql.com/doc/dev/mysql-server/latest/
Threat actor campaigns / exploit-in-the-wild evidence: None known. CVE-2026-50006 is not listed in CISA KEV, no public PoC or exploit code is available, no Nuclei template exists, and EPSS is 0.00973 (60.2nd percentile). The exploit chain described in this report is inferred from the vulnerability class and advisory text, not observed in the wild.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.