DOM Based XSS in www.hackerone.com via PostMessage (bypass of #398054)
The fix for a DOM-based XSS in HackerOne's Marketo integration used an origin check that only compared the start of the origin string, so an attacker could bypass it by registering a domain like app-sj17.ma. This allowed JavaScript execution in the context of www.hackerone.com for users on browsers without CSP support.
Originally disclosed on HackerOne
- Triaged in 31 hours
- Fixed in 2 months
- Paid in 2 months
- Disclosed after 2 months
Summary
The security fix by Marketo to resolve the issue reported by @adac95 in #398054 can be bypassed by purchasing an .ma domain for €60.
Description
The issues described by @adac95 in #398054 remain insufficiently resolved because of an inadequate security check by Marketo in the following piece of JavaScript in forms2.min.js
if (a.originalEvent && a.originalEvent.data && 0 === i.indexOf(a.originalEvent.origin)) {
var b;
try {
b = j.parseJSON(a.originalEvent.data)
} catch (c) {
return
}
b.mktoReady ? f() : b.mktoResponse && e(b.mktoResponse)
}
Since the variable i resolves to https://app-sj17.marketo.com/[...], an attacker can bypass this check by registering the Marcarian domain app-sj17.ma for €60. I have done so for the sake of a good POC, but the registration process is slow. I will comment on this issue when the POC is live.
Steps To Reproduce
- Wait for the POC to be live (registration of my .ma domain is in progress)
- Browse to my POC running on https://app-sj17.ma/marketo/post2.html (note that this is literally the POC written by @adac95)
- Note the malicous redirect is still successfully executed;
Impact
An attacker could be able to execute JavaScript in the context of the www.hackerone.com application, if the victim user makes use of a browser which does not support CSP. The attacker could also perform a limited phishing attack in Firefox or Microsoft Edge.
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 used a simple string prefix match (indexOf) instead of an exact match, allowing a domain like app-sj17.ma to pass as app-sj17.marketo.com.
Impact
An attacker could execute JavaScript in the context of www.hackerone.com if the victim uses a browser without CSP support, and could also perform a limited phishing attack in Firefox or Microsoft Edge.
What the attacker needed
Victim visits attacker-controlled page; victim uses browser without CSP; attacker registers similar domain
The fix
The origin check should be made adequate rather than a prefix match.
How it was found
- Wait for the POC to be live (registration of the .ma domain is in progress)
- Browse to the POC running on https://app-sj17.ma/marketo/post2.html
- Note the malicious redirect is still successfully executed
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 used a third-party script that checked if messages came from a trusted domain. The check was flawed because it only looked at the beginning of the domain name, so an attacker could buy a similar-looking domain and send malicious messages. This let the attacker run their own code on the victim's browser when visiting the site.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.