Skip to content

Commit 680dfa2

Browse files
Auto-update jsrepository: dompurify | GHSA-55q2-fjhq-7xh7 (#613)
Updated libraries (1): dompurify Updated vulnerability IDs (1): GHSA-55q2-fjhq-7xh7 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5d563bc commit 680dfa2

9 files changed

Lines changed: 169 additions & 0 deletions

‎repository/jsrepository-master.json‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5571,6 +5571,29 @@
55715571
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
55725572
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
55735573
]
5574+
},
5575+
{
5576+
"ranges": [
5577+
{
5578+
"atOrAbove": "0",
5579+
"below": "3.4.13"
5580+
}
5581+
],
5582+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
5583+
"details": "### Summary\n\nDuring `IN_PLACE` sanitization, a hook that removes an element can leave that element's detached descendants executable. A descendant image can retain its attacker-provided `onload` handler and fire after `sanitize()` returns, even though the returned root is clean and the image remains disconnected from the document.\n\n### Details\n\nIn DOMPurify 3.4.12, `_sanitizeElements()` in `src/purify.ts:1862-1904` runs the `beforeSanitizeElements` or `uponSanitizeElement` hook and returns immediately when the hook detached the current node. The return does not call `_neutralizeSubtree(currentNode)`.\n\nThe detached subtree is not added to `DOMPurify.removed`, so the post-walk `IN_PLACE` neutralization cannot reach it. If the browser queued a resource event while the application constructed the detached dirty root, a descendant can therefore retain its handler and execute after sanitization.\n\nThe hook only rejects the containing element and does not add or approve the event handler. DOMPurify's ordinary removal path de-arms the same queued event; only the hook-detachment early return skips the existing subtree neutralization.\n\n### PoC\n\nLoad the published `dompurify@3.4.12` `dist/purify.js` before this script in Chromium:\n\n```html\n<div id=\"result\">not fired</div>\n<script>\nconst root = document.createElement('div');\nroot.innerHTML = `\n <footer>\n <img src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n onload=\"result.textContent = 'XSS after sanitize'\">\n </footer>\n <div>safe</div>`;\n\nDOMPurify.setConfig({\n ALLOWED_TAGS: ['div', '#text', 'footer'],\n IN_PLACE: true\n});\nDOMPurify.addHook('uponSanitizeElement', node => {\n if (node.tagName === 'FOOTER') node.remove();\n});\n\nDOMPurify.sanitize(root);\ndocument.body.append(root);\n</script>\n```\n\n`sanitize()` returns with no handler execution and the returned root contains only the safe `div`. After the event loop advances, the original image remains disconnected but its retained `onload` changes the page to `XSS after sanitize`.\n\nAs the claim-matched control, use the same detached input with `ALLOWED_TAGS: ['div', '#text']` and no hook. DOMPurify's ordinary removal path removes the original image's handler, the returned root is still `<div>safe</div>`, and the marker does not fire.\n\n### Impact\n\nIn an application that uses `IN_PLACE` with the documented element-removal hook pattern, an attacker who can supply HTML can execute JavaScript in the integrating application's origin after the application sanitizes and renders that content.\n\nThe required non-default configuration is `IN_PLACE` plus a hook that removes a containing element. The hook does not add or approve the event handler, and the dirty root never needs to be connected before sanitization.\n\n### Suggested fix\n\nReuse the existing `_neutralizeSubtree(currentNode)` helper before returning from both hook-detachment branches in `_sanitizeElements()`. Add regressions for `beforeSanitizeElements` and `uponSanitizeElement` that retain a reference to a descendant resource element and verify that its event handler is removed after the hook detaches its ancestor.",
5584+
"identifiers": {
5585+
"githubID": "GHSA-55q2-fjhq-7xh7"
5586+
},
5587+
"severity": "medium",
5588+
"cwe": [
5589+
"CWE-79"
5590+
],
5591+
"info": [
5592+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
5593+
"https://github.com/cure53/DOMPurify/pull/1557",
5594+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
5595+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
5596+
]
55745597
}
55755598
],
55765599
"extractors": {

‎repository/jsrepository-v2.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5930,6 +5930,24 @@
59305930
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
59315931
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
59325932
]
5933+
},
5934+
{
5935+
"atOrAbove": "0",
5936+
"below": "3.4.13",
5937+
"severity": "medium",
5938+
"cwe": [
5939+
"CWE-79"
5940+
],
5941+
"identifiers": {
5942+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
5943+
"githubID": "GHSA-55q2-fjhq-7xh7"
5944+
},
5945+
"info": [
5946+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
5947+
"https://github.com/cure53/DOMPurify/pull/1557",
5948+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
5949+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
5950+
]
59335951
}
59345952
],
59355953
"extractors": {

‎repository/jsrepository-v3.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6027,6 +6027,24 @@
60276027
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
60286028
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
60296029
]
6030+
},
6031+
{
6032+
"atOrAbove": "0",
6033+
"below": "3.4.13",
6034+
"severity": "medium",
6035+
"cwe": [
6036+
"CWE-79"
6037+
],
6038+
"identifiers": {
6039+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
6040+
"githubID": "GHSA-55q2-fjhq-7xh7"
6041+
},
6042+
"info": [
6043+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
6044+
"https://github.com/cure53/DOMPurify/pull/1557",
6045+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
6046+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
6047+
]
60306048
}
60316049
],
60326050
"extractors": {

‎repository/jsrepository-v4.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6026,6 +6026,24 @@
60266026
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
60276027
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
60286028
]
6029+
},
6030+
{
6031+
"atOrAbove": "0",
6032+
"below": "3.4.13",
6033+
"severity": "medium",
6034+
"cwe": [
6035+
"CWE-79"
6036+
],
6037+
"identifiers": {
6038+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
6039+
"githubID": "GHSA-55q2-fjhq-7xh7"
6040+
},
6041+
"info": [
6042+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
6043+
"https://github.com/cure53/DOMPurify/pull/1557",
6044+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
6045+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
6046+
]
60296047
}
60306048
],
60316049
"extractors": {

‎repository/jsrepository-v5-combined.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6033,6 +6033,24 @@
60336033
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
60346034
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
60356035
]
6036+
},
6037+
{
6038+
"atOrAbove": "0",
6039+
"below": "3.4.13",
6040+
"severity": "medium",
6041+
"cwe": [
6042+
"CWE-79"
6043+
],
6044+
"identifiers": {
6045+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
6046+
"githubID": "GHSA-55q2-fjhq-7xh7"
6047+
},
6048+
"info": [
6049+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
6050+
"https://github.com/cure53/DOMPurify/pull/1557",
6051+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
6052+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
6053+
]
60366054
}
60376055
],
60386056
"extractors": {

‎repository/jsrepository-v5.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6032,6 +6032,24 @@
60326032
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
60336033
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
60346034
]
6035+
},
6036+
{
6037+
"atOrAbove": "0",
6038+
"below": "3.4.13",
6039+
"severity": "medium",
6040+
"cwe": [
6041+
"CWE-79"
6042+
],
6043+
"identifiers": {
6044+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
6045+
"githubID": "GHSA-55q2-fjhq-7xh7"
6046+
},
6047+
"info": [
6048+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
6049+
"https://github.com/cure53/DOMPurify/pull/1557",
6050+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
6051+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
6052+
]
60356053
}
60366054
],
60376055
"extractors": {

‎repository/jsrepository-v6-combined.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6101,6 +6101,25 @@
61016101
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
61026102
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
61036103
]
6104+
},
6105+
{
6106+
"atOrAbove": "0",
6107+
"below": "3.4.13",
6108+
"severity": "medium",
6109+
"cwe": [
6110+
"CWE-79"
6111+
],
6112+
"identifiers": {
6113+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
6114+
"githubID": "GHSA-55q2-fjhq-7xh7"
6115+
},
6116+
"details": "### Summary\n\nDuring `IN_PLACE` sanitization, a hook that removes an element can leave that element's detached descendants executable. A descendant image can retain its attacker-provided `onload` handler and fire after `sanitize()` returns, even though the returned root is clean and the image remains disconnected from the document.\n\n### Details\n\nIn DOMPurify 3.4.12, `_sanitizeElements()` in `src/purify.ts:1862-1904` runs the `beforeSanitizeElements` or `uponSanitizeElement` hook and returns immediately when the hook detached the current node. The return does not call `_neutralizeSubtree(currentNode)`.\n\nThe detached subtree is not added to `DOMPurify.removed`, so the post-walk `IN_PLACE` neutralization cannot reach it. If the browser queued a resource event while the application constructed the detached dirty root, a descendant can therefore retain its handler and execute after sanitization.\n\nThe hook only rejects the containing element and does not add or approve the event handler. DOMPurify's ordinary removal path de-arms the same queued event; only the hook-detachment early return skips the existing subtree neutralization.\n\n### PoC\n\nLoad the published `dompurify@3.4.12` `dist/purify.js` before this script in Chromium:\n\n```html\n<div id=\"result\">not fired</div>\n<script>\nconst root = document.createElement('div');\nroot.innerHTML = `\n <footer>\n <img src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n onload=\"result.textContent = 'XSS after sanitize'\">\n </footer>\n <div>safe</div>`;\n\nDOMPurify.setConfig({\n ALLOWED_TAGS: ['div', '#text', 'footer'],\n IN_PLACE: true\n});\nDOMPurify.addHook('uponSanitizeElement', node => {\n if (node.tagName === 'FOOTER') node.remove();\n});\n\nDOMPurify.sanitize(root);\ndocument.body.append(root);\n</script>\n```\n\n`sanitize()` returns with no handler execution and the returned root contains only the safe `div`. After the event loop advances, the original image remains disconnected but its retained `onload` changes the page to `XSS after sanitize`.\n\nAs the claim-matched control, use the same detached input with `ALLOWED_TAGS: ['div', '#text']` and no hook. DOMPurify's ordinary removal path removes the original image's handler, the returned root is still `<div>safe</div>`, and the marker does not fire.\n\n### Impact\n\nIn an application that uses `IN_PLACE` with the documented element-removal hook pattern, an attacker who can supply HTML can execute JavaScript in the integrating application's origin after the application sanitizes and renders that content.\n\nThe required non-default configuration is `IN_PLACE` plus a hook that removes a containing element. The hook does not add or approve the event handler, and the dirty root never needs to be connected before sanitization.\n\n### Suggested fix\n\nReuse the existing `_neutralizeSubtree(currentNode)` helper before returning from both hook-detachment branches in `_sanitizeElements()`. Add regressions for `beforeSanitizeElements` and `uponSanitizeElement` that retain a reference to a descendant resource element and verify that its event handler is removed after the hook detaches its ancestor.",
6117+
"info": [
6118+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
6119+
"https://github.com/cure53/DOMPurify/pull/1557",
6120+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
6121+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
6122+
]
61046123
}
61056124
],
61066125
"extractors": {

‎repository/jsrepository-v6.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6100,6 +6100,25 @@
61006100
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
61016101
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
61026102
]
6103+
},
6104+
{
6105+
"atOrAbove": "0",
6106+
"below": "3.4.13",
6107+
"severity": "medium",
6108+
"cwe": [
6109+
"CWE-79"
6110+
],
6111+
"identifiers": {
6112+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
6113+
"githubID": "GHSA-55q2-fjhq-7xh7"
6114+
},
6115+
"details": "### Summary\n\nDuring `IN_PLACE` sanitization, a hook that removes an element can leave that element's detached descendants executable. A descendant image can retain its attacker-provided `onload` handler and fire after `sanitize()` returns, even though the returned root is clean and the image remains disconnected from the document.\n\n### Details\n\nIn DOMPurify 3.4.12, `_sanitizeElements()` in `src/purify.ts:1862-1904` runs the `beforeSanitizeElements` or `uponSanitizeElement` hook and returns immediately when the hook detached the current node. The return does not call `_neutralizeSubtree(currentNode)`.\n\nThe detached subtree is not added to `DOMPurify.removed`, so the post-walk `IN_PLACE` neutralization cannot reach it. If the browser queued a resource event while the application constructed the detached dirty root, a descendant can therefore retain its handler and execute after sanitization.\n\nThe hook only rejects the containing element and does not add or approve the event handler. DOMPurify's ordinary removal path de-arms the same queued event; only the hook-detachment early return skips the existing subtree neutralization.\n\n### PoC\n\nLoad the published `dompurify@3.4.12` `dist/purify.js` before this script in Chromium:\n\n```html\n<div id=\"result\">not fired</div>\n<script>\nconst root = document.createElement('div');\nroot.innerHTML = `\n <footer>\n <img src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n onload=\"result.textContent = 'XSS after sanitize'\">\n </footer>\n <div>safe</div>`;\n\nDOMPurify.setConfig({\n ALLOWED_TAGS: ['div', '#text', 'footer'],\n IN_PLACE: true\n});\nDOMPurify.addHook('uponSanitizeElement', node => {\n if (node.tagName === 'FOOTER') node.remove();\n});\n\nDOMPurify.sanitize(root);\ndocument.body.append(root);\n</script>\n```\n\n`sanitize()` returns with no handler execution and the returned root contains only the safe `div`. After the event loop advances, the original image remains disconnected but its retained `onload` changes the page to `XSS after sanitize`.\n\nAs the claim-matched control, use the same detached input with `ALLOWED_TAGS: ['div', '#text']` and no hook. DOMPurify's ordinary removal path removes the original image's handler, the returned root is still `<div>safe</div>`, and the marker does not fire.\n\n### Impact\n\nIn an application that uses `IN_PLACE` with the documented element-removal hook pattern, an attacker who can supply HTML can execute JavaScript in the integrating application's origin after the application sanitizes and renders that content.\n\nThe required non-default configuration is `IN_PLACE` plus a hook that removes a containing element. The hook does not add or approve the event handler, and the dirty root never needs to be connected before sanitization.\n\n### Suggested fix\n\nReuse the existing `_neutralizeSubtree(currentNode)` helper before returning from both hook-detachment branches in `_sanitizeElements()`. Add regressions for `beforeSanitizeElements` and `uponSanitizeElement` that retain a reference to a descendant resource element and verify that its event handler is removed after the hook detaches its ancestor.",
6116+
"info": [
6117+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
6118+
"https://github.com/cure53/DOMPurify/pull/1557",
6119+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
6120+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
6121+
]
61036122
}
61046123
],
61056124
"extractors": {

‎repository/jsrepository.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5880,6 +5880,24 @@
58805880
"https://github.com/cure53/DOMPurify/commit/a9ca1e537422319a557a9a2aa61f003b23b4a197",
58815881
"https://github.com/cure53/DOMPurify/releases/tag/3.4.12"
58825882
]
5883+
},
5884+
{
5885+
"atOrAbove": "0",
5886+
"below": "3.4.13",
5887+
"severity": "medium",
5888+
"cwe": [
5889+
"CWE-79"
5890+
],
5891+
"identifiers": {
5892+
"summary": "DOMPurify: IN_PLACE hook removal leaves a detached subtree executable, causing XSS",
5893+
"githubID": "GHSA-55q2-fjhq-7xh7"
5894+
},
5895+
"info": [
5896+
"https://github.com/cure53/DOMPurify/security/advisories/GHSA-55q2-fjhq-7xh7",
5897+
"https://github.com/cure53/DOMPurify/pull/1557",
5898+
"https://github.com/cure53/DOMPurify/commit/3067f7746769",
5899+
"https://github.com/cure53/DOMPurify/releases/tag/3.4.13"
5900+
]
58835901
}
58845902
],
58855903
"extractors": {

0 commit comments

Comments
 (0)