> For the complete documentation index, see [llms.txt](https://kunalwalavalkar.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kunalwalavalkar.gitbook.io/write-ups/portswigger-labs/client-side-topics/cross-site-scripting-xss/reflected-xss-into-attribute-with-angle-brackets-html-encoded.md).

# Reflected XSS into attribute with angle brackets HTML-encoded

https\://portswigger.net/web-security/cross-site-scripting/contexts/lab-attribute-angle-brackets-html-encoded

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F0Mr7H7DeA6p2KatlcoXi%2F1.png?alt=media&amp;token=8641657a-2991-418c-ab6b-5be336315641" alt=""><figcaption></figcaption></figure>

Let's insert the following payload in the search field:

```
test_payload
```

We can now open `Left CLick > Inspect` to open the developer tools and search our payload.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FQZuM52sAc1kakwgHj3b9%2F2.png?alt=media&amp;token=03b8638d-a769-437f-ab4f-d0249b78303c" alt=""><figcaption></figcaption></figure>

We can see that our `test_payload` has been inserted into the `value` attribute of the `<input>` tag.

In order to generate an alert, we need to first escape the `value` attribute and than add an `onmouseover` event attribute.

```
test_payload" onmouseover="alert(1)
```

The alert will be displayed only when we hover over the input field with our mouse.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FKENRZXQK2CWLghtrOQV6%2F3.png?alt=media&amp;token=c0cbe6d2-c368-425f-8422-13fd21ce2f44" alt=""><figcaption></figcaption></figure>

We have solved the lab.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FyoGFV8U0t0hasgNdXjss%2F4.png?alt=media&amp;token=6e5e06e7-9673-4284-bd99-68a873c04f4a" alt=""><figcaption></figcaption></figure>
