Bypass Uppercase filters like a PRO (XSS Advanced Methods)

a code injection inside javascript code can be a headache… But nothing is impossible

While we are not working on Pentesting for companies, we love to Bug Hunting on Hackerone.

We founded a vulnerable section on a site, with some sort of google analytics code, vulnerable to a URL XSS.

And inside the javascript code:

Burp suite discovered, that adding “-alert(1)-” at the end of the URL (”-alert(1)-”, would be reflecting the XSS

and browser telling us unable to find function ALERT(1), the GET parameter is getting uppercased :(

So we started testing things to see what is filtered from the server: </script>, //, \, . [dots] aren’t available for use. But we can use everything else “,’,[,],{,}

Ok, now what? Let's find a payload that can work.

We ended up with a few solutions all related to the one. It was perfect no dots but very long.

Jsfuck from Martin Kleppe

Also in hackerone if you can execute an alert(1), is just a Low severity XSS, we wanted to escalate this vulnerability to High or Critical, which can be done with loading an external JS file that executes arbitrary web actions without the user interaction.

This is a WordPress payload, our goal was to load an external JS with something like this for this website, changing account password or email.

continuing to JsFuck payloads, a simple alert(1) got converted to:

That’s dope, pretty ugly and LONG. If i wanted to alert(document.cookie) its above 13000 characters long, I figured out that after 2500–2700 characters the webserver started returning Error 400.

So we started investigating how jsfuck works.

I started trying to execute part of this on Chrome, to see how it works.

so basically, we can scrap strings from the different type of vars, so we can get the lowercase letters from false, true, undefined, NaN, Infinity, etc.

So I managed to get the whole abecedary without using lowercase letters.

Also i was needing slashes and DOT, i was able to get the DOT from 1.1e+101 float value.

awesome we got the dot, now I was missing “/” and “g” because the uppercase filters so I decided to jsfuck do the work for me I was sacrificing 1200 chars but this payload was about 500–800 so I was in the 2400–2600 range from the http request.

Now that I have all chars is the fun part. Execution Execution Execution.

This was translated to fill.constructor(alert(1)) and we got our javascript executed with all uppercase letters! awesome!.

Hopefully, our vulnerable site was using jquery but loaded at the end of the HTML code, after this injection, so it will return function not found, we had to wait 3 seconds to load all dependencies and execute $.getScript to load our external JS file.

And it worked, after 3 seconds I got the test/test request showing up!!

so we URL encode it and our final payload was like

We loaded our external JS and our external JS was able to change the username password!, account takeover, severity raised from low (simple alert XSS), to High (account takeover) and bug bounty raised from 50 to 1000 USD, 20 times higher.

special thanks to Martin Kleppe. This wouldn’t be possible without their javascript discoverments.

It Security company from Argentina. Penetration Testing, Red Team, Bug Bounty, Training.