nday
GHSA-4rj4-rcrq-gr92

Safari MCP: JavaScript injection through single-quoted tool arguments (backslash not escaped)

Patched on the day of disclosure. Patched: fixed in safari-mcp 2.22.15. None of the four PoC sources lists it. Not in CISA KEV.

tags weakness typecode injection accesslocalno user interaction ecosystemnpm
why these tags

nday derives these tags by fixed rules from the facts below; NVD, the CNA and other sources do not assign them. Vocabulary and rules: ~/tags.

code injection
CWE-94, stated by GitHub advisory GHSA-4rj4-rcrq-gr92
local
AV:L in CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N (CVSS 4.0) from GitHub advisory GHSA-4rj4-rcrq-gr92
no user interaction
UI:N in CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N (CVSS 4.0) from GitHub advisory GHSA-4rj4-rcrq-gr92
npm
GHSA-4rj4-rcrq-gr92: npm packages safari-mcp
stage
PAT
disclosed
disclosure → patch
T+0d
cvss
6.2 MEDIUM v4.0

Lifecycle

x axis UTC; dot = exact minute, wide bar = date only, hollow = unknown or inferred.
time unknown
DISdisclosed
11-19T22:17Z
PATpatch
11-19T23:01Z
ANAanalysis
no record yet
POCPoC
no record yet
ITWexploited
no record yet
KEVKEV
no record yet

Summary

### Impact

Sixteen places in safari.js placed a tool argument inside a single-quoted JavaScript string literal and escaped the single quote without first escaping backslashes. An argument containing a backslash followed by a quote therefore closed the literal, and the rest of the argument ran as JavaScript in the page.

Seven of the affected arguments belong to read-only tools that are exempt from the tab-ownership check: filter in safari_network_details and safari_extract_links, level in safari_console_filter, selector in safari_snapshot, safari_accessibility_snapshot and safari_extract_tables, and dbName / storeName in safari_get_indexed_db. An MCP client limited to read-only tools (with safari_evaluate and safari_run_script excluded from its allowlist) could still run arbitrary page JavaScript through them, including in a tab the session does not own. The other affected arguments are ref in safari_select_option, safari_react_select_set and safari_react_select_list_options, the key in safari_press_key, the file name in safari_upload_file and safari_paste_image, and the first line of the text in safari_replace_editor.

### Patches

Fixed in 2.22.15: every affected site uses the shared escJsSingleQuote, which escapes the backslash before the quote, and a test fails the build if a quote-only escape returns.

### Workarounds

Upgrade to 2.22.15. There is no configuration workaround: excluding safari_evaluate and safari_run_script from a client's tool list did not prevent the injection.

### Credits

Reported privately on 2026-10-09 by Aliaksandr Palei (@fakepooh) under the coordinated-disclosure process in SECURITY.md.

Original text of GitHub advisory GHSA-4rj4-rcrq-gr92, shown as published.

Exploit conditions

What an attack needs, read from the CVSS vector.
Attack vector AV:L
Local: needs a local or SSH session, or a user tricked into acting on the machine
Attack complexity AC:L
Low: no target-specific security measures to get around
Attack requirements AT:N
None: success does not depend on how the target is deployed or running
Privileges required PR:L
Low: ordinary user privileges
User interaction UI:N
None: no action by anyone other than the attacker

CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N

CVSS 4.0 vector from GitHub advisory GHSA-4rj4-rcrq-gr92.

Event log

+DISdisclosed

ghsa reported a disclosure.

src ghsa · nday , observed live · raw
{
  "id": 489245,
  "type": "disclosed",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-4rj4-rcrq-gr92",
  "occurred_at": "2026-11-19T22:17:05Z",
  "observed_at": "2026-11-19T23:01:42.561574Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-4rj4-rcrq-gr92",
  "detail": {
    "state": "PUBLISHED",
    "ghsa_id": "GHSA-4rj4-rcrq-gr92",
    "withdrawn_at": null
  }
}
no source time; observed live by nday
+PATpatch released

The advisory gives fixed version safari-mcp 2.22.15. Fix commits are linked. Advisory published ; the patch's own release time is not recorded.

src ghsa · nday , observed live · raw
{
  "id": 489246,
  "type": "patch_released",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-4rj4-rcrq-gr92",
  "occurred_at": null,
  "observed_at": "2026-11-19T23:01:42.561574Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-4rj4-rcrq-gr92",
  "detail": {
    "cvss": {
      "cvss_v3": {
        "score": 0.0,
        "vector_string": null
      },
      "cvss_v4": {
        "score": 6.2,
        "vector_string": "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:N"
      }
    },
    "cwes": [
      {
        "name": "Improper Control of Generation of Code",
        "cwe_id": "CWE-94"
      },
      {
        "name": "Improper Encoding or Escaping of Output",
        "cwe_id": "CWE-116"
      }
    ],
    "ghsa_id": "GHSA-4rj4-rcrq-gr92",
    "packages": [
      {
        "name": "safari-mcp",
        "ecosystem": "npm",
        "first_patched_version": "2.22.15",
        "vulnerable_version_range": "< 2.22.15"
      }
    ],
    "severity": "medium",
    "references": [
      "https://github.com/achiya-automation/safari-mcp/security/advisories/GHSA-4rj4-rcrq-gr92",
      "https://github.com/achiya-automation/safari-mcp/commit/23f1319defefd2c5cbd06b23189ab01876a8c5d3",
      "https://github.com/achiya-automation/safari-mcp/releases/tag/v2.22.15",
      "https://github.com/advisories/GHSA-4rj4-rcrq-gr92"
    ],
    "fix_commit_urls": [
      "https://github.com/achiya-automation/safari-mcp/commit/23f1319defefd2c5cbd06b23189ab01876a8c5d3"
    ],
    "github_reviewed_at": "2026-11-19T22:17:05Z",
    "advisory_updated_at": "2026-11-19T22:17:08Z",
    "source_code_location": "https://github.com/achiya-automation/safari-mcp",
    "advisory_published_at": "2026-11-19T22:17:05Z"
  }
}

Report an error

report an error or omission

Something on this page wrong or missing? Tell the editors; if they accept it, this page's revision log says so publicly. Upstream data is not changed.

Discussion

0 comments

No comments yet.