“Day 28: The DOM Clobbering Coup — How I Turned a Simple Comment Box into a CSP Bypass”
文章描述了一种通过利用DOM Clobbering技术,在允许的HTML标签中注入特定ID或NAME属性的元素,覆盖目标页面的全局JavaScript变量或方法,从而绕过严格的CSP策略,并执行恶意操作的方法。这种方法成功获得了漏洞赏金。 2025-9-5 05:51:20 Author: infosecwriteups.com(查看原文) 阅读量:5 收藏

Hijacking JavaScript with Nothing But HTML and a Quirk of the Browser

Aman Sharma

Welcome to Day 28! Today’s vulnerability is one of my favorites because it feels like magic. The target was a news site with a strict Content Security Policy (CSP) that blocked all inline scripts and only allowed scripts from trusted domains. This made classic XSS nearly impossible. The site had a comment section that allowed limited HTML tags (<a>, <img>, <div>). My goal wasn't to inject script; it was to inject structure. By abusing an ancient browser behavior called DOM Clobbering, I was able to hijack the page's JavaScript without executing a single line of code myself. The result was a full CSP bypass and a $3000 bounty.

FREE LINK

Press enter or click to view image in full size

What is DOM Clobbering?

DOM Clobbering is an attack where HTML injection is used to overwrite JavaScript properties and variables in the global scope. It exploits the fact that browsers automatically create references to HTML elements with id or name attributes in the global window object.

The Magic Trick:

If you inject <a id="config">, you can access it in JavaScript as window.config. If the app has a variable


文章来源: https://infosecwriteups.com/day-28-the-dom-clobbering-coup-how-i-turned-a-simple-comment-box-into-a-csp-bypass-109af0e954a6?source=rss----7b722bfd1b8d--bug_bounty
如有侵权请联系:admin#unsafe.sh