“Day 28: The DOM Clobbering Coup — How I Turned a Simple Comment Box into a CSP Bypass”
通过利用DOM Clobbering攻击,作者在新闻网站上注入HTML结构以覆盖JavaScript全局变量和属性,成功绕过严格的内容安全策略(CSP),实现JavaScript劫持并获得3000美元赏金。 2025-9-5 05:51:20 Author: infosecwriteups.com(查看原文) 阅读量:2 收藏

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---4
如有侵权请联系:admin#unsafe.sh