Going beyond Alert with XSS


In this post, I’m going to discuss three XSS cases that I have escalated its vulnerability to higher severity in order to assess the possible risks. As you can see in the following modals:

Case 1 (Account Takeover)

So there’s a login page available via modal:

There’s a parameter in URL named next, it redirects the user after a successful login. Here’s the vulnerable code:

As it takes the value and replaces it in location.href method, a simple JavaScript payload like javascript:alert() is enough to trigger XSS.

In this case the XSS payload runs in the login page which risks the exposing the end users’ password and username as they enter their credentials. In order to do so I explored the HTML DOM elements to see if there is any useful method to continue the scenario, evidently we can use the document and getElementById() method.

Here, we catch their id from the login form.

This code will take the username field value for us


Example of malicious link using getElementById() method:


Yet we are not able to get any further to get victims credentials, it only causes a popup alert on the victim’s browser, there are couple of ways to deliver end user input cross(to)our server, which is:

  1. XMLHttpRequest
  2. Fetch API
  3. Img src
  4. $.get (jQuery)
  5. etc

Before using any malicious crafted URL we should make sure that our server is able to capture the request which was sent on behalf of users’ browser

This one dumps the http request and by that the attacker will be able to steal other data like IP addresses and user agents besides the body.

Since the vulnerable target is using jQuery libary, I suggest using $.get() to send username/password field value to get sent over attackers server.

Final payload:


To make sure the payload is running efficiently, first we need to encode url Key characters. I suggest using encodeURIComponent

To avoid dealing with url encoding you can also execute the payload in base64 encoded format which I covered in case 2

Case 2 (PII leakage)

In this case, I have found a path that leads the URI value to get reflected inside the source page and JavaScript block, Here is the vulnerable code:

And here is the XSS payload I’m going to use:


Since the account_id value reflects inside a block, a payload like ;-alert () // would be enough for triggering XSS, but lets move on to more exciting parts and escalate this into something more than an alert , In the second scenario it’s not like the previous case where we could capture the credentials by triggering XSS in a login page, now we have to explore pages, looking for an endpoint to return personal data, etc. Due to the sensitive path we can use this request:


We have to send an HTTP POST request to the endpoint above, to do that we can use fetch() method this time. This payload will send the post request and return the response:

fetch('https://vulnerable.domain/brokerage/service/clientManagement/getClients?FUNCTION=Navigation&USERACTION=Client%20List', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'input_csrf_token': 17084748632633296 }, body: 'searchText=&page=1&start=0&limit=100' }).then(response => response.text())
  .then(data => alert(data));

We can see it worked just fine on the browser’s console. Next we are going to craft the malicious link to exploit the vulnerability. Here’s the base64 encoded payload:


Leveraging the eval function is enough to exploit the hole:


Tip: after applying base64 encode function on a payload, apply url encode to avoid parsing special characters such as + which means space after URL decode.

Case 3 (PII leakage + ATO)

Straight to the point, here’s the XSS vulnearbility:


Using XSS is not really effective in this page, so let’s dig an application a little bit more to find an endpoint or a page that may contain sensitive information of the user.

What are we going to do here? we should craft a malicious link to send a request on behalf of logged-in users to their profile panel, then we will catch the response.

Let’s use XMLHttpRequest

The final payload:


Let’s try an account takeover scenario. The website has update email feature. The image shows the request body to update email address:

You may notice there’s no CSRF protection here, if there was any protection, I would write a code to extract CSRF token since the XSS disables SOP. The payload to send HTTP POST request with a JSON body:

fetch('https://vulnerable.domain/custard/pubcustard/secure/customers', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: '{"customerProfile":{"contactInformation":{"postalAddress":{"street":"5 Nathan Falls","postalCode":"47222","city":"Port Luke"},"phoneNumber":"+353899675542"},"email":"attacker@email"}}' });

If the victim visits the link, It will lead up to changing their email address to attacker’s email. after that, the attacker will be able to use the forget password functionality to take over the account.


Many bug bounty programs deny the XSS escalation exploit scenarios and they won’t give credit to it therefore, I’ve accomplished to increase the severity and raise the bounty. In top of that, I believe XSS exploitation gives bug hunters and programs new insights.

P.s. Thanks to Bubanisepehr and AmirMSafari for the collaboration.

One thought on “Going beyond Alert with XSS

Leave a Reply

Your email address will not be published. Required fields are marked *