How I Turned a Magic Link Feature Into Account Takeover
The magic-link login flow validated the redirect destination by checking only whether the hostname ended with the target domain, so an attacker-controlled domain such as attackerredacted.com was accepted. An attacker could send a victim a legitimate-looking login email whose link redirected to the attacker's domain, where the login link containing the account credentials could be stolen.
Hi, I’m mrxw (Adem Ziane Berroudja), a bug bounty hunter on Bugcrowd.
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
Impact
An attacker could take over a victim's account by stealing the magic login link, and the report was triaged as P2 and paid.
What the attacker needed
Attacker-controlled domain ending with target name; victim clicks the magic login link
How it was found
- Intercept the request that generates the magic login link.
- Set the redirect-url parameter to an attacker-controlled domain that ends with the target domain name.
- Send the generated login email to the victim.
- The victim clicks the login button and is redirected to the attacker's domain.
- Capture the login link containing the values needed to sign in to 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 signs you in without a password. The site checked the redirect address by looking only at the end of the domain name, so a domain the attacker owned that ended with the same letters was treated as safe. The victim clicked a real-looking email link and was sent to the attacker's site, which could capture the login link and take over the account.
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.