Vulnerabilities in pkg:golang/github.com/julien040/anyquery/plugins/safari

PACKAGE
Advisory Identifier: GHSA-hrj8-hjv8-mgwc
Advisory Summary

CVE-2026-47252 is a CRITICAL (CVSS 9.0) applescript/jxa code injection vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Anyquery libraries in the Go ecosystem. The issue involves applescript/jxa code injection via unescaped url in macos chrome plugin. Remediation is available by upgrading affected packages to version 0.0.0-20240826075852-c651df0b8767.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/julien040/anyquery/plugins/safari

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/julien040/anyquery/plugins/safari. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-hrj8-hjv8-mgwc CVE-2026-47252 CRITICAL Anyquery: AppleScript/JXA Code Injection via Unescaped URL in macOS Chrome Plugin

CVE-2026-47252 at a Glance

CVE Identifier CVE-2026-47252
GHSA Identifier GHSA-hrj8-hjv8-mgwc
Severity CRITICAL
CVSS v3.1 Base Score 9.0
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Anyquery
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 9.0

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:C/C:H/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 Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-47252

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/plugins/chrome fixed: 0.0.0-20240826075852-c651df0b8767
Upgrade github.com/julien040/anyquery/plugins/chrome to 0.0.0-20240826075852-c651df0b8767
github.com/julien040/anyquery/plugins/brave fixed: 0.0.0-20240826075852-c651df0b8767
Upgrade github.com/julien040/anyquery/plugins/brave to 0.0.0-20240826075852-c651df0b8767
github.com/julien040/anyquery/plugins/edge fixed: 0.0.0-20240826075852-c651df0b8767
Upgrade github.com/julien040/anyquery/plugins/edge to 0.0.0-20240826075852-c651df0b8767
github.com/julien040/anyquery/plugins/safari fixed: 0.0.0-20240826075852-c651df0b8767
Upgrade github.com/julien040/anyquery/plugins/safari to 0.0.0-20240826075852-c651df0b8767
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/plugins/chrome

How to Check if You Are Affected

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

inspect dependencies for github.com/julien040/anyquery/plugins/chrome

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 0.0.0-20240826075852-c651df0b8767), 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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. 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

# AppleScript/JXA Code Injection via Unescaped URL in macOS Chrome Plugin | Field | Value | | ---------------- | ----- | | Repository | julien040/anyquery | | Affected version | 0.4.4 (commit 0abd460) | | Vulnerability | CWE-94 — Improper Control of Generation of Code | | Severity | High | ## Summary The `chrome_tabs` plugin (and equivalent Brave/Edge/Safari variants) interpolates a SQL-controlled `url` value directly into an AppleScript template via `fmt.Sprintf(newTabScript, url)` at `plugins/chrome/tabs.go:141` without any escaping, then passes the result to `exec.Command("osascript", "-e", ...)`. An authenticated anyquery user who can issue SQL `INSERT INTO chrome_tabs` statements — which requires local CLI access — can break out of the `{URL:"..."}` property record with a newline-containing payload and inject arbitrary AppleScript statements, including `do shell script`, achieving OS-level command execution on the macOS host. The same pattern applies to the `Update` path at `tabs.go:169` via the JXA `setURL.js` script. ## Affected Code `plugins/chrome/tabs.go:141` — SQL-supplied `url` interpolated unescaped into AppleScript template, then executed via `osascript -e` ```go func (t *tabsTable) Insert(rows [][]interface{}) error { for _, row := range rows { url := "chrome://newtab/" if rawURL, ok := row[2].(string); ok { url = rawURL } cmd := exec.Command("osascript", "-e", fmt.Sprintf(newTabScript, url)) output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("can't run osascript: %W (message: %s)\n Script: %s", err, output, fmt.Sprintf(newTabScript, url)) } } return nil } ``` `plugins/chrome/tabs.go:169` — `Update` path interpolates `url` into JXA `setURL.js` template with identical lack of escaping ```go if url != "" { cmd := exec.Command("osascript", "-l", "JavaScript", "-e", fmt.Sprintf(setURLScript, pk, url)) output, err := cmd.CombinedOutput() if err != nil { return fmt.Errorf("can't run osascript: %W (message: %s)\n Script: %s", err, output, fmt.Sprintf(setURLScript, pk, url)) } } ``` SQL INSERT `url` column (row[2]) flows through `tabsTable.Insert` → `fmt.Sprintf(newTabScript, url)` → `exec.Command("osascript", "-e", <injected script>)` at `tabs.go:141`. ## Proof of Concept Step 1 — Insert a newline-bearing URL via SQL: the generated AppleScript closes the `{URL:"..."}` property record and appends an injected `do shell script "id"` block, which is passed verbatim to `osascript -e`. ```bash docker build -f Dockerfile -t anyquery-vuln001 . docker run --rm anyquery-vuln001 'x"} end tell do shell script "id" tell application "Google Chrome" make new tab with properties {URL:"done' ``` ```text SQL equivalent: INSERT INTO chrome_tabs (url) VALUES ('<INJECT_URL>') where INJECT_URL = x"} end tell do shell script "id" tell application "Google Chrome" make new tab with properties {URL:"done ``` ```text [sink:tabs.go:141] Script passed to osascript -e: tell application "Google Chrome" make new tab with properties {URL:"x"} end tell do shell script "id" tell application "Google Chrome" make new tab with properties {URL:"done"} at end of tabs of first window end tell [mock-osascript] Received script: tell application "Google Chrome" make new tab with properties {URL:"x"} end tell do shell script "id" tell application "Google Chrome" make new tab with properties {URL:"done"} at end of tabs of first window end tell RESULT: PASS — injection payload reached osascript -e verbatim; "do shell script \"id\"" present in generated script (tabs.go:141) ``` See attached files: Dockerfile, poc/inject_demo.go, poc/go.mod [vuln-001.zip](https://github.com/user-attachments/files/27945214/vuln-001.zip) ## Impact Any local user authenticated to the anyquery CLI who can run SQL against the `chrome_tabs` virtual table can achieve arbitrary OS command execution on the macOS host with the privileges of the anyquery process. Because anyquery exposes its SQL interface over an HTTP server (accessible to any user who can reach the endpoint), this can be exploited by any client with INSERT or UPDATE access to the browser-tab plugins, without requiring Chrome credentials or macOS admin rights. The injected AppleScript runs under the user's macOS session, giving access to the file system, keychain prompts, and any application scriptable via Apple Events. ## Remediation Escape double-quote and newline characters in the `url` value before interpolation, or avoid string templating entirely. Specifically in `plugins/chrome/tabs.go`: ```go // Replace fmt.Sprintf(newTabScript, url) with: safeURL := strings.ReplaceAll(url, `"`, `\"`) safeURL = strings.ReplaceAll(safeURL, "\n", "") safeURL = strings.ReplaceAll(safeURL, "\r", "") cmd := exec.Command("osascript", "-e", fmt.Sprintf(newTabScript, safeURL)) ``` A more robust fix is to pass the URL as an AppleScript variable declared via a `-e` prefix argument rather than string-interpolating it into the script body, or to use the `osascript` `argv` mechanism so the URL never appears inside the script source. Apply the same fix to `fmt.Sprintf(setURLScript, pk, url)` at `tabs.go:169` for the `Update` path. Validate that the URL conforms to an allowed scheme (`https://`, `http://`, `chrome://`) before passing it to either handler.

CVE-2026-47252 Affected Anyquery Versions

4 component(s)
Fixed Versions:
0.0.0-20240826075852-c651df0b8767
Product / Package Ecosystem Affected Versions Fixed Version
github.com/julien040/anyquery/plugins/chrome
Go
< 0.0.0-20240826075852-c651df0b8767
0.0.0-20240826075852-c651df0b8767
github.com/julien040/anyquery/plugins/brave
Go
< 0.0.0-20240826075852-c651df0b8767
0.0.0-20240826075852-c651df0b8767
github.com/julien040/anyquery/plugins/edge
Go
< 0.0.0-20240826075852-c651df0b8767
0.0.0-20240826075852-c651df0b8767
github.com/julien040/anyquery/plugins/safari
Go
< 0.0.0-20240826075852-c651df0b8767
0.0.0-20240826075852-c651df0b8767

References

Frequently Asked Questions

What is CVE-2026-47252?
CVE-2026-47252 is a security vulnerability in Anyquery involving AppleScript/JXA Code Injection via Unescaped URL in macOS Chrome Plugin under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Anyquery versions are affected?
Affected versions include releases prior to 0.0.0-20240826075852-c651df0b8767 across affected packages: github.com/julien040/anyquery/plugins/chrome, github.com/julien040/anyquery/plugins/brave, github.com/julien040/anyquery/plugins/edge, github.com/julien040/anyquery/plugins/safari.
What version fixes CVE-2026-47252?
Upgrading to 0.0.0-20240826075852-c651df0b8767 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/julien040/anyquery/plugins/chrome affected?
Yes, github.com/julien040/anyquery/plugins/chrome is affected in releases prior to 0.0.0-20240826075852-c651df0b8767. Upgrade your dependency to 0.0.0-20240826075852-c651df0b8767 or later.
Is github.com/julien040/anyquery/plugins/brave affected?
Yes, github.com/julien040/anyquery/plugins/brave is affected in releases prior to 0.0.0-20240826075852-c651df0b8767. Upgrade your dependency to 0.0.0-20240826075852-c651df0b8767 or later.
What is the CVSS score of CVE-2026-47252?
CVE-2026-47252 has a CVSS v3.1 base score of 9.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-47252?
CVE-2026-47252 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Go dependencies for CVE-2026-47252?
Run the dependency tree command: 'inspect dependencies for github.com/julien040/anyquery/plugins/chrome'. 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-hrj8-hjv8-mgwc",
  "modified" : "2026-06-08T23:04:00Z",
  "published" : "2026-06-08T23:04:00Z",
  "aliases" : [ "CVE-2026-47252" ],
  "summary" : "Anyquery: AppleScript/JXA Code Injection via Unescaped URL in macOS Chrome Plugin",
  "details" : "# AppleScript/JXA Code Injection via Unescaped URL in macOS Chrome Plugin\n\n| Field            | Value |\n| ---------------- | ----- |\n| Repository       | julien040/anyquery |\n| Affected version | 0.4.4 (commit 0abd460) |\n| Vulnerability    | CWE-94 — Improper Control of Generation of Code |\n| Severity         | High |\n\n## Summary\n\nThe `chrome_tabs` plugin (and equivalent Brave/Edge/Safari variants) interpolates a SQL-controlled `url` value directly into an AppleScript template via `fmt.Sprintf(newTabScript, url)` at `plugins/chrome/tabs.go:141` without any escaping, then passes the result to `exec.Command(\"osascript\", \"-e\", ...)`. An authenticated anyquery user who can issue SQL `INSERT INTO chrome_tabs` statements — which requires local CLI access — can break out of the `{URL:\"...\"}` property record with a newline-containing payload and inject arbitrary AppleScript statements, including `do shell script`, achieving OS-level command execution on the macOS host. The same pattern applies to the `Update` path at `tabs.go:169` via the JXA `setURL.js` script.\n\n## Affected Code\n\n`plugins/chrome/tabs.go:141` — SQL-supplied `url` interpolated unescaped into AppleScript template, then executed via `osascript -e`\n\n```go\nfunc (t *tabsTable) Insert(rows [][]interface{}) error {\n\tfor _, row := range rows {\n\t\turl := \"chrome://newtab/\"\n\t\tif rawURL, ok := row[2].(string); ok {\n\t\t\turl = rawURL\n\t\t}\n\n\t\tcmd := exec.Command(\"osascript\", \"-e\", fmt.Sprintf(newTabScript, url))\n\t\toutput, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"can't run osascript: %W (message: %s)\\n Script: %s\", err, output, fmt.Sprintf(newTabScript, url))\n\t\t}\n\n\t}\n\n\treturn nil\n}\n```\n\n`plugins/chrome/tabs.go:169` — `Update` path interpolates `url` into JXA `setURL.js` template with identical lack of escaping\n\n```go\n\t\tif url != \"\" {\n\t\t\tcmd := exec.Command(\"osascript\", \"-l\", \"JavaScript\", \"-e\", fmt.Sprintf(setURLScript, pk, url))\n\t\t\toutput, err := cmd.CombinedOutput()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"can't run osascript: %W (message: %s)\\n Script: %s\", err, output, fmt.Sprintf(setURLScript, pk, url))\n\t\t\t}\n\t\t}\n```\n\nSQL INSERT `url` column (row[2]) flows through `tabsTable.Insert` → `fmt.Sprintf(newTabScript, url)` → `exec.Command(\"osascript\", \"-e\", <injected script>)` at `tabs.go:141`.\n\n## Proof of Concept\n\nStep 1 — Insert a newline-bearing URL via SQL: the generated AppleScript closes the `{URL:\"...\"}` property record and appends an injected `do shell script \"id\"` block, which is passed verbatim to `osascript -e`.\n\n```bash\ndocker build -f Dockerfile -t anyquery-vuln001 .\ndocker run --rm anyquery-vuln001 'x\"}\nend tell\ndo shell script \"id\"\ntell application \"Google Chrome\"\n        make new tab with properties {URL:\"done'\n```\n\n```text\nSQL equivalent: INSERT INTO chrome_tabs (url) VALUES ('<INJECT_URL>')\nwhere INJECT_URL =\nx\"}\nend tell\ndo shell script \"id\"\ntell application \"Google Chrome\"\n\tmake new tab with properties {URL:\"done\n```\n\n```text\n[sink:tabs.go:141] Script passed to osascript -e:\ntell application \"Google Chrome\"\n        make new tab with properties {URL:\"x\"}\nend tell\ndo shell script \"id\"\ntell application \"Google Chrome\"\n        make new tab with properties {URL:\"done\"} at end of tabs of first window\nend tell\n[mock-osascript] Received script:\ntell application \"Google Chrome\"\n        make new tab with properties {URL:\"x\"}\nend tell\ndo shell script \"id\"\ntell application \"Google Chrome\"\n        make new tab with properties {URL:\"done\"} at end of tabs of first window\nend tell\n\nRESULT: PASS — injection payload reached osascript -e verbatim; \"do shell script \\\"id\\\"\" present in generated script (tabs.go:141)\n```\n\nSee attached files: Dockerfile, poc/inject_demo.go, poc/go.mod\n[vuln-001.zip](https://github.com/user-attachments/files/27945214/vuln-001.zip)\n\n## Impact\n\nAny local user authenticated to the anyquery CLI who can run SQL against the `chrome_tabs` virtual table can achieve arbitrary OS command execution on the macOS host with the privileges of the anyquery process. Because anyquery exposes its SQL interface over an HTTP server (accessible to any user who can reach the endpoint), this can be exploited by any client with INSERT or UPDATE access to the browser-tab plugins, without requiring Chrome credentials or macOS admin rights. The injected AppleScript runs under the user's macOS session, giving access to the file system, keychain prompts, and any application scriptable via Apple Events.\n\n## Remediation\n\nEscape double-quote and newline characters in the `url` value before interpolation, or avoid string templating entirely. Specifically in `plugins/chrome/tabs.go`:\n\n```go\n// Replace fmt.Sprintf(newTabScript, url) with:\nsafeURL := strings.ReplaceAll(url, `\"`, `\\\"`)\nsafeURL = strings.ReplaceAll(safeURL, \"\\n\", \"\")\nsafeURL = strings.ReplaceAll(safeURL, \"\\r\", \"\")\ncmd := exec.Command(\"osascript\", \"-e\", fmt.Sprintf(newTabScript, safeURL))\n```\n\nA more robust fix is to pass the URL as an AppleScript variable declared via a `-e` prefix argument rather than string-interpolating it into the script body, or to use the `osascript` `argv` mechanism so the URL never appears inside the script source. Apply the same fix to `fmt.Sprintf(setURLScript, pk, url)` at `tabs.go:169` for the `Update` path. Validate that the URL conforms to an allowed scheme (`https://`, `http://`, `chrome://`) before passing it to either handler.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/julien040/anyquery/plugins/chrome"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20240826075852-c651df0b8767"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/julien040/anyquery/plugins/brave"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20240826075852-c651df0b8767"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/julien040/anyquery/plugins/edge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20240826075852-c651df0b8767"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/julien040/anyquery/plugins/safari"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20240826075852-c651df0b8767"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/julien040/anyquery/security/advisories/GHSA-hrj8-hjv8-mgwc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/julien040/anyquery"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-08T23:04:00Z",
    "nvd_published_at" : null
  }
}