CVE-2021-26540 is a medium-severity (CVSS 5.3) vulnerability in sanitize-html. 1 public exploit or proof-of-concept reference is indexed, so weaponization risk is real. A fix is available for sanitize-html — see the affected versions and patch details below.
Improper Input Validation in sanitize-html
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
sanitize-htmlnpmDescription
Apostrophe Technologies sanitize-html before 2.3.2 does not properly validate the hostnames set by the "allowedIframeHostnames" option when the "allowIframeRelativeUrls" is set to true, which allows attackers to bypass hostname whitelist for iframe element, related using an src value that starts with "/\example.com".
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | sanitize-html | all versions | 2.3.2npm install sanitize-html@2.3.2 |
Affected Products
sanitize-htmlapostrophecmsResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for sanitize-html, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update sanitize-html to 2.3.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-26540 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenShift Container Platform 4.8 | openshift4/ose-console:v4.8.0-202107010336.p0.git.188a490.assembly.stream | RHSA-2021:2438 |
| Red Hat OpenShift Container Platform 4.9 | openshift4/ose-prometheus:v4.9.0-202109302016.p0.git.3197fa7.assembly.stream | RHSA-2021:3759 |
Frequently Asked Questions
Is CVE-2021-26540 in your dependencies?
Find it across npm, including transitive dependencies.