Skip to content
Account takeover Write-up Intermediate

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.

elcapitano7x Follow

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.

Elcapitano, on medium.com

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

  1. Initiate a login request using the victim's email address.
  2. Use the 'Send Magic Link' feature to generate a login link.
  3. Intercept the generated link's request and modify the URL parameter to point to an attacker-controlled page.
  4. Wait for the victim to click the manipulated link.
  5. The token is transmitted to the attacker's server.
  6. 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.

More by elcapitano7x

View all

4 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.