SOC166 — Javascript Code Detected in Requested URL
A web application's search parameter was not sanitised, allowing an attacker to attempt reflected cross-site scripting by injecting JavaScript into the URL. The firewall blocked every attempt with a redirect and empty response, so no script executed.
medium.com
Published on medium.com
Welcome to my first walkthrough, my name is Gustavo and I am part of the RTB TEAM, today we are here to carry out an investigation on an alert that was generated by the SIEM of a possible WebAttack from a url with encoded java script.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the search parameter was reflected into the page without proper output encoding, though the text only says the value was not validated and sanitised.
Impact
The firewall blocked all attempts with a redirect and empty response, so no script executed and the vulnerability was not successfully exploited.
What the attacker needed
Victim clicks a crafted link; search parameter reflects input
The fix
The application should properly validate and sanitise input and encode output to prevent script execution.
How it was found
- The attacker requested the home page and the about-us page, which returned normally.
- The attacker sent a harmless test value in the search parameter, which returned a success status.
- The attacker sent a JavaScript prompt command in the search parameter, which the firewall redirected.
- The attacker sent an image tag with an error handler in the search parameter, which the firewall redirected.
- The attacker sent an SVG with a script tag in the search parameter, which the firewall redirected.
- The attacker sent a script tag that iterates over window properties and evaluates them, which the firewall redirected.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Cross-site scripting (XSS) is when a website takes text from a visitor and puts it into a page without cleaning it first, so an attacker can sneak in code that runs in other visitors' browsers. Here the attacker tried several tricks to make the search page run a small script, but a protective filter (a firewall for web traffic) stopped each one.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.