> For the complete documentation index, see [llms.txt](https://sayonara.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sayonara.gitbook.io/writeups/portswigger/xss/7-reflected-xss-into-attribute-with-angle-brackets-html-encoded.md).

# 7) Reflected XSS into attribute with angle brackets HTML-encoded

<div align="left"><figure><img src="/files/NINkhGeP83OfKQOeschA" alt=""><figcaption></figcaption></figure></div>

As a first step, I perform a search and check the result. The response contains the search term in two places.

<div align="left"><figure><img src="/files/h0Q9aY7sqJNrnlEq3N4k" alt=""><figcaption></figcaption></figure></div>

if we try to escape the value and inject img payload or script payload because the app encodes the brackets&#x20;

* **<** becomes **\&lt;**
* **>** becomes **\&gt;**

<div align="left"><figure><img src="/files/BRex4Hgt6FJn75H1qQhT" alt=""><figcaption></figcaption></figure></div>

so what we wanna do is to escape the value and add another attribute which the onmouseover to execute code without the user interaction

```markup
foooo"onmouseover="alert(1)"
```

click on search and now if we inspect the input it will be like this

<div align="left"><figure><img src="/files/YpH6K4ElYCZCcui79Kok" alt=""><figcaption></figcaption></figure></div>

and we have solved the lab

<div align="left"><figure><img src="/files/Bm3gKangxqVSJh6agfnW" alt=""><figcaption></figcaption></figure></div>


---

# 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://sayonara.gitbook.io/writeups/portswigger/xss/7-reflected-xss-into-attribute-with-angle-brackets-html-encoded.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.
