# CVE-2021-26540: Improper Input Validation in sanitize-html

- Severity: Medium 5.3 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.77%, higher than 78% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2021-02-08T16:16:07.000Z
- Modified: 2026-06-17T03:43:27.400Z
- Also known as: GHSA-mjxr-4v3x-q3m4
- Weaknesses: CWE-20
- Assigned by: mitre

## Description

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

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- sanitize-html (npm): before 2.3.2
- apostrophecms sanitize-html: before 2.3.2

## Every score

- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N`
- NVD: CVSS:2.0 5.0 Medium `AV:N/AC:L/Au:N/C:N/I:P/A:N`

## References

- <https://advisory.checkmarx.net/advisory/CX-2021-4309> (exploit, patch, third-party-advisory, web)
- <https://github.com/apostrophecms/sanitize-html/blob/main/CHANGELOG.md#232-2021-01-26> (release-notes, third-party-advisory, web)
- <https://github.com/apostrophecms/sanitize-html/pull/460> (patch, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-26540> (advisory)

## Sources

- CVE List: [CVE-2021-26540](https://www.cve.org/CVERecord?id=CVE-2021-26540), CVE Terms of Use, modified 2024-08-03
- GitHub Advisory Database: [GHSA-mjxr-4v3x-q3m4](https://github.com/advisories/GHSA-mjxr-4v3x-q3m4), CC-BY-4.0, modified 2023-11-08
- NVD: [CVE-2021-26540](https://nvd.nist.gov/vuln/detail/CVE-2021-26540), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-26540 · Whole record: https://cve.day/CVE-2021-26540.json · Rebuilt by cve.day 2026-11-25T22:57:59.839Z
