Authentication Bypass via Insecure redirect_url Parameter Leading to Account Takeover
The platform's magic-link authentication flow trusted a client-supplied UUID in the redirect_url parameter to decide which account to load, without checking that the UUID belonged to the email in the validated JWT. An attacker could sign up with a victim's email to learn their UUID, then use their own valid magic link with the victim's UUID swapped in to take over the victim's account.
Published on medium.com
This writeup is about an authentication bypass I found in a platform using magic link based passwordless authentication. The bug wasn’t in the magic link service itself the JWT validation worked fine.
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
The server validated the JWT but then loaded the account using a user-supplied UUID from redirect_url without verifying that the UUID belonged to the email in the JWT.
Impact
Any registered user on the platform could be taken over with no victim interaction beyond having an account, provided the attacker knows the victim's email.
What the attacker needed
Victim has an account; attacker knows victim's email; attacker has own valid magic link
The fix
The server should derive the account from the email in the validated JWT rather than trusting a client-supplied UUID in redirect_url.
How it was found
- Submit the victim's email to the signup flow and note the UUID in the redirect_url response.
- Sign up with the attacker's own email and receive a valid magic link containing the attacker's JWT and UUID.
- Replace the UUID in the magic link's redirect_url with the victim's UUID.
- Open the modified link; the server validates the attacker's JWT and loads 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. Here, after the link was checked, the site used a user ID taken from the web address to pick which account to open, instead of using the email from the verified login token. Because that ID was not checked against the token, changing it let the attacker open someone else's account.
What is IDOR?
One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.