Safari MCP tool parameter escaping flaw leads to JS injection
Start here
Versions of safari-mcp before 2.22.15 have a JS injection vulnerability: in 16 places, when tool parameters are placed into single-quoted string literals, only single quotes are escaped and backslashes are not escaped first; a backslash plus a quote can close the literal and execute arbitrary page JS; 7 of these are read-only tools exempt from the tab ownership check, so even if the client only authorizes read-only tools it can be exploited, including tabs not owned by the session. Fixed in 2.22.15.
Generated by AI from reports · Updated 10 days ago
Progress timeline
- GitHub Security AdvisoriesSelectedSafari MCP single-quoted tool parameters fail to escape backslashes, causing JavaScript injection, fixed in 2.22.15
safari-mcp (npm) versions before 2.22.15 contain a JavaScript injection vulnerability: in safari.js, 16 places place tool parameters into single-quoted JavaScript string literals while escaping only single quotes and not first escaping backslashes; a parameter containing a backslash followed by a quote can close the literal, and the rest is executed as JavaScript in the page. Of these, 7 belong to read-only tools exempt from the tab ownership check, such as the filter of safari_network_details, the selector of safari_snapshot, and the dbName and storeName of safari_get_indexed_db; even if the MCP client authorizes only read-only tools and the allowlist excludes safari_evaluate and safari_run_script, arbitrary page JavaScript can still be run this way, including in tabs not owned by the session.
Related discussion
Attention trend
New sources per day
- Nov 20: 1 new sources (1 outlets, 0 accounts)
- Nov 21: 0 new sources (0 outlets, 0 accounts)
- Nov 22: 0 new sources (0 outlets, 0 accounts)
- Nov 23: 0 new sources (0 outlets, 0 accounts)
- Nov 24: 0 new sources (0 outlets, 0 accounts)
- Nov 25: 0 new sources (0 outlets, 0 accounts)
- Nov 26: 0 new sources (0 outlets, 0 accounts)
- Nov 27: 0 new sources (0 outlets, 0 accounts)
- Nov 28: 0 new sources (0 outlets, 0 accounts)
- Nov 29: 0 new sources (0 outlets, 0 accounts)
- Nov 30: 0 new sources (0 outlets, 0 accounts)