/

CVE-2026-58500

Severity:

HIGH RISK

(8.2)

Stored XSS (CWE-79) in MCP Appium locator UI

CVE-2026-58500

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Unauthorized MCP tool execution via stored XSS

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

MCP Appium contains a stored cross-site scripting vulnerability where attacker-controlled mobile element attributes are interpolated into an HTML UI without proper escaping.

If an attacker can influence the app-under-test UI, they can inject scripts that execute in the MCP client and trigger arbitrary MCP tools, leading to unauthorized actions such as screenshots and page source retrieval.

Affected context

This vulnerability occurs in MCP Appium's locator generator UI, specifically in environments where MCP assistants use the generate_locators tool and render the returned HTML in a browser-like client.

It is most relevant when the mobile app under test exposes text, content-desc, resource-id, or locator selector values that can be influenced by untrusted users or external input and are subsequently reflected in the MCP UI without proper escaping.

Exploit preconditions

  • Attack surface: The MCP locator generator UI rendered by the MCP client.
  • Required access: Ability to control or influence the UI of the mobile app under test (e.g., user-controlled labels, accessibility text, resource IDs, or selectors).
  • Trigger point: Use of the generate_locators tool, which causes the vulnerable createLocatorGeneratorUI output to be injected into the MCP client's DOM.
  • Why exploitation is possible: Attacker-controlled element attributes are interpolated directly into an HTML template literal without HTML or JavaScript context escaping, allowing arbitrary script injection that runs when the MCP UI is rendered.

Why this happens

The underlying bug is a classic stored cross-site scripting issue mapped to CWE-79.

The createLocatorGeneratorUI function treats untrusted mobile element attributes as safe HTML and combines them into a template literal without escaping or encoding.

Because these values are inserted into a rendered page, any embedded script or event handler is executed in the browser context, enabling the attacker's JavaScript to call window.parent.postMessage and drive MCP tool execution.

Conceptually, this is an unsafe mixing of data and code where presentation templates accept unvalidated, unencoded user-influenced data.

Potential impact

  • Attacker-controlled scripts may trigger arbitrary MCP tools (e.g., screenshots, page source retrieval, or other registered capabilities).
  • Unauthorized collection of sensitive test or application information via automated tooling.
  • Manipulation of testing workflows, including falsifying automation results or steering tool behavior.
  • Potential lateral impact if MCP tools integrate with external systems or CI pipelines.

General mitigation guidance

Effective mitigation focuses on strict separation of untrusted data from executable content in UI templates.

Common patterns include:

  • Applying robust HTML and JavaScript context-aware escaping to all element attributes before inserting them into templates.
  • Using templating engines or component frameworks that encode values by default instead of manual string interpolation.
  • Treating all app-under-test UI content as untrusted and validating or sanitizing it prior to rendering in MCP-facing UIs.
  • Limiting what UI-derived data is rendered, and avoiding embedding it directly in script blocks or event handler attributes.
  • Implementing least-privilege for MCP tools so that even if a UI script runs, its ability to perform sensitive operations is constrained.

How teams detect issues like this

Detection typically involves examining how UI templates handle untrusted data and ensuring that encoding rules are consistently applied.

High-level strategies include:

  • Static analysis rules that flag direct string interpolation of untrusted values into HTML or JavaScript contexts (e.g., template literals, innerHTML assignments).
  • Code review checklists that require verification of escaping/sanitization for any data originating from app-under-test attributes before inclusion in MCP UI resources.
  • Security policies that mandate use of safe templating frameworks and prohibit raw DOM injection from tool outputs.
  • Optional automated scanning tools or dynamic tests that attempt to inject benign script payloads into UI attributes and observe whether they execute when rendered in the MCP client.

Sources

SourceLink
github.comgithub.com/appium/appium-mcp/commit/e222bbbd6fe2b656a320efcd143563f08061a83d
github.comgithub.com/appium/appium-mcp/security/advisories/GHSA-x975-rgx4-5fh4

Frequently asked

questions

Exploitability depends on whether an attacker can influence the mobile app's UI elements that MCP Appium uses to generate locators and whether a victim MCP client renders the resulting HTML. In environments where test apps expose user-controlled text or attributes, the risk is significantly higher.

The attacker must be able to control or significantly influence the UI of the app under test—such as setting user-visible labels, accessibility content descriptions, or resource IDs that are processed by MCP Appium and shown in its locator generator UI.

The safest pattern is to treat all app-under-test attributes as untrusted and apply strict, context-aware escaping or encoding before inserting them into HTML or JavaScript. Using templating mechanisms that encode by default, rather than manual string concatenation, greatly reduces XSS risk.

Adopt secure-by-default UI rendering practices, enforce output encoding in all browser-facing content, and incorporate XSS-focused code review and static analysis into the development pipeline. Additionally, design MCP tools so that UI scripts have minimal ability to trigger sensitive operations, following least-privilege principles.

Find out what's already
exploitable in your codebase.