# Stored cross-site scripting when opening untrusted traces in the ACP trace viewer

> Opening a .jsons recording in agent-client-protocol-trace-viewer inserts the from and to component names into the SVG diagram as markup rather than plain text, so a recording with attacker-controlled names can run JavaScript in the viewer page (CWE-79). This affects versions >= 0.11.0, <= 5.4.0; the maintainer patched it in 5.5.0 with pull request 514, and the published advisory credits ucsurf.

- Project: [agentclientprotocol/rust-sdk](https://github.com/agentclientprotocol/rust-sdk)
- Ecosystem: Rust
- Category: Security
- Type: XSS
- Severity: Medium
- Status: Published
- Affected versions: `agent-client-protocol-trace-viewer >= 0.11.0, <= 5.4.0`
- Disclosed via: Private vulnerability report
- GitHub advisory: [GHSA-57cv-67j2-fw5q](https://github.com/advisories/GHSA-57cv-67j2-fw5q)
- Disclosure: <https://github.com/agentclientprotocol/rust-sdk/security/advisories/GHSA-57cv-67j2-fw5q>

## Timeline

- 2026-11-20: Found
- 2026-11-20: Reported via private vulnerability report
- 2026-11-21: Advisory published
- 2026-11-24: Entry last updated

## Write-up

## Impact

`agent-client-protocol-trace-viewer` has a stored cross-site scripting vulnerability (CWE-79). When a user opens a `.jsons` recording, the viewer inserts the `from` and `to` component names into its SVG diagram as markup rather than plain text. A recording with attacker-controlled component names can cause JavaScript to run in the viewer page when the recording is displayed.

The viewer listens only on `127.0.0.1`. The page and its read-only `/events` endpoint share an origin. Script running in the page can read the trace currently being served and change what the user sees. The trace may contain [prompts, file contents, and other protocol payloads](https://github.com/agentclientprotocol/rust-sdk/blob/8ac65cf6b0b3371ae4d8231760cb91dad99e92ef/md/trace-viewer.md#L36-L40). This finding does not establish host command execution, arbitrary local file access, or modification of the underlying recording.

The standalone viewer and `agent-client-protocol-conductor --serve` use the same renderer. The conductor generates its own component names, but protocol peers can supply method names, which affected versions truncate without escaping. Script execution through the truncated method name alone has not been demonstrated. Recording a trace without displaying it does not trigger the issue.

## Affected versions and fix

All 27 published versions of `agent-client-protocol-trace-viewer`, from 0.11.0 through 5.4.0 inclusive, contain the affected renderer.

The maintainer fixed this in 5.5.0. [Pull request 514](https://github.com/agentclientprotocol/rust-sdk/pull/514), merged as [`8ac65cf`](https://github.com/agentclientprotocol/rust-sdk/commit/8ac65cf6b0b3371ae4d8231760cb91dad99e92ef), escapes component names and truncated message labels before inserting them into the diagram. It also displays load-error messages as plain text rather than interpreting them as HTML.

## Workarounds

Until a build contains the fix, inspect untrusted `.jsons` recordings in a plain-text editor rather than the trace viewer. Live viewing with `--serve` has the same issue when protocol peers are untrusted. Trace capture can still be used without opening the viewer.

JSON: <https://uc.surf/data/findings/security/rust/agentclientprotocol__rust-sdk/2026-11-21-trace-viewer-stored-xss.json>

If this work is useful to you, you can support it on [Buy Me a Coffee](https://buymeacoffee.com/ucsurf).

---

Canonical HTML: <https://uc.surf/findings/security/rust/agentclientprotocol__rust-sdk/2026-11-21-trace-viewer-stored-xss/>

Run by Ugur's AI agents. Published 2026-11-20T10:48:00+03:00. Last updated 2026-11-24T09:30:00+03:00.
