AgentbeamBeta
AI agent vulnerability · OpenClaw

GHSA-r294-2894-92j3: OpenClaw has stored XSS in exported session HTML viewer via markdown/raw-HTML rendering

mediumCVSS 4.0 5.3

The OpenClaw session export viewer, in versions up to 2026.2.22-2, allows stored cross-site scripting. Raw HTML in session content or unescaped metadata runs as script when someone opens the exported HTML file. Upgrade to 2026.2.23.

Published Mar 3, 2026 · Analysis Nov 23, 2026

What an attacker can do

The exporter renders markdown with marked.parse and inserts the result through innerHTML. It did not override the html renderer, so raw HTML in the markdown passed through untouched. Some tree and header metadata fields were also placed into the export template without escaping. A session that holds an image tag with an onerror handler therefore runs JavaScript when the exported file opens.

The attacker needs untrusted text to land in a session, for example through a web page, a file or a tool result the agent processed. The victim then exports the session and opens the file, or shares it. The script runs in the viewer page, so it can read the session content shown there and spoof the trusted export view for phishing. Maintainers rate it moderate.

Who is affected

The npm package openclaw, versions up to and including 2026.2.22-2. Check your version:

npm ls openclaw

Exported HTML files that were created by an old version keep the flaw. The fix changes the exporter, so re-export any session you plan to share.

openclaw

Ecosystem
npm
Affected
< 2026.2.23
Fixed in
2026.2.23
Check
npm ls openclaw

How to fix it

Upgrade to 2026.2.23 or later. The fix, commit f8524ec77a3999d573e6c6b8a5055bf35c49a2e6, adds an html renderer override that escapes raw HTML tokens, escapes the tree and header metadata fields, and sanitizes image MIME types for data-URL images. It adds regression tests. The advisory names no workaround. Do not open exported session files from untrusted sources until you upgrade.

How to tell if you were hit

Search exported session HTML files for raw event-handler attributes such as onerror, or for script tags, that came from content rather than from the viewer template. Check sessions that processed untrusted pages or files. Beam records agent file access and shell commands, which can show where such content came from.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

The exported session HTML viewer allowed stored XSS when untrusted session content included raw HTML markdown tokens or unescaped metadata fields.

Impact

Opening a crafted exported HTML session could execute attacker-controlled JavaScript in the viewer context. This can expose session content in the page and enable phishing or UI spoofing in the trusted export view.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Affected versions: <= 2026.2.22-2
  • Patched version (released): >= 2026.2.23

Technical Details

The exporter rendered markdown with marked.parse(...) and inserted HTML via innerHTML, but did not override the html renderer token path. Raw HTML (for example ``) was passed through. Additional tree/header metadata fields were interpolated without escaping in the export template.

Reproduction

  1. Create a session containing content like ``.
  2. Export the session to HTML.
  3. Open the exported file.
  4. Observe script execution from injected content.

Remediation

  • Added a marked html(token) renderer override that escapes raw HTML tokens.
  • Escaped previously unescaped tree/header metadata fields in the export template.
  • Added image MIME sanitization for exported data-URL image rendering.
  • Added regression tests for markdown/token and metadata escaping paths.

Fix Commit(s)

  • f8524ec77a3999d573e6c6b8a5055bf35c49a2e6

Release Process Note

patched_versions is pre-set to the released version (>= 2026.2.23). This advisory now reflects released fix version 2026.2.23.

OpenClaw thanks @allsmog for reporting.

Credited to allsmog.

Questions

Does CVE-level tracking exist for this OpenClaw XSS?

No CVE is assigned. It is tracked as GHSA-r294-2894-92j3, rated moderate and classed as CWE-79.

Is it exploitable without user action?

No. Someone must export the session and open the HTML file. The script then runs in the viewer page.

Which version fixes it?

OpenClaw 2026.2.23. Versions up to 2026.2.22-2 are affected.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More OpenClaw vulnerabilities

All OpenClaw entries