# CVE-2021-22540: XSS in Dart SDK

- Severity: Medium 6.1 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/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): 0.68%, higher than 53% of CVEs (2026-12-01)
- Published: 2021-04-22T14:15:17.000Z
- Modified: 2026-06-17T03:37:24.327Z
- Weaknesses: CWE-79
- Assigned by: Google

## Description

Bad validation logic in the Dart SDK versions prior to 2.12.3 allow an attacker to use an XSS attack via DOM clobbering. The validation logic in dart:html for creating DOM nodes from text did not sanitize properly when it came across template tags.

(As written by CVE List.)

## Affected

- Google LLC Dart SDK: from stable before 2.12.3
- dart dart_software_development_kit: before 2.12.3

## Every score

- NVD: CVSS:3.1 6.1 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N`
- NVD: CVSS:2.0 4.3 Medium `AV:N/AC:M/Au:N/C:N/I:P/A:N`

## References

- <https://github.com/dart-lang/sdk/security/advisories/GHSA-3rfv-4jvg-9522> (broken-link)
- <https://github.com/dart-lang/sdk/commit/ce5a1c2392debce967415d4c09359ff2555e3588> (patch, third-party-advisory)

## Sources

- CVE List: [CVE-2021-22540](https://www.cve.org/CVERecord?id=CVE-2021-22540), CVE Terms of Use, modified 2024-08-03
- NVD: [CVE-2021-22540](https://nvd.nist.gov/vuln/detail/CVE-2021-22540), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-22540 · Whole record: https://cve.day/CVE-2021-22540.json · Rebuilt by cve.day 2026-11-25T22:58:00.887Z
