{"id":"CVE-2026-65903","aliases":["CVE-2026-65903","GHSA-39q2-94rc-95cp"],"related":[],"kind":"vulnerability","state":"published","title":"DOMPurify before 3.4.0 ADD_TAGS Function Bypasses FORBID_TAGS","summary":"DOMPurify before 3.4.0 contains a logic error in the ADD_TAGS function where short-circuit evaluation allows forbidden tags to bypass FORBID_TAGS restrictions. Attackers can craft input containing tags listed in FORBID_TAGS that are also added via ADD_TAGS function, causing them to be retained in sanitized output.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"DOMPurify before 3.4.0 contains a logic error in the ADD_TAGS function where short-circuit evaluation allows forbidden tags to bypass FORBID_TAGS restrictions. Attackers can craft input containing tags listed in FORBID_TAGS that are also added via ADD_TAGS function, causing them to be retained in sanitized output.","source":"cvelist"},{"lang":"en","text":"## Summary\nIn `src/purify.ts:1117-1123`, `ADD_TAGS` as a function (via `EXTRA_ELEMENT_HANDLING.tagCheck`) bypasses `FORBID_TAGS` due to short-circuit evaluation.\n\nThe condition:\n```\n!(tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])\n```\nWhen `tagCheck(tagName)` returns `true`, the entire condition is `false` and the element is kept — `FORBID_TAGS[tagName]` is never evaluated.\n\n## Inconsistency\nThis contradicts the attribute-side pattern at line 1214 where `FORBID_ATTR` explicitly wins first:\n```\nif (FORBID_ATTR[lcName]) { continue; }\n```\nFor tags, FORBID should also take precedence over ADD.\n\n## Impact\nApplications using both `ADD_TAGS` as a function and `FORBID_TAGS` simultaneously get unexpected behavior — forbidden tags are allowed through. Config-dependent but a genuine logic inconsistency.\n\n## Suggested Fix\nCheck `FORBID_TAGS` before `tagCheck`:\n```\nif (FORBID_TAGS[tagName]) { /* remove */ }\nelse if (tagCheck(tagName) || ALLOWED_TAGS[tagName]) { /* keep */ }\n```\n\n## Affected Version\nv3.3.3 (commit 883ac15)","format":"markdown","source":"ghsa"},{"lang":"es","text":"DOMPurify anterior a la versión 3.4.0 contiene un error lógico en la función ADD_TAGS donde la evaluación de cortocircuito permite que las etiquetas prohibidas eludan las restricciones de FORBID_TAGS. Los atacantes pueden elaborar una entrada que contenga etiquetas listadas en FORBID_TAGS que también se añaden a través de la función ADD_TAGS, provocando que se retengan en la salida saneada.","source":"nvd"}],"published":"2026-04-16T00:46:35.000Z","modified":"2026-10-24T13:10:00.147Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.1,"rating":"MEDIUM"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":5.1,"rating":"MEDIUM"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N","rating":"MEDIUM"}],"cwes":["CWE-697","CWE-783"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.4.0","status":"affected"},{"type":"semver","version":"3.4.0","status":"unaffected"}],"vendor":"cure53","product":"DOMPurify","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.4.0"}],"ecosystem":"npm","package":"dompurify","purl":"pkg:npm/dompurify","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.4.0"}],"vendor":"cure53","product":"dompurify","cpe":"cpe:2.3:a:cure53:dompurify:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/cure53/DOMPurify/security/advisories/GHSA-39q2-94rc-95cp","tags":["exploit","third-party-advisory","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://www.vulncheck.com/advisories/dompurify-before-add-tags-function-bypasses-forbid-tags","tags":["third-party-advisory"],"sources":["cvelist","nvd"]},{"url":"https://github.com/cure53/DOMPurify","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-23T15:35:39.880Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-65903","url":"https://www.cve.org/CVERecord?id=CVE-2026-65903","licence":"CVE Terms of Use","modified":"2026-07-23T15:35:54.823Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-39q2-94rc-95cp","url":"https://github.com/advisories/GHSA-39q2-94rc-95cp","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:42.379Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-65903","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-65903","licence":"Public domain","modified":"2026-10-24T13:10:00.147Z"}],"updatedAt":"2026-11-25T22:59:29.929Z","epss":{"score":0.04128,"percentile":0.91051,"date":"2026-12-01T12:00:22.000Z"}}