npm package

sanitize-html 2.6.1 vulnerabilities, and the version that fixes all of them

sanitize-html 2.6.1 has 5 known vulnerabilities (1 rated high or critical); 2.17.7 fixes all of them.

npm (opens in a new tab) describes it as “Clean up user-submitted HTML, preserving allowlisted elements and allowlisted attributes on a per-element basis”

Known vulnerabilities
5
1 rated high or critical
Released
Dec 8, 2021
Latest is 2.18.1
Downloads last week
7.9K
Under 1% of sanitize-html downloads
Licence
MIT
Pulls in
14 packages
Resolved by deps.dev

What to upgrade to

2.17.7 is the closest release with no known vulnerabilities.

  • 2.17.7Upgrade to this

    Fixes all 5 known vulnerabilities. Released Aug 13, 2026.

    No known vulnerabilities
  • 2.18.1

    Newest 2.x release and the latest release. Released Oct 14, 2026.

    No known vulnerabilities

2.17.7 came out on Aug 13, 2026. A coding agent trained before then doesn’t know it exists, so it may suggest an older release. AI knowledge cutoff dates

Hand the fix to your coding agent

One task with the upgrade, the file to change and why. Paste it into Claude Code, Cursor or Codex.

Findings

Every advisory for sanitize-html 2.6.1

Known exploited first (CISA KEV), then by how likely they are to be exploited (FIRST EPSS), then by severity. Each id links to its OSV.dev record.

  1. CriticalCVE-2022-25887 on OSV.dev (opens in a new tab)GHSA-cgfm-xwp7-2cvrEPSS: top 28%

    Sanitize-html Vulnerable To REDoS Attacks

    Fixed in 2.7.1. Published Aug 31, 2022.

  2. WarningCVE-2024-21501 on OSV.dev (opens in a new tab)GHSA-rm97-x556-q36hEPSS: top 38%

    sanitize-html Information Exposure vulnerability

    Fixed in 2.12.1. Published Feb 24, 2024.

  3. WarningCVE-2026-63670 on OSV.dev (opens in a new tab)GHSA-jxwj-j7wr-gfrwEPSS: top 76%

    ApostropheCMS: Mutation-XSS / allowedTags bypass via literal `</textarea/>` solidus close

    Fixed in 2.17.6. Published Sep 3, 2026.

  4. WarningCVE-2026-84371 on OSV.dev (opens in a new tab)GHSA-g8qq-57p8-ggw5EPSS: top 79%

    ApostropheCMS: Stored XSS via SVG SMIL URI-list scheme-policy bypass

    Fixed in 2.17.7. Published Sep 1, 2026.

  5. WarningCVE-2026-53606 on OSV.dev (opens in a new tab)GHSA-vccv-cmxp-4j9hEPSS: top 88%

    sanitize-html has incomplete URI scheme validation in that allows javascript: URIs through action, formaction, data, poster, and background attributes

    Fixed in 2.17.5. Published Jul 31, 2026.

Who is still on a vulnerable sanitize-html

49% of last week’s 11.8M sanitize-html downloads went to versions with known vulnerabilities.

From npm’s per-version download counts for the last 7 days, each version checked against OSV.dev. The versions checked cover over 99% of downloads.

Is sanitize-html the only one?

Paste a public GitHub repo or drop your package.json and see every vulnerable, end-of-life or deprecated dependency, with one fix task. Free, no sign-up.

Check your whole repo

How this page is checked

StackPrism asks OSV.dev which advisories affect exactly sanitize-html 2.6.1, merges duplicates filed under several ids, and ranks them with CISA’s Known Exploited Vulnerabilities list and FIRST EPSS. Release dates and deprecation come from deps.dev and npm. No AI writes this page: every sentence comes from that data, refreshed every few hours.

Last checked against npm, OSV.dev, deps.dev, CISA KEV and FIRST EPSS.