> For the complete documentation index, see [llms.txt](https://unsbotch.gitbook.io/unsbotch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsbotch.gitbook.io/unsbotch/my-writeups/xssy/unscripted.md).

# Unscripted

Unscripted - medium challenge with 5 solutions.

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

As always we checking entry points of input on basic XSS payload:

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

<figure><img src="/files/9o67S16edVY7sYOcujbp" alt=""><figcaption></figcaption></figure>

We can mark:\
1\)our input is pasting to .innerHTML so thats mean we can trigger XSS

2\)open tag from \<img> was removed and maybe there is a filter and our goal to bypass it.

After some attempts to confuse filter by adding a lot of "<" symbols, encode to url, html and etc. it was not successful, i tried to escape from: `document.getElementById("div").innerHTML="`<mark style="color:red;">`img src=x onerror=alert()>`</mark>`"`&#x20;

By adding additional quotes and look at result:

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

Great! thats work, now we can just return alert;

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

After paste this payload in browser alert doesn't return we can check devtools:

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

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

We notice an error in `<script>` tag, I didn't pay enough attention to this and continued to use others ways to return alert.

Then i noticed that site using setTimeout and leaves open brackets.

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

This is exactly why the site gives a syntax error, so let's just close brackets and add 0 as agrument of setTimeout

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

`";%0avar bro = alert(document.cookie)},0);//`

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