Skip to main content
Vulnerability Database/CVE-2026-113787

CVE-2026-113787: odf-kit XSS Vulnerability

CVE-2026-113787 is a cross-site scripting flaw in odf-kit that allows attackers to inject malicious code through unescaped inline CSS attributes. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-113787 Overview

CVE-2026-113787 is a cross-site scripting (XSS) vulnerability in odf-kit, a TypeScript and JavaScript library for generating, filling, reading, and converting OpenDocument Format files such as .odt and .ods. The flaw affects versions 0.6.0 through 0.14.1. The renderer's escapeHtml() helper is applied to text and most attribute values but not to inline CSS strings concatenated into style="..." attributes. An attacker who controls document style values can break out of the attribute and inject HTML or script into rendered output. Version 0.14.2 contains the patch.

Critical Impact

Malicious ODT or ODS documents can inject arbitrary HTML and script into pages rendered by applications using odf-kit, enabling XSS in the host web application.

Affected Products

  • odf-kit versions 0.6.0 through 0.14.1 (TypeScript/JavaScript library)
  • Applications embedding the odf-kit HTML renderer for ODT or ODS files
  • Downstream web services that render user-supplied OpenDocument files

Discovery Timeline

  • 2026-10-21 - CVE-2026-113787 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-113787

Vulnerability Analysis

The vulnerability is a stored or reflected cross-site scripting flaw [CWE-79] in the ODT HTML renderer. The escapeHtml() helper is applied consistently to text content and to attributes such as href, src, alt, id, data-author, data-date, and citation text. Inline CSS strings concatenated into style="${...}" attributes are not escaped.

In renderTextSpan at dist/odt/to-html/html-renderer.js:195, the value of fo:color is copied verbatim from the parsed document into style.fontColor by extractSpanStyle in read/parser.js:348. The raw value is then concatenated into the attribute. A double-quote character in that value terminates the attribute early and allows injection of additional HTML attributes or event handlers.

The same unescaped style="${...}" pattern appears at roughly ten other emission sites, including paragraphStyleToCss, cellStyleToCss, rowStyleToCss, <col> emission, and the image style attribute. User-controlled attack surface spans fo:color, fo:background-color, fo:text-shadow, fo:letter-spacing, fo:font-family, fo:margin-*, fo:padding-*, fo:line-height, fo:border*, and style:vertical-align.

Root Cause

The root cause is inconsistent output encoding. The renderer trusts style values produced by the parser and emits them without passing them through an attribute-safe escaper. The parser preserves document-supplied strings verbatim, so a crafted .odt or .ods file can embed quote characters that break attribute boundaries.

Attack Vector

Exploitation requires a victim to render an attacker-controlled OpenDocument file through an application that uses odf-kit. A document author sets a style attribute such as fo:color to a value containing a double-quote followed by injected HTML. When the renderer emits the span, the attribute closes early and the injected markup executes in the browser context of the rendering application. User interaction is required.

typescript
// Patch excerpt from src/odt/to-html/html-renderer.ts (v0.14.2)
// fix(odt): escape attribute values in the ODT HTML renderer

 * the inner body content, suitable for embedding in an existing page.
 */

import { escapeAttr } from "../../core/index.js";

import type {
  BodyNode,
  InlineNode,
// Source: https://github.com/GitHubNewbie0/odf-kit/commit/fa3abc5a7a757f56c7212b2dbe99d1d2db995420

The patch imports an escapeAttr helper and applies it to style strings before they are concatenated into HTML attributes.

Detection Methods for CVE-2026-113787

Indicators of Compromise

  • OpenDocument files containing fo:color, fo:background-color, or related style attributes with embedded double-quote characters
  • Rendered HTML output containing unexpected tags, on* event handler attributes, or <script> fragments originating from a style attribute
  • Server logs showing uploads of .odt or .ods files from untrusted sources before anomalous client-side behavior

Detection Strategies

  • Scan ODT and ODS files for style attribute values that contain quote characters, angle brackets, or JavaScript URI schemes before rendering
  • Compare installed odf-kit package versions against the fixed version 0.14.2 across build pipelines and runtime containers
  • Validate rendered HTML output in a sandbox and alert on tags that were not present in the source document body

Monitoring Recommendations

  • Monitor Content Security Policy (CSP) violation reports from pages that render OpenDocument content
  • Track npm audit and software composition analysis output for the odf-kit dependency across repositories
  • Log and review document uploads that trigger renderer errors or unusually long style attribute strings

How to Mitigate CVE-2026-113787

Immediate Actions Required

  • Upgrade odf-kit to version 0.14.2 or later in all applications and build artifacts
  • Audit services that render ODT or ODS files from untrusted users and restrict rendering until the patch is deployed
  • Enforce a strict Content Security Policy that disallows inline event handlers and untrusted script sources on pages that embed rendered documents

Patch Information

The fix is published in odf-kit version 0.14.2. The patch commit introduces an escapeAttr helper and applies it to style strings in src/odt/to-html/html-renderer.ts. Review the GitHub Security Advisory GHSA-3cgg-c5pp-57h6 and the GitHub Commit Details for the full change set.

Workarounds

  • Pre-process incoming ODT and ODS files to strip or sanitize fo:* and style:* attribute values that contain quote characters
  • Render untrusted OpenDocument content inside a sandboxed iframe with the sandbox attribute set and no allow-scripts permission
  • Apply a strict CSP with default-src 'self' and script-src restricted to known hashes or nonces on pages that embed rendered output
bash
# Pin the fixed version in package.json and reinstall
npm install odf-kit@0.14.2 --save-exact
npm audit --production

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.