CVE-2025-29771: @jitbit/htmlsanitizer Cross-Site Scripting Vulnerability
MODERATECVE-2025-29771 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @jitbit/htmlsanitizer libraries in the npm ecosystem. The issue involves js html sanitizer allows xss when used with contenteditable. Remediation is available by upgrading affected packages to version 2.0.3.
CVE-2025-29771 at a Glance
How to Fix CVE-2025-29771
To remediate this vulnerability, upgrade all affected @jitbit/htmlsanitizer 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 @jitbit/htmlsanitizer@2.0.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @jitbit/htmlsanitizer
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-29771, inspect your project dependencies using npm:
npm ls @jitbit/htmlsanitizer
Analyze the terminal output to locate any version of @jitbit/htmlsanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.3), your application is affected.
Note: The npm ls @jitbit/htmlsanitizer 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 @jitbit/htmlsanitizer, 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-2025-29771 Affected @jitbit/htmlsanitizer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@jitbit/htmlsanitizer
|
npm |
< 2.0.3
|
2.0.3
|
References
Frequently Asked Questions
What is CVE-2025-29771?
Which @jitbit/htmlsanitizer versions are affected?
What version fixes CVE-2025-29771?
Is @jitbit/htmlsanitizer affected?
What CWE is associated with CVE-2025-29771?
How can I check npm dependencies for CVE-2025-29771?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vhv4-fh94-jm5x",
"modified" : "2025-03-14T21:41:26Z",
"published" : "2025-03-14T19:54:52Z",
"aliases" : [ "CVE-2025-29771" ],
"summary" : "JS Html Sanitizer allows XSS when used with contentEditable",
"details" : "### Impact\nXSS vulnerability when the sanitizer is used with a `contentEditable` element to set the elements `innerHTML` to a sanitized string produced by the package. If the code is particularly crafted to abuse the code beautifier, that runs AFTER sanitation.\n\n### Patches\nPatched in version 2.0.3",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@jitbit/htmlsanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/jitbit/HtmlSanitizer/security/advisories/GHSA-vhv4-fh94-jm5x"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-29771"
}, {
"type" : "WEB",
"url" : "https://github.com/jitbit/HtmlSanitizer/commit/af6d2a78877e7277cd01c825b7fb50edb5956963"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/jitbit/HtmlSanitizer"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-03-14T19:54:52Z",
"nvd_published_at" : "2025-03-14T19:15:48Z"
}
}