Magic No More: Exposing Flaws in Magic Link Authentication
The magic link login feature allowed an attacker to modify a URL parameter so the victim is redirected to an attacker-controlled page, which then receives the login token. The attacker could use that token to impersonate the victim and access their account.
Published on medium.com
The security flaw lies within the “Send Magic Link” feature of the application. Exploiting this vulnerability involves altering the URL parameter embedded in the magic link, allowing attackers to steer victims to a designated destination, often a malicious webpage under their control.
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 magic link's redirect URL parameter was not validated against an allowlist, so the token was sent to an attacker-chosen destination.
Impact
An attacker could take over a victim's account by stealing the magic link token, but the attack requires the victim to click the manipulated link.
What the attacker needed
Victim clicks a link; attacker can intercept the magic link request
The fix
The redirect URL parameter in magic links should be validated against an allowlist of trusted destinations.
How it was found
- Initiate a login request using the victim's email address.
- Use the 'Send Magic Link' feature to generate a login link.
- Intercept the generated link's request and modify the URL parameter to point to an attacker-controlled page.
- Wait for the victim to click the manipulated link.
- The token is transmitted to the attacker's server.
- Use the token to access the victim's account.
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.
A magic link is a login link sent by email that lets you sign in without a password. The problem was that the link included a web address that could be changed, so clicking it sent the secret login token to a different website. That let the attacker log in as the victim.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.