Reflected XSS on ███████
The search page reflected the search term into a JavaScript string without proper sanitisation, allowing an attacker to break out of the string and execute arbitrary JavaScript. An attacker could steal data or perform actions in the victim's browser.
- Triaged in 2 days
- Fixed in 3 months
- Disclosed after 3 months
Summary
Reflected XSS on ████████.
Description
During my explorations I found █████████/search/node, which provides a basic search functionality. If we search something, the value is reflected and not properly sanitized. For example if we search ██████████/search/node/chron0x we can see in the javascript code:
[...]
<script>
//Early marking that the browser supports javascript
try {
document.getElementsByTagName('body')[0].classList.add("js");
} catch(E) {
document.getElementsByTagName('body')[0].className += " js";
}
var rootN = "https://████/████";
var whoisURL = "/█████████";
var eventTitle = "";
var ████; //Whether the person is on the receiving end of chats
var internalPath = 'search/node/chron0x';
</script>
[...]
Due to improper input sanitization, this is vulnerable to XSS. Inserting the payload ';alert('chron0x');' into the search field leads to
[...]
<script>
//Early marking that the browser supports javascript
try {
document.getElementsByTagName('body')[0].classList.add("js");
} catch(E) {
document.getElementsByTagName('body')[0].className += " js";
}
var rootN = "https://████/██████████";
var whoisURL = "/████";
var eventTitle = "";
var ████; //Whether the person is on the receiving end of chats
var internalPath = 'search/node/';alert('chron0x');'';
</script>
[...]
This pops an alert box, demonstrating XSS.
Note: I am reporting this here, since the footer of █████████ states Official United States ████ Website. The █████ ████████., and the United States ██████████ underlies the DoD. If this should not belong to the DoD scope I would kindly ask to self close this issue.
Step-by-step Reproduction Instructions
- Visit
https://██████████/search/node/%27%3Balert%28%27chron0x%27%29%3B%27
An alert box with chron0x pops.
I am attaching an image demonstrating the XSS.
Mitigation/Remediation Actions
Sanitize the input for the article parameter, such that certain characters are encoded or not allowed.
Impact
Medium - Data can be stolen, or Javascript can be executed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the search term was inserted into a JavaScript string without escaping quotes or other special characters.
Impact
An attacker could execute JavaScript in a victim's browser, potentially stealing data or performing actions on their behalf.
What the attacker needed
Victim clicks a crafted link
The fix
The input should be sanitised so that special characters are encoded or disallowed.
How it was found
- Visit the search URL with a crafted payload in the path.
- Observe that an alert box pops up.
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 report has not been written yet. The Original tab links to the source.
A website took what you typed into a search box and put it directly into a script on the page without cleaning it. By typing special characters, an attacker can make the browser run their own code, which can then steal information or act as the user.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.