Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

3 isn't really possible, because the redirect needs to take you back to the browser session where you initiated the login from.


It definitely does not.

Have your logging-in session wait for / poll "has visited magic link", and authenticate that session when it's done.

Tons of systems do this. It works great, and it can quite easily work without any web browser at all on the logging-in side because it just needs to curl something -> poll for completion and save the cookies -> curl against the API. A number of oauth flows for e.g. TVs work this way, for instance, because it's a heck of a lot easier than integrating a full browser in the [embedded thing]. Many app-based 2FA (e.g. Duo) works this way too.


So I misclick a link in my email client and the evil guy who requested in is now logged in on his browser god knows where? Surely that can’t be real. It sounds awful. TVs involve copying a code to make sure the right device is being authenticated, or the ones I’ve used have at least.


Duo 2FA works the same way. In principle yes. And it's basically always accompanied by a "click this link" -> "are you trying to log in, and is this you? yes/no" page to resist that.

Small code copying is also a very good answer though, yes. Roughly as easily manipulated, but nothing's perfect, and it's less "I didn't mean to click that button"-prone.


Yeah but I routinely click links in emails whereas logging in is the sole purpose of Duo. I could easily just intend to scroll the page and end up tapping the link.


so have that open a site that says "confirm login? y/n".

I don't mean to imply that just visiting the link should be enough to complete a login. That's a GET and there's a LOT of issues with doing anything important on GET. Just "do something on a different machine, then automatically complete login on the one logging in", and magic links to trigger that flow are a rather straightforward option.

There's no reason at all that it has to all occur on the same machine, and many reasons why attempting to require that doesn't work out in practice even when it does happen on the same machine.


Ah I see. Yes, that makes sense.


This seems dangerous:

1. Attacker starts a log in and triggers a magic link email 2. Email received and my browser client previews the link without my desire 3. Attacker is now logged in


That’s why you combine it with a check for source IP and tell your user that they need to approve from a device that has same IP as the one they are logging in on. So if I’m logging in on my laptop, and approving with my phone, it will be rejected if my phone is using mobile data while my laptop is using landline, but will approve if my phone is connected to WiFi of the same network my laptop is connected to, or if my laptop is tethered via my phone, because then I have same external source IP on both devices.


This scenario is a solution only in simplest cases. It doesn't work when someone routinely uses a VPN on the phone (when often uses free public wi-fi in airports, railway stations, markets etc) because of possible MITM attacks.


also some ISPs will give you a different IP every request


This has security and usability issues. NAT/CGNAT means a potentially large number of people can hijack your login.


The links are one-time use so you need to take this into account anyway or users simply can't login. It's usually done with a required button click after following the magic link. Or you can try JavaScript techniques to detect a real browser.


No "tons" of systems do not do this. If you come across one that does it was built by a team that has no idea about security.

TVs etc. are special cases because obviously there is no way to redirect to them, and even there developers will always have some kind of secondary checks like having you enter a code displayed on the screen.


When I sign on to a bank it sends an SMS. Then my phone prompts me to share that code with the brower, on my desktop. It's a neat QOL "feature" - but kinda feels too automated to be secure.


That's because the server recognizes both clients, and you are prompted to approve the other client from the client that has the code. You are giving permission to the remote client, not taking permission from the remote client.


The server recognized my device from the messenger/SMS app? That seems not correct.

But somehow, the desktop browser and my mobile are tied together for this app. But no other sites have this magic.


If you have an iPhone and a mac, most sites that use SMS OTPs work this way


Linux desktop, android phone.


I've come across dozens.

Google does it. Paypal does it. Duo does it. Lots of single-sign-on systems do it. All of those including not-TV scenarios, just normal computer-and-phone stuff, as well as sometimes other weird flows. Many of these are far beyond what most would label as "security competent", into "login security is a large part of their business and they have significant numbers of specialists hired".

(it is probably safe to say none are "truly secure" or "actually security obsessed", but I doubt that's actually possible in large quantities. the requirements are too steep, for both implementers and users.)

It's not the most common, certainly, nor anywhere close. But it's very far from nonexistent.


Where does Google do this?


Log in on browser -> push notification "is this you?" on your phone -> browser automatically continues when you say "yes".


But that's only as a second factor right?


Is that materially different? It's a login that's completed on a different machine, and automatically resumes on the intended one.


I might receive a magic link on my phone but then sometimes I'll copy/paste that over to my desktop or another device.

This works on 99% of magic links I've tried except for cases when they are trying to prevent account sharing. I remember the Bird bike app did this, where they required the magic link to be clicked on the same device login was initiated on. I was using my friends account and he would just forward me the link until one day this stopped working.


It seems like “prevent account sharing” and magic links are somewhat at odds by design.


The idea being the user(s) would then have to share a email inbox to share logins, not just a password. It might not be the most inconvenient - this is partly how Netflix did their "Household" lockdown. You can request a travel code and this gets emailed to the primary email.

I feel the way Netflix did this broke the social contract of profile sharing on purpose - before, if you were a good tenant, you could freeload off another paid account without inconveniencing them at all. Memes and jokes formed of still being on an ex-partner's account or how people would rename themselves "Settings".

Getting an email and being harassed for the code by all those account sharers? Much more open and open for annoyingness.


More than a shared password?


Not necessarily, some services would have the magic link verify the session that triggered it regardless of browser or device.

I assume it generates a session on the post-login screen and authorize that session upon accessing link


That has the problem of opening up an attack where the attacker requests the sign-in link, the person receiving the link blindly clicks it, and the attacker now has access.

People blindly click links all the time. It would have a low success rate, but would be more than 0%.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: