DOM Based XSS via postMessage at https://inventory.upserve.com/login/
The login page at inventory.upserve.com listens for postMessage events and runs any code in the 'exec' property of the message data using eval, but only checks whether the sender's origin contains the string 'https://hq.upserve.com' anywhere. An attacker can host a page on a domain like hq.upserve.com.mydomain.com, send a crafted message, and execute arbitrary JavaScript in the context of the login page, potentially stealing credentials.
- Paid in 5 days
- Disclosed after 17 days
Summary by the program
Due to incomplete origin validation, DOM-based XSS was possible at https://inventory.upserve.com/login/ when receiving a postMessage.
The report
#Description DOM based XSS is possible at https://inventory.upserve.com/login/ due to insecure origin checking when receiving a postMessage.
#POC
- Visit https://hq.upserve.com.████████/upserve_xss.html
- Click link
- View alert on https://inventory.upserve.com
#Vulnerable Code
window.addEventListener("message", function(e) {
if (~e.origin.indexOf("https://hq.upserve.com")) {
if (e.data && typeof e.data == "object") {
try {
if (e.data["exec"]) {
eval(e.data["exec"]);
}
} catch (err) {
console.log(err);
}
} else {
console.log("Non-object passed");
}
} else {
console.log("Incorrect origin: " + e.origin.toString());
return;
}
});
The origin check simply determines if "https://hq.upserve.com" is anywhere in the origin so an origin like "https://hq.upserve.com.mydomain.com" will pass this check just fine.
Impact
Due to the page being a login page, login credentials could be logged and stolen when a victim goes to login.
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
The origin check uses a substring match (indexOf) instead of an exact comparison, so any origin containing the trusted string passes, and the message data is passed directly to eval.
Impact
Because the vulnerable page is a login page, an attacker could log and steal login credentials when a victim goes to log in.
What the attacker needed
Victim visits attacker page; attacker controls a domain containing the trusted string
How it was found
- Visit the attacker-controlled page hosted on a domain whose name contains the trusted origin string.
- Click the link on that page.
- Observe the alert box appear on the inventory.upserve.com login page.
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 login page was set up to accept messages from other websites and then run whatever code those messages contained. It tried to check that the message came from a trusted site, but the check was too loose: it only looked for the trusted site's name somewhere inside the sender's address. An attacker could register a similar-looking address that contains the trusted name and use it to send malicious code, which would then run on the login page and could steal what the victim types.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.