CVE-2026-30830: Defuddle Cross-Site Scripting Vulnerability
LOWCVE-2026-30830 is a LOW (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Defuddle libraries in the npm ecosystem. The issue involves defuddle vulnerable to xss via unescaped string interpolation in _findcontentbyschematext image tag. Remediation is available by upgrading affected packages to version 0.9.0.
CVE-2026-30830 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2026-30830
To remediate this vulnerability, upgrade all affected Defuddle dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install defuddle@0.9.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls defuddle
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2026-30830, inspect your project dependencies using npm:
npm ls defuddle
Analyze the terminal output to locate any version of Defuddle in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.0), your application is affected.
Note: The npm ls defuddle command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Defuddle, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-30830 Affected Defuddle Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
defuddle
|
npm |
< 0.9.0
|
0.9.0
|
References
Frequently Asked Questions
What is CVE-2026-30830?
Which Defuddle versions are affected?
What version fixes CVE-2026-30830?
Is defuddle affected?
What is the CVSS score of CVE-2026-30830?
What CWE is associated with CVE-2026-30830?
How can I check npm dependencies for CVE-2026-30830?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5mq8-78gm-pjmq",
"modified" : "2026-07-20T21:30:35Z",
"published" : "2026-03-06T18:39:35Z",
"aliases" : [ "CVE-2026-30830" ],
"summary" : "defuddle vulnerable to XSS via unescaped string interpolation in _findContentBySchemaText image tag",
"details" : "### Summary\n\nThe `_findContentBySchemaText` method in `src/defuddle.ts` interpolates image `src` and `alt` attributes directly into an HTML string without escaping:\n\n```typescript\nhtml += `<img src=\"${imageSrc}\" alt=\"${imageAlt}\">`;\n```\n\nAn attacker can use a `\"` in the `alt` attribute to break out of the attribute context and inject event handlers. This is a separate vulnerability from the sanitization bypass fixed in f154cb7 — the injection happens during string construction, not in the DOM, so `_stripUnsafeElements` cannot catch it.\n\n### Details\n\nWhen `_findContentBySchemaText` finds a sibling image outside the matched content element, it reads the image's `src` and `alt` attributes via `getAttribute()` and interpolates them into a template literal. `getAttribute('alt')` returns the raw attribute value. If the alt contains `\"`, it terminates the `alt` attribute in the interpolated HTML string, and subsequent content becomes new attributes (including event handlers).\n\nThe recently added `_stripUnsafeElements()` (commit f154cb7) strips `on*` attributes from DOM elements, but the `alt` attribute's name is `alt` (not `on*`), so it is preserved with its full value. The `onload` handler is created by the string interpolation, not present in the original DOM.\n\n### PoC\n\nInput HTML:\n\n```html\n<!DOCTYPE html>\n<html>\n<head>\n<title>PoC</title>\n<script type=\"application/ld+json\">\n{\"@type\": \"Article\", \"text\": \"Long article text repeated many times to exceed the extracted content word count. Long article text repeated many times to exceed the extracted content word count. Long article text repeated many times to exceed the extracted content word count.\"}\n</script>\n</head>\n<body>\n<article><p>Short.</p></article>\n<div class=\"post-container\">\n <p>Extra text to inflate parent word count padding padding padding.</p>\n <div class=\"post-body\">\n Long article text repeated many times to exceed the extracted content word count. Long article text repeated many times to exceed the extracted content word count. Long article text repeated many times to exceed the extracted content word count.\n </div>\n <img width=\"800\" height=\"600\" src=\"https://example.com/photo.jpg\" alt='pwned\" onload=\"alert(document.cookie)'>\n</div>\n</body>\n</html>\n```\n\nOutput:\n\n```html\n<img src=\"https://example.com/photo.jpg\" alt=\"pwned\" onload=\"alert(document.cookie)\">\n```\n\nThe `onload` event handler is injected as a separate HTML attribute.\n\n### Impact\n\nXSS in any application that renders defuddle's HTML output (browser extensions, web clippers, reader modes). The attack requires crafted HTML with schema.org structured data that triggers the `_findContentBySchemaText` fallback, combined with a sibling image whose `alt` attribute contains a quote character followed by an event handler.\n\n### Suggested Fix\n\nUse DOM API instead of string interpolation:\n\n```typescript\nif (imageSrc) {\n const img = this.doc.createElement('img');\n img.setAttribute('src', imageSrc);\n img.setAttribute('alt', imageAlt);\n html += img.outerHTML;\n}\n```\n\nThis ensures attribute values are properly escaped by the DOM serializer.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:P"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "defuddle"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.9.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.7.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/kepano/defuddle/security/advisories/GHSA-5mq8-78gm-pjmq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-30830"
}, {
"type" : "WEB",
"url" : "https://github.com/kepano/defuddle/commit/f154cb740ee603431b69638273af737a27156df9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/kepano/defuddle"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-03-06T18:39:35Z",
"nvd_published_at" : "2026-03-07T06:16:11Z"
}
}