VulnWatch by ve1ve2
medium 6.1 EPSS 0.25%

GHSA-2rqm-h6hv-g79v: odf-kit has HTML injection leading to XSS in odsToHtml() via unescaped style attribute values

Source:
OSV.dev
Published:
Fetched:
Updated:
Affects:
odf-kit

https://osv.dev/vulnerability/GHSA-2rqm-h6hv-g79v ↗

osvnpmfix-available

odf-kit has HTML injection leading to XSS in odsToHtml() via unescaped style attribute values ### Summary ODF style values are interpolated into `style="..."` attributes without HTML-escaping in odf-kit's ODS to-HTML renderer (`odsToHtml()`). A double-quote character inside an attacker-controlled style value breaks out of the attribute, allowing arbitrary HTML/attribute injection — and therefore script execution (XSS) — from a crafted `.ods` file wherever the rendered output is inserted as HTML, which is the documented purpose of the function. ### Details Two emission sites in `src/ods/to-html/html-renderer.ts` (before 0.14.0, `src/ods-reader/html-renderer.ts`) write document-controlled values into a `style` attribute without escaping: - **Cell style.** `buildInlineStyle()` assembles a CSS string from the cell's formatting properties (`fo:color`, `fo:font-size`, `fo:font-family`, `fo:background-color`, `fo:text-align`, etc.) with no escaping, and `renderCell` emits it raw as the cell's `style` attribute. - **Row height.** `row.height` (from `style:row-height`) is emitted raw into the row element's `style` attribute. The same defect in the ODT renderer (`odtToHtml()`) is tracked as GHSA-3cgg-c5pp-57h6 (CVE-2026-113787). ### Impact Any consumer that renders `odsToHtml()` output as HTML gets XSS from a crafted `.ods` file they convert: untrusted file → arbitrary tags and attributes → script execution in the host page with the page's origin. ### Patches Fixed in 0.14.2. Both sites now route document-controlled values through a shared attribute-escaping helper: - [`1424227`](https://github.com/GitHubNewbie0/odf-kit/commit/1424227d1ca2716a249b623d1456575ff0331dcc): escape style attribute values in the ODS HTML renderer - [`aa64c73`](https://github.com/GitHubNewbie0/odf-kit/commit/aa64c734ebd7e7be40e35fcda83b1144193c3da2): the shared `escapeAttr` helper Users should upgrade to 0.14.2 or later. ### Credit Reported by @PethuKannan. Affected: npm:odf-kit Fixed in: 0.14.2 References: https://github.com/GitHubNewbie0/odf-kit/security/advisories/GHSA-2rqm-h6hv-g79v https://github.com/GitHubNewbie0/odf-kit/commit/1424227d1ca2716a249b623d1456575ff0331dcc https://github.com/GitHubNewbie0/odf-kit

Linked vulnerabilities (4)

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

odf-kit is a TypeScript and JavaScript library for working with OpenDocument Format files. In versions 0.9.8 through 0.14.1, the odsToHtml() renderer inserts document-controlled cell formatting and row height values into HTML style attributes without escaping them. An attacker can craft an ODS file that injects arbitrary HTML attributes or elements, allowing JavaScript execution in the host page's origin when an application inserts the converted output as HTML. This issue is fixed in version 0.14.2.

CWE: CWE-79Aliases: GHSA-2rqm-h6hv-g79v, CVE-2026-113787, GHSA-3cgg-c5pp-57h6NVD: Received
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

odf-kit has HTML injection leading to XSS in odsToHtml() via unescaped style attribute values

CWE: CWE-79Aliases: CVE-2026-134010, CVE-2026-113787, GHSA-3cgg-c5pp-57h6
CVE-2026-113787 medium 6.1 EPSS 0.25% (p16) NVDCVE.org
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

odf-kit allows users to generate, fill, read, and convert OpenDocument Format files (.odt, .ods) in TypeScript and JavaScript. Starting in version 0.6.0 and prior to version 0.14.2, he renderer has an `escapeHtml()` helper and applies it consistently to text content and to attribute values — `href`, `src`, `alt`, `id`, `data-author`, `data-date`, citation text all go through it. The inline CSS strings do not. In `renderTextSpan` (`dist/odt/to-html/html-renderer.js:195`), the value of e.g. `fo:color` is copied from the document into `style.fontColor` verbatim by the parser...

CWE: CWE-79NVD: Awaiting Analysis