GitHub Advisoryadvisory · npm
GHSA-2ww6-868g-2c56 OpenClaw Vulnerable to HTML injection via unvalidated image MIME type in data-URL interpolation
LOW
Official page ↗
- Aliases
- CVE-2026-32040
- Ecosystem
- npm
- Packages
- openclaw
- Severity
- Low
- CVSS vector
- CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
- Weaknesses
- CWE-79
- Reviewed
- 2026-03-03
Affected packages
• npm openclaw: < 2026.2.23 → fixed in 2026.2.23
Description
Summary
The HTML session exporter (`src/auto-reply/reply/export-html/template.js`) interpolates `img.mimeType` directly into `` attributes without validation or escaping. A crafted `mimeType` value (e.g., `x" onerror="alert(1)`) can break out of the attribute context and execute arbitrary JavaScript.
Impact
An attacker who can control image entries in session data (via crafted tool results or session manipulation) can achieve XSS when the exported HTML is opened. The precondition is tighter than the main XSS finding (requires image content blocks with a malicious mimeType), but exploitation is straightforward.
Affected components
• `src/auto-reply/reply/export-html/template.js` — line 1032 (tool result images), line 1306 (user message images)
Reproduction
1. Craft a session entry with an image content block where `mimeType` is set to `image/png" onerror="alert(document.domain)`
2. Export the session to HTML
3. Open the exported HTML — the injected `onerror` fires
Remediation
• Added `sanitizeImageMimeType()` helper that validates mimeType against a whitelist of known image MIME types
• Falls back to `application/octet-stream` for unrecognized values, preventing attribute breakout
Fix
https://github.com/openclaw/openclaw/pull/24140
Related
Alias · CVE (1)
- CVE-2026-32040 OpenClaw versions prior to 2026.2.23 contain an html injection vulnerability in the HTML session exporter that allows attackers to execute… vulnerability
Weakness · CWE (1)
- CWE-79 Improper Neutralization of Input During Web Page Generation weakness
References
- https://github.com/openclaw/openclaw/security/advisories/GHSA-2ww6-868g-2c56 web
- https://nvd.nist.gov/vuln/detail/CVE-2026-32040 advisory
- https://github.com/openclaw/openclaw/pull/24140 web
- https://github.com/openclaw/openclaw/commit/f3adf142c195000cbde31200626a1d8c8b716df9 web
- https://github.com/openclaw/openclaw package
- https://www.vulncheck.com/advisories/openclaw-html-injection-via-unvalidated-image-mime-type-in-data-url-interpolation web