> 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="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FnGbBNMumVD6puRZDHjLM%2Fimage.png?alt=media&amp;token=5ac5b01b-25d5-43b9-9742-fd3bf65ec207" 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="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FwqvbBEsc70xh0COFp4mb%2Fimage.png?alt=media&amp;token=48fd50ea-a47e-4289-a1da-eb019ad8a21b" 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="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2FXswS89YFGXRqFIppxJ2O%2Fimage.png?alt=media&amp;token=91947867-f677-49a7-b679-1f3ac4baae02" 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="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2Fu3aYAoZB8Lk1RixlNtQA%2Fimage.png?alt=media&amp;token=8f39f6c2-d71d-43e8-b804-d61e6072bfa6" alt=""><figcaption></figcaption></figure></div>

and we have solved the lab

<div align="left"><figure><img src="https://1410593648-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYI2noEqPw69jd0hR7Prp%2Fuploads%2F24SQx59WR0fqQldrLKrA%2Fimage.png?alt=media&amp;token=adc7fed1-a36a-4f9d-bf6d-81e9d994e4e5" alt=""><figcaption></figcaption></figure></div>
