Security and Privacy of Social Logins (II): PostMessage Security in Single Sign-On
The blog post describes three vulnerabilities in Single Sign-On (SSO) implementations that use the postMessage API. Attackers could exploit missing origin checks, insufficient destination checks, and improper input validation to achieve DOM-based XSS or account takeover on affected websites.
Published on web-in-security.blogspot.com
This post is the second out of three blog posts summarizing my (Louis Jannett) research on the design, security, and privacy of real-world Single Sign-On (SSO) implementations. It is based on my master's thesis that I wrote between April and October 2020 at the Chair for Network and Data Security.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the vulnerabilities stem from missing or flawed origin validation, destination checks, and input validation in postMessage event listeners and senders within SSO flows.
Impact
The vulnerabilities could allow an attacker to achieve DOM-based XSS or full account takeover on affected websites, but exploitation required the victim to visit a malicious site and be logged in with valid consent.
What the attacker needed
Victim visits malicious website; victim logged in to IdP; victim has valid consent
The fix
The vulnerabilities were fixed by implementing proper origin validation, destination checks, and input validation, such as using domain whitelists and secure regular expressions.
How it was found
- Attacker creates a malicious website that opens the target's SSO login page in a popup.
- The malicious site sends a crafted postMessage to the popup or listens for messages from it.
- Due to missing or weak validation, the target processes the message and either executes attacker-controlled JavaScript or leaks authentication tokens.
- The attacker uses the leaked token or executed script to take over the victim's account or perform actions as the victim.
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 write-up has not been written yet. The Original tab links to the source.
Single Sign-On (SSO) lets you log in to many websites using one account, like Google or Facebook. These websites often use a browser feature called postMessage to pass login information between windows. If the website doesn't check who sent or received that information properly, an attacker can trick it into giving them your login token or running malicious code.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.