secure.unico.io - postMessage Wildcard Vulnerability | HackerOne #3519772
web_auth_handler.js on secure.unico.io sends OAuth callback URLs
(containing authorization codes) via postMessage(location.href, "*") to ANY origin.
web_auth_handler.jspostMessage(location.href, "*") to this page (the attacker)?code= authorization code.
Source: secure.unico.io/.../web_auth_handler.js
window.onload = function() {
if (window.opener && window.opener !== window) {
(window.opener ?? window.parent)
.postMessage(location.href, "*");
}
};
Identical logic, runs on popup
window.onload = function() {
if (window.opener && window.opener !== window) {
(window.opener ?? window.parent)
.postMessage(location.href, "*");
}
};
web_auth_handler.js runs and sends ?code=REAL_CODE to this pagecurl -s "https://secure.unico.io/assets/packages/unico_core/web/plugins/web_auth_handler.js"
// Replace the wildcard "*" with an explicit trusted origin:
postMessage(location.href, "https://secure.unico.io");
// Or validate against a list of allowed origins:
const ALLOWED = ['https://secure.unico.io', 'https://app.unico.io'];
if (ALLOWED.includes(new URL(document.referrer).origin)) {
window.opener.postMessage(location.href, new URL(document.referrer).origin);
}
HackerOne Report #3519772 | Researcher: rcarpi | For authorized security testing only.