Skip to content
Fencer Vulns
medium 5.3

CVE-2021-26540 json

Improper Input Validation in sanitize-html

published 2021-02-08 5 y ago modified 2026-06-17 4 mo ago also GHSA-mjxr-4v3x-q3m4 , EUVD-2021-1141

cvss
5.3
version 3.1, NVD
cisa kev
Not listed
not in CISA's catalog
epss
1.8%
EPSS 1.8% chance of exploitation in 30 days, percentile 78%
public exploits
0
none known

Summary

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".

Patch / fix

  • npm sanitize-html 2.3.2
  • apostrophecms sanitize-html 2.3.2

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2021-26540 updated cvss 5.3

sanitize-html: improper validation of hostnames set by the "allowedIframeHostnames" option can lead to bypass hostname whitelist for iframe element

  • Red Hat OpenShift Service Mesh 2.0 servicemesh-prometheus
    affected: no fix available
  • Red Hat OpenShift Container Platform 4.8 openshift4/ose-console v4.8.0-202107010336.p0.git.188a490.assembly.stream, openshift4/ose-thanos-rhel8 v4.8.0-202106291913.p0.git.c358e96.assembly.stream
    fixed: vendor fix RHSA-2021:2438
  • Red Hat OpenShift Container Platform 4.9 openshift4/ose-prometheus v4.9.0-202109302016.p0.git.3197fa7.assembly.stream
    fixed: vendor fix RHSA-2021:3759
  • Red Hat OpenShift Container Platform 4.8 openshift4/ose-cli v4.8.0-202106291725.p0.git.1077b05.assembly.stream, openshift4/ose-pod v4.8.0-202107161820.p0.git.051ac4f.assembly.stream, openshift4/ose-etcd v4.8.0-202106152230.p0.git.aefa6bf.assembly.stream, openshift4/ose-tests v4.8.0-202107131424.p0.git.0d958c3.assembly.stream, openshift4/ose-coredns v4.8.0-202106291913.p0.git.642b46e.assembly.stream, openshift4/ose-grafana v4.8.0-202106291913.p0.git.b987e4b.assembly.stream, +134 more Red Hat OpenShift Container Platform 4.9 openshift4/ose-cli v4.9.0-202109302317.p0.git.96e95ce.assembly.stream, openshift4/ose-pod v4.9.0-202110080828.p0.git.894a78b.assembly.stream, openshift4/ose-etcd v4.9.0-202109302317.p0.git.5c1feaf.assembly.stream, openshift4/ose-console v4.9.0-202110130449.p0.git.8c077e4.assembly.rc.8, openshift4/ose-tests v4.9.0-202110011028.p0.git.6105395.assembly.stream, openshift4/ose-coredns v4.9.0-202109302317.p0.git.3cb11c0.assembly.stream, +141 more
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

Exploit prediction

1.77% chance of exploitation in the next 30 days, higher than 78% of all scored CVEs (FIRST EPSS, 2026-11-08).

Exploits and checks

  • advisory.checkmarx.net https://advisory.checkmarx.net/advisory/CX-2021-4309 referenced PoC, tagged "exploit" by a source, unverified

CVSS scores

assigned by version score vector
NVD 3.1 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
NVD 2.0 5.0 AV:N/AC:L/Au:N/C:N/I:P/A:N
GitHub 3.1 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Affected packages

ecosystem package affected fixed in
npm sanitize-html
<2.3.2
2.3.2

Classification

Weakness
  • CWE-20 Improper Input Validation

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.