Skip to content
Heist/ feed
Back to feed
Medium

Security advisory

Type: advisorySources: OSVCVE: CVE-2021-22540

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2021-22540
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 11:28 UTC · Revision 1

Source evidence

CVE-2021-22540

core-osv · Original source

Published 22 Apr 2021, 15:15 UTC

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.

osv:CVE-2021-22540
Complete source record
{
  "id": "359e50a4a3f8be76d6df0af31adbcd9f36c8dad526cd669e296ea70ed37d02d5",
  "url": "https://osv.dev/vulnerability/CVE-2021-22540",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "CVE-2021-22540",
    "summary": "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.",
    "evidence": "osv:CVE-2021-22540",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2021-22540",
      "aliases": [
        "CVE-2021-22540",
        "GHSA-3rfv-4jvg-9522"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/dart-lang/sdk",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "7c8c6b3053d0ba91fcf15f81c45650184dc27e88"
                },
                {
                  "fixed": "ce5a1c2392debce967415d4c09359ff2555e3588"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:dart:dart_software_development_kit:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "2.12.3"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "ce5a1c2392debce967415d4c09359ff2555e3588"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.12.2",
            "2.12.1",
            "2.12.0",
            "2.10.5",
            "2.10.4",
            "2.10.3",
            "2.10.2",
            "2.10.1",
            "2.10.0",
            "2.9.3",
            "2.9.2",
            "2.9.1",
            "2.9.0",
            "2.8.4",
            "meta-v1.3.0-nullsafety.2",
            "meta-v1.3.0-nullsafety.1",
            "2.8.3",
            "2.8.2",
            "2.8.1",
            "2.7.2",
            "2.7.1",
            "2.7.0",
            "2.6.1",
            "2.6.0",
            "2.5.2",
            "2.5.1",
            "2.5.0",
            "2.4.1",
            "2.4.0",
            "2.3.2",
            "2.3.1",
            "2.3.0",
            "2.2.0",
            "2.1.1",
            "2.1.0",
            "merge_analyzer_branch",
            "2.0.0",
            "analyzer-0.33.0",
            "1.24.3",
            "analyzer-0.32.4",
            "analyzer-0.32.0",
            "analyzer-0.31.2-alpha.2",
            "analyzer-0.31.2-alpha.1",
            "analyzer-0.31.2-alpha.0",
            "analyzer-0.31.1",
            "analyzer-0.31.0+1",
            "analyzer-0.31.0",
            "1.24.2",
            "1.24.1",
            "1.24.0",
            "1.23.0",
            "1.22.1",
            "1.22.0",
            "1.21.1",
            "1.21.0",
            "1.20.1",
            "1.20.0",
            "1.19.1",
            "1.19.0",
            "1.18.1",
            "1.18.0",
            "1.17.1",
            "1.17.0",
            "1.16.1",
            "1.16.0",
            "1.15.0",
            "1.14.2",
            "1.14.1",
            "1.14.0",
            "1.13.2",
            "1.13.1",
            "1.13.0",
            "1.12.2",
            "1.12.1",
            "1.12.0",
            "1.11.3",
            "1.11.2",
            "1.11.1",
            "1.11.0",
            "1.11.0-dev.5.7",
            "1.11.0-dev.5.6",
            "1.11.0-dev.5.5",
            "1.11.0-dev.5.4",
            "1.11.0-dev.5.3",
            "1.11.0-dev.5.2",
            "1.11.0-dev.5.1",
            "1.11.0-dev.5.0",
            "1.11.0-dev.4.0",
            "1.11.0-dev.3.0",
            "1.11.0-dev.2.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-22540.json"
          }
        }
      ],
      "modified": "2026-10-20T10:54:21.520726335Z",
      "provider": "osv",
      "references": [
        "https://github.com/dart-lang/sdk/security/advisories/GHSA-3rfv-4jvg-9522",
        "https://github.com/dart-lang/sdk/commit/ce5a1c2392debce967415d4c09359ff2555e3588"
      ],
      "provider_metadata": {}
    },
    "related_cves": [
      {
        "value": "CVE-2021-22540",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 385154,
  "published_at": "2021-04-22T15:15:07.93+00:00"
}