secure.unico.io - postMessage Wildcard Vulnerability
web_auth_handler.js sends OAuth callback URLs
(containing authorization codes) via postMessage(location.href, "*") to ANY origin.
?code=) is sent to attacker via postMessage("*")Source: https://secure.unico.io/assets/packages/unico_core/web/plugins/web_auth_handler.js
AUTH_DESTINATION_KEY = "auth_destination_url",
AUTH_RESPONSE_KEY = "auth_info";
window.onload = function() {
if (window.opener && window.opener !== window) {
(window.opener ?? window.parent).postMessage(location.href, "*"); // VULNERABLE
} else {
let e = sessionStorage.getItem(AUTH_DESTINATION_KEY || "/");
sessionStorage.removeItem(AUTH_DESTINATION_KEY);
sessionStorage.setItem(AUTH_RESPONSE_KEY, window.location);
location.assign(e);
}
};
// Replace "*" with explicit origin:
postMessage(location.href, window.location.origin);
// Or validate against allowed origins:
const ALLOWED_ORIGINS = ['https://secure.unico.io', 'https://app.unico.io'];
if (ALLOWED_ORIGINS.includes(window.opener?.origin)) {
window.opener.postMessage(location.href, window.opener.origin);
}
HackerOne Report #3519772 | Researcher: rcarpi | For authorized security testing only.