Summary
A code injection vulnerability in Anyquery's macOS browser plugins allows authenticated users with INSERT or UPDATE access to affected virtual tables to inject statements into AppleScript or JXA code. Crafted URL values may cause the Anyquery process to execute arbitrary operating-system commands with its privileges on the macOS host.
Affected context
The vulnerability occurs in Anyquery macOS virtual-table plugins for Chrome and equivalent integrations for Brave, Edge, and Safari. It becomes risky when authenticated users can write URL values through INSERT or UPDATE operations and the plugin constructs AppleScript or JXA source by interpolating those values without safe source-level escaping.
Exploit preconditions
- Attack surface: Anyquery macOS browser virtual tables that create or update tab URLs
- Required access: Authenticated database access with INSERT or UPDATE permission on an affected table
- Trigger point: Processing a write operation that embeds a SQL-controlled URL into AppleScript or JXA
- Why exploitation is possible: URL input is incorporated into executable script text, allowing string and statement boundaries to be altered
Why this happens
The underlying flaw is direct interpolation of SQL-controlled data into AppleScript or JXA source generated with formatted strings. Quote and newline characters can change the structure of the generated script instead of remaining data, causing the interpreter to process attacker-controlled statements. This maps to CWE-94: Improper Control of Generation of Code, because untrusted input is included in dynamically generated executable code without context-appropriate encoding or safe parameter handling.
Potential impact
- Arbitrary operating-system commands may execute on the macOS host
- The Anyquery process account could be compromised
- Local files or credentials accessible to that account could be exposed
- Browser sessions, data, or system configuration could be modified
- The host could be used for persistence, lateral movement, or further compromise
General mitigation guidance
Mitigation generally focuses on preventing data from becoming executable script source and reducing the privileges available to the query engine.
Common defensive patterns include:
- Avoiding string interpolation when generating AppleScript or JXA
- Using structured APIs, argument passing, or context-aware escaping mechanisms
- Validating URL values against an explicit scheme and format policy
- Separating data from code at the automation boundary
- Restricting INSERT and UPDATE permissions on browser virtual tables
- Running Anyquery with a dedicated least-privilege account and limited filesystem access
- Applying macOS execution and sandboxing controls where practical
- Treating database-writable values as untrusted even when supplied by authenticated users
How teams detect issues like this
Detection can combine source review, runtime monitoring, and access-policy checks.
- Use static analysis rules to identify formatted strings passed to AppleScript, JXA, shell, or other interpreters.
- Review code paths where SQL, HTTP, or user-controlled values are concatenated into executable scripts.
- Flag browser-plugin write handlers that pass unvalidated fields into automation APIs.
- Monitor Anyquery child-process creation, especially unexpected
osascriptexecutions and unusual command-line arguments. - Audit permissions to confirm that only trusted identities can write to affected virtual tables.
- Enforce code-review and CI policies that prohibit dynamic script construction without approved safe-parameter patterns.

