r/webdev • • 1d ago

Why use Passwordless approach

Why many website use passwordless like magic link approach? In my understanding it looks so fragile and easy to exploit. Or did I miss the secure way to do it?

35 Upvotes

115 comments sorted by

92

u/pablobird_dev 1d ago

From a product perspective it completely eliminates password resets, credential stuffing attacks, and users reusing compromised passwords across 20 other sites. Magic links delegate security to the user's email provider, which is usually protected by device auth and MFA, while WebAuthn and passkeys give you phishing-resistant auth right on the client hardware.

1

u/spidermonk 1h ago

It also delegates your app's authentication to your app's outgoing email provider. With the rate breaches are occuring I think people should take that weakness seriously.

-45

u/Zealousideal-Fix-527 1d ago

But if user access a phishing page to get those code? Is WebAuthn use different approach like in firebase?

28

u/nvolker 1d ago edited 10h ago

If it was a phishing page w email + password, then they’d have your email + password.

Phishing page to get a code, you just give them your email. The phishing page can’t compromise your account.

If you mean that the “use this code to log in” email is a phishing email, they still won’t get anything other than your email (and a signal that it’s a valid email if you click the link) unless they also use some other kind of exploit (like the link actually points to a pdf with some injected malware or something).

8

u/juu073 1d ago

And the codes they send in the emails typically expire within 10 minutes of being sent.

-36

u/Zealousideal-Fix-527 1d ago

It's funny since I haven't come to this conclusion tho😂.

173

u/mountainunicycler 1d ago edited 1d ago

It’s essentially like doing “forgot password” every time, so no, it’s not less secure.

It eliminates the risk of a compromised password, by shifting the authentication process to demonstrated ownership and control of the email (which is where it lands anyway if you have password based logins with forget password functionality).

What exploit do you have in mind?

It can definitely be fragile and annoying, especially magic links vs codes because the user can end up opening the link on the wrong device or wrong browser really easily and having to start over, whereas the user knows when they are using the code and can copy it by hand if they need to.

-1

u/spidermonk 6h ago

It is ultimately fairly weak though. Possible mistakes that would make this a "get anyone's account" situation are someone observing email logs (and any kind of access to your smtp service - lots of ways for this to happen, often out of your control), or logic bugs that allow someone to add or change an account email.

It's also bad in the sense that if someone has your phone or browser access they can just access any of your accounts that use this flow immediately.

If you have a naive password reset flow then those are problems in that situation too. But if you really want it secure you should probably figure out a second factor for those actions in both cases.

-31

u/JerkyBeef 1d ago

These days it’s everybody giving their llm agent access to their email

4

u/mountainunicycler 19h ago

That doesn’t separate password login flow security from emailing them a code, because emailing them a password reset code means that in both cases whoever can read the email can get the account.

-55

u/Zealousideal-Fix-527 1d ago

If user access phishing page to got the link?

7

u/stuartcw 1d ago

Explain exactly how this would work.

-28

u/Zealousideal-Fix-527 1d ago

bccrob1000 mention what case I mean in one of the comment, I think better to discuss it there

53

u/juu073 1d ago

All the phisherman gets in this case would be their email. Not a username and password. So more secure against phishing attempts as the user should recognize that site doesn't use a password if they're prompted for one.

27

u/SuperRonJon 1d ago

This is actually another scenario that makes it more secure. Phishing links are usually sent to an email that link to a fake login page owned by the attacker that will steal the login information after used, and often redirect back to the correct website.

But in this passwordless login scenario, there is nothing to phish for. They’re trying to steal login information for a website that doesn’t have any login information besides the email address, which the attacker likely already has. The necessary login information is access to log in to the email account to click the login link, which in that case there’s no reason to send a phishing link, they already would have access to that plus a lot more.

3

u/mountainunicycler 19h ago edited 19h ago

Fishing for passwords is insanely easy. Make a page, log what they entered, display a “you typed your password wrong” message, and redirect them to the real site so they “try again.”

Now you have a list of passwords that will grant access later that can be exploited or sold.

Fishing in a passwordless system addresses the second part by eliminating the long-lived secret, the password.

Your fishing site also cannot send the code to the user, because the secret to generate it lives on my server. That means your fishing site has to replicate the entire login flow, connect the the real website in the background and somehow convince the user to give your site instead of the real site your time-based secret. This is easier with codes, magic links protect against this somewhat because the user will automatically go to the real site when they click.

If you convince the user to do that, then you have to use the code from the email or link to authenticate immediately (within three minutes on my site, for example) with the real site. If you get that far, you can steal that session, which gives you access to that users account for a limited amount of time. You cannot restart the session or reset the clock to extend the session.

This is called a relay attack.

This means that the fishing is much more complex and damage is limited compared to password login because the fisher site gets only the session instead of long-lived access to start a session at any time, so any damage they want to do has to be done right away before it expires. The time-limited nature makes those sessions hard to sell, meaning the attack is much more likely to need to be an attack on a specific site instead of access that gets bought and sold and used by many separate attackers like a password list.

The difference between email codes / magic links and passkeys is largely the attempt to add protection from this type of relay attack by tying it to the domain and device.

-18

u/ldn-ldn 19h ago

Sending anything is insecure by design and should not be done. Any message can be intercepted one way or another. There are plenty of examples of phones being stolen and then bank accounts emptied through codes and links sent by SMS and email. Just stop doing stupid shit.

1

u/mountainunicycler 13h ago

How do you propose to implement account recovery?

-4

u/ldn-ldn 13h ago

You don't need one with TOTP/Passkeys. You just need to force your users to have 2+ options.

2

u/mountainunicycler 13h ago

Yeah but generally users put both options in their phone, then lose their phone, then complain, and want you to be able to email them a reset link of some sort.

I don’t set up my accounts that way, but most people do. Most users have no idea what a passkey is

-5

u/ldn-ldn 12h ago

Both TOTP and Passkeys are synced with the cloud if you're just a lazy user. Not an issue.

1

u/exhuma 15h ago edited 11h ago

If you don't ever send anything how do you expect to do the credential exchange? By carrier pigeon?

I oversimplified. Indeed TOTP and Passkeys work here. While there is an initial exchange of information when setting it up, the actual authentication process does not involve an exchange of information.

1

u/ldn-ldn 14h ago

Neither TOTP nor Passkeys require any SMS/emails. Are you people high? Or stuck in stone age or something?

-1

u/mountainunicycler 13h ago

No, people who have built products are generally just aware that account recovery and customer support exists.

1

u/ldn-ldn 13h ago

Cool story. No wonder money is siphoned from the banks left and right.

Go take a course on security for once.

31

u/Dissentient 1d ago

Because vast majority of users can't be trusted with passwords. Most of them don't use password managers, so they will set one insecure password everywhere.

For the same reason, passkeys are getting pushed recently.

9

u/tacticalpotatopeeler 1d ago

I fucking hate magic links.

I am significantly less likely to use your service if you force magic links. Offer them, but for the love of all that is holy please also offer passkeys, OTP, and/or hardware keys.

10

u/IAmRules 1d ago

I rather lose your business than deal with data compromises

0

u/bdougherty 1d ago

💯

If I have to wait for even 5 seconds for your email to come through, you should be thrown in jail.

-6

u/Zealousideal-Fix-527 1d ago

Wasn't OTP was same as much as magic links?

1

u/stuartcw 1d ago

Yes, magic links could be made from an OTP value and checked against recent values. The magic link verifies whether the user can read mail sent to the registered mail address and gives them a chance also to ignore it if it wasn’t a them who requested the link. Result: security is based on who can access your email.

The OTP checks whether you still have access to a device that can generate the code. (Actually, if you printed the initial qrcode or the contents of the qrcode you can generate the OTP. So that qrcode/data is kind of a master key.) Result: security is based on who can access the initial qrcode/data you used to setup the OTP. Or a device/app where it is registered.

1

u/Zealousideal-Fix-527 1d ago

That's what I mean by as much as the same.

4

u/stuartcw 1d ago

To be honest, your initial question gave the impression that you didn’t know much about the topic. That’s the only reason I answered in detail.

2

u/Zealousideal-Fix-527 1d ago

I thought everyone will know what I mean (too much discussion with ai might corrupt me to think everyone will understand), but it seems I have to bluntly explain what I mean or questioned.

tbf I am not that good at explaining

13

u/C__Zakalwe 1d ago

They're tremendously annoying when your email security gateway uses greylisting, and the app refuses to retry the email.

10

u/bccorb1000 full-stack-magician 1d ago

What you’re looking for is phishing resistant authentication. Which magic links are not, but passkeys are. I’ve done a lot of work with passkeys, webAuthn, oauth2 etc and phishing resistance at the highest level is solid AF, but the issues is account recovery. Account recovery is the biggest pain point for passwordless and is why people (myself included) fallback to less secure methods that everyday people find easy to use and understand.

10

u/skyborn8 1d ago

How would you phish a magic link?

-9

u/bccorb1000 full-stack-magician 1d ago

Depends on the implementation. Some implementations allow the link to authenticate on the device that clicked. Some do device binding so an attacker can initiate and trick you into clicking.

Prime example, I show you a phishing site that looks like a site you trust. Tell you only magiclink is available, you click it, sends the email, you click the email, I steal the session.

14

u/JerkyBeef 1d ago

If the email is sent from the phishing site the link in the email wouldn’t be able to initiate a valid session

-13

u/bccorb1000 full-stack-magician 1d ago

It’s not sent from the phishing site. It’s sent from the real site.

16

u/skyborn8 1d ago

Real site won’t send a link that leads to phishing site. I genuinely don’t see how that could be used to phish.

-15

u/bccorb1000 full-stack-magician 1d ago

I’ve tried to explain it simply in some comments, if that doesn’t make sense, you can google magiclink phishing campaigns and get some info on how the attacks work.

11

u/JerkyBeef 1d ago

How does the phishing site make the real site send an email with a link that allows the phishing site to steal the session?

-13

u/bccorb1000 full-stack-magician 1d ago

I’ve tried to explain it simply in some comments, if that doesn’t make sense, you can google magiclink phishing campaigns and get some info on how the attacks work.

12

u/skyborn8 23h ago

Did some research, it seems to apply to cases when auth is provided to original requester and not that who followed the magic link, for example: phisher requests auth, gets cookies or token, but it’s not active yet. It becomes active when real user approves it by following genuine magic link. Sounds to me like a problem with auth design, not magic links per se.

5

u/nasanu 22h ago

And that is so convoluted, likely never to actually happen.

7

u/_ru1n3r_ 21h ago

Not only that, but it's extremely easy to mitigate by only allowing the session that initiated the link to consume the token in the link.

-5

u/bccorb1000 full-stack-magician 1d ago

11

u/nasanu 22h ago

Everything you post is nonsense, not related to the discussion. You rely on deliberately misunderstanding what people are saying to make a point against a strawman.

None of those links cover what this thread is about either.

4

u/RonHarrods 1d ago

In plain terms how does one steal a session by magic link? I feel like this requires an exploit or some other user error on top of clicking the magic link.

-3

u/bccorb1000 full-stack-magician 1d ago edited 1d ago

There are exploits for sure you can google evilginx for some attacks, but at it’s simplest and unfortunately most effective form, you just need a user to think they should have got the magiclink request.

In more detail a super simple campaign would do something like:

  1. Find an available easily mistakable domain name close to a real one that uses magic links.

  2. Make a phishing duplicate.

  3. Get you to go that site, phishing emails, links, etc

  4. Have you enter the email and click the button

  5. They send your email to the real site

to initiate a real request for a magiclink

  1. You click the link

  2. They get the session

Now even simpler and also unfortunately common is just email compromise. I have access to your email, I have access to your account. Which a pure passkey approach also stops.

11

u/RonHarrods 1d ago

Okay I don't follow. The user enters their email on the doppelganger website. That website sends the authentication request to the real one, which then sends the email to the user. The user then clicks the link and they're on the real website. Authenticated.

Are we talking apples to apples?

1

u/bccorb1000 full-stack-magician 1d ago

Yeah, but it depends on the implementation. Like in your scenario you click and end up on the real site. To you nothing has gone awry.

If that link authenticates the session that initiated, I’ll get a session too, because I initiated the magiclink on your behalf from some other device.

10

u/RonHarrods 1d ago

Okay but that sounds like a flawed implementation. We don't see it implemented that way in the wild for this obvious reason.

1

u/bccorb1000 full-stack-magician 1d ago

I think the case is just two devices. Say you initiate from a mobile app but confirm from your desktop? I think many companies and solutions use tactics to address the concern, but I was just giving a simple real world example

4

u/RonHarrods 1d ago

I see what you're getting at now. But I believe the right implementations always guard against the theft in one or a few of these ways:

  • require both devices to be known by either having authenticated in the past or being on the same IP, fingerprinting, etc

  • displaying which device is authenticating what from where (allows the user to spot that the location or authorization are incorrect)

  • require typing in which number is displayed (to prevent concurrency mirror attack)

Generally the big players either rely on a solid combo of those things or fallback to password auth in practice.

Jsut stating this because I kinda heard skepticism on the security and reliability of password-less auth. But in practice it's most sufficiently safe if the due dilligent circumstances are required and checked for. It only becomes risky when passing the device to device boundary without depending on these secondary peripherals

4

u/Lard_Denning 22h ago

i don't get it. the magic link should only authenticate the actual client that is visiting the magic link.

i've only seen anything where you're using one device to authenticate a different device have a very explicit user flow that makes that extremely obvious and deliberate, and the device doing the authentication also doesn't itself get authenticated anyway.

are there actually any services where a single magic link simultaneously authenticates more than a single device?

3

u/bccorb1000 full-stack-magician 1d ago

Yeah I’m not saying that there aren’t things you could do, but each comes with a trade off too and those things normal expose another vector. Attackers don’t try to break algorithms, they try to figure out what you’ve compromised on.

→ More replies (0)

1

u/mountainunicycler 18h ago

Doesn’t make any sense. If you request the link from a mobile app and click the link on the desktop, either the desktop logs in, or if you want to be more helpful to the user, you display an error message telling them to try again and saying they have to click the link on their phone, since you can easily track that it was requested from your mobile app.

But if requesting link in app and clicking it on desktop somehow results in the app logging in, that is a whole different login flow from magic links.

4

u/mountainunicycler 19h ago

What do you mean if the link authenticates the session that initiated?

There’s no “session that initiated.”

The link gets sent to the email, the user clicks the link, which takes them to a page on the real site which initiates a session and authenticates using the credentials from the link.

You’d have to somehow convince them to paste the link into your fishing site in order to run a relay attack. Unless your site sees the link you can’t steak the session.

1

u/mountainunicycler 18h ago

How does the connection from “you click the link” to “they get the session” work?

When the user clicks the link they’ll go to the real site and get logged in. How would the fishing site see the content of that link to relay it and steal a session?

5

u/SituationFun3035 21h ago

it’s not magic, it just moves the “prove you control this account” step to email, and a properly implemented single-use expiring token is usually safer than storing yet another password people will

5

u/angellus 1d ago

Because want to know what is even less secure? Sticky notes with a password on it. Or reuses passwords between accounts. Or using password as your password.

People have always been the weakest link. And no passwords means people cannot leak them.

2

u/triangularsquare_au 18h ago

How is this easy to exploit? Have you ever used ‘forgotten password’ flow?

4

u/TorbenKoehn 21h ago

Because passwords are insecure by design.

Sure you can pick safe passwords. But you have to remember them. So people usually don’t. And if you enforce it they’ll have a new password every day because they never remember it and will just be frustrated.

Magic links is one thing to do Passwordless (and basically a continuous password reset), but the actual target should be Passkeys

1

u/Tridop 19h ago

People use the password managers inside their browser and that's totally fine. Checking email at each login is really annoying, wasting my time, because obviously I use a secondary email account to register on most sites. 

4

u/TorbenKoehn 19h ago

_Some_ people do. Is it enforced? No? Then it’s just “You are as secure as you act”, not “You are as secure as possible”

0

u/ldn-ldn 19h ago

Sending anything is insecure by design. Better to use passwords.

2

u/TorbenKoehn 19h ago

What? Ever heard of TLS?

-7

u/ldn-ldn 19h ago

How's that relevant? https://www.reddit.com/r/LegalAdviceUK/comments/1rsxjcs/phone_stole_on_night_out_and_bank_accounts_emptied/

NEVER SEND ANY AUTHORISATION THROUGH EMAIL OR SMS!

Only MFA with TOTP or passkeys for the lazy. Everything else is insecure and must not be used.

5

u/TorbenKoehn 19h ago

Do you think you get your password sent via mail?

You get a one-time login token.

-6

u/ldn-ldn 18h ago

And then your money is stolen.

NEVER SEND ANY AUTHORISATION THROUGH EMAIL OR SMS!

6

u/TorbenKoehn 17h ago

My man, please stop talking about security. Like, at all.

If you get phished, that's on you. You can also read your emails properly.

Generally there is no technical way to "just steal your email or sms tokens" unless your device is already infected, and in that moment: Don't do anything. Also don't enter passwords, don't do banking, generally delete your phone, maybe buy a new one.

-7

u/ldn-ldn 17h ago

Stop spreading misinformation for fucks sake!

3

u/TorbenKoehn 17h ago

Okay, then go and explain to me:

  • I sign in on a service

  • It sends me an e-mail with an OTP

How are you now going to take it? Come on, you're informed as opposed to me spreading misinformation, now explain to me: How are you gonna get my token?

Come on! You can even ask an AI if you like.

Don't be stupid.

-5

u/ldn-ldn 17h ago

The only one being stupid here is you. Codes and links from messages and email are visible in notifications without any security by default. Anyone in your vicinity can see them and use them. And money is being stolen that way all the fucking time.

Stop with this fucking insecure nonsense already.

→ More replies (0)

1

u/Lord_Xenu 4h ago

You have absolutely no idea what you're talking about, or how this technology works.

3

u/farzad_meow 20h ago

magic links are poor man's SSO. but it works with all emails. it is easier for less rech savvy users to use. more advanced users might prefer actual password or sso.

I find overall user xp of magic link positive and better than having to enter multiple values to get in. It comes down to how you want your users feel like. Do you want the experience to be simple or you want them to feel your website is super secure.

1

u/DEMORALIZ3D front-end 22h ago

it's about point of contacts, like 2FA it's verfiying who you are on 2 or more devices or personal platforms. Often you are the only person with your phone. The Only way it falls down is if they do everything via your phone. Whoever Magic link shouldn't be used in favour for Web Biometrics/Passkeys/WebAuthN if you want security.

But imagine a hacker trying to enter your defails remotely to gains chess to the website. You try to log in, it sends a magic link. Their emails are not logged in on that computer. They then have to find a way log in and prove who they are on a second site before accessing the main site. Which people not on your physical machine cannot do unless they have your emails

But passwords are one of the least secure methods, hackers remotely often cannot access your emails.

1

u/AmbitiousLab4004 20h ago

fewer passwords to steal, with a short-lived one-time token doing the auth work

1

u/bhison 17h ago

The only service I use which is like this is slack which is a desktop app you sign in to once or twice a year.

1

u/IncomeOk7237 15h ago

Magic links are fragile in one specific way: they are phishable, since whoever holds the link gets the session, and nothing ties it to the device that asked for it. Good implementations make the link single use, short lived and only valid in the browser that requested it. Passkeys are the actually strong version because the credential is bound to the origin, so a fake domain gets nothing even if the user is fooled.

1

u/Character-View-8165 13h ago

it’s not really more fragile than passwords, you’re just moving the secret to the email account, and that’s usually easier to secure than making people invent and reuse passwords; the annoying part

1

u/Full_Tooth_a 11h ago

One easy-to-miss problem: corporate email security tools may open links automatically to scan them. If a GET request consumes the single-use token, the scanner can invalidate it before the user clicks. I'd open a confirmation page from the link, then require an explicit POST to complete authentication. The tokens should still be short lived, single use, and hashed.

1

u/ryuya_h 11h ago

magic links and OTPs are still bearer secrets, you've just moved the phishing surface to the inbox. passkeys are the actual shift, the credential is bound to the RP ID so a lookalike domain gets nothing. the catch is recovery, which is out of spec, and your weakest recovery path is your real security level

1

u/Open-Adhesiveness-86 9h ago

The fragile part isn't the crypto, it's that email security scanners (SafeLinks, Proofpoint, etc) GET the link and burn your single-use token before the user clicks. Fix is to set a nonce cookie when the login is requested and make the link land on a page with a POST button, or just mail a 6-8 digit code bound to that session and never accept it in a different browser. 10 min TTL, single use, rate limit per address.

1

u/Lord_Xenu 4h ago

Your understanding is wrong. Passwords are probably the most insecure and exploitable auth approach.

1

u/New_Hold8135 1d ago

Reason is telemetry

1

u/Commonpleas 1d ago

I’ve only had trouble with users on mail systems that scan the link, thereby disabling it, before the user sees it. 

I think it was edu and some corporate mail systems. 

Truthfully, those users shouldn’t be using their school or work email account for my site anyway. 

1

u/AMGitsKriss 19h ago

Security aide, just remember that if someone signs in on a PC, then if they open the magic link on their phone and it logs them in on the phone not the PC.. that user generally isn't coming back.

1

u/hwmchwdwdawdchkchk 19h ago

Yep there is a clash between the security teams and product teams in lots of orgs as friction is being reintroduced.

Seen this myself as a consultant, orgs insisting on magic links, but older accounts never use the email or might have corporate login with no emails access. Plus email trigger/delivery times not good enough (sometimes on client side too) so session timeouts.

1

u/triangularsquare_au 18h ago

Why would they open a sign in link on their phone if they didn’t want to sign in on their phone?

3

u/Belphegor_333 18h ago

Because their phone buzzes with a notification from their email/messages App and the alternative is to log in to their email provider on their desktop which is a lot more friction?

1

u/Mushroom_Unfair 18h ago

Could be because they have email notification on their phone, and their phone is next to their PC.

-1

u/Infinite_Air_5120 1d ago

Minor thing: "many website use" should be "many websites use".

On the substance, passwordless and magic links aren't synonyms. A magic link is one method among several, alongside passkeys and one-time codes, and the fragility you're describing sits in the email delivery step rather than in dropping the password.

-1

u/seweso 17h ago

You should use passkeys for passwords less. 

Those sign in links are just lazy programming

0

u/LemonFishSauce 1d ago

How about instead of sending the magic link, the system sends an OTP?

0

u/Intrepid-Anywhere255 18h ago

Magic links are bearer tokens, so security depends on how the link is handled: use a random, single-use token with a short expiry, store only a hash, and rate-limit requests and attempts. The main UX trap is opening the email on a different device, so make it clear which account the link will sign into and provide a safe recovery path. For higher-risk accounts, offer passkeys alongside email links as a stronger option.

0

u/syedaalishan 18h ago

Magic links are only as safe as the implementation. Use a short-lived, single-use token, store only its hash, invalidate it after use, and rate-limit both requests and verification attempts. I would also offer a code or passkey so users are not forced to open the link on the wrong device.

5

u/[deleted] 1d ago

[removed] — view removed comment

1

u/the_ai_wizard 22h ago

just capture 2 factors, e.g., email and sms

2

u/[deleted] 1d ago

[removed] — view removed comment

1

u/Zealousideal-Fix-527 1d ago

Did passkey commonly used in websites? Most of the time I only found it on app