155 points · by mschuster91 · 1y ago · 83 comments
It seems to me that someone misunderstood how to implement the logic on the frontend here. You're not supposed to send off a POST request directly as the page has been loaded to exchange the tokens, but require the user to click on a button to confirm the activity.
So the flow would be:
- "Send email with url+token > Frontend loads, shows button to user to confirm > User clicks button and exchange happens".
Instead, wrong implementations do something like this:
- "Send email with url+token > Frontend loads and exchange happens", which we've known for years to not work correctly, because of this very issue.
Discourse for example implemented this perfectly, so if you need an example, that would be where I'd go.
(I know it sucks that scrapers/crawlers do a lot of horrible shit, it truly does. But we've dealt with this for years now, it's not a new thing and it won't be the last shitty thing they do)
Since requiring the user to do anything drastically reduces the go-through rate, the current "standard" is to use either a meta-refresh tag, a HTTP Refresh header [1], setting location.href from JS or a <form> that gets submitted via JavaScript, and a <button> inside a <noscript> for those that don't do JS.
Used to be enough but nowadays content scanners run legitimate chromium embedded and whatnot, which obviously trips over at least the refresh tag/header and the automated Javascript solutions. And that's the problem.
Which again, it's a known problem, existed for many years already and we have a work around for. If you want to do POST requests from URLs sent via email/other communication platforms, you need to make it so the user confirms the activity.
Users who wanted to sign in and have to press a button after loading the page instead of just logging them in won't suddenly not want to login. They have a clear purpose when clicking the link, regardless if they have to click one button afterwards or not.
And besides, if you don't implement it like that, you'll have even more users dropping off because they literally won't be able to sign in at all, no matter how badly they want to.
Not really. Other than Google's crawlers it was rare to see full browser engines or even JS runtimes as part of "security" solutions.
What is the solution? Like making the user click again might be against GDPR.
https://www.onlinetraveltraining.com/uk/news/posts/why-one-c...
> As of the 1st June 2024, the one-click unsubscribe feature on email is mandatory, and enforced by Google as a requirement for bulk senders.
Dropping all packets from Microsoft or Google in the firewall ? /s
I'm not sure why people believe this to be a new issue, I think the first time I myself implemented a work around for this issue was like 4 years ago, and here is a Stackoverflow Question about it from 7 years ago: https://stackoverflow.com/questions/43443947/how-to-stop-e-m...
Outlook/Microsoft is not the only ones who do this either, when I first had to work around it myself it was because it was happening in gmail if I remember correctly.
or why exactly are they following those links again? perhaps it is for previews instead of "security"?
from the article:
> Over time, it also became OK for software to visit links in email to find out what was behind them.
why would that be OK? if i email a secret link to someone, i fully expect it to stay between the recipient and me. not some company reading along. but that's why i don't have accounts with these types of companies...
We already went through this with Google Web Accelerator and 37Signals twice. They couldn’t accept that mere links were a bad idea for deleting things, and GWA came along and deleted their users’ data by following links. They tried to detect and block GWA instead of following HTTP rules and it happened again.
Links are supposed to be safe. Ignore this at your peril.
Click here to agree.
Links shouldn’t change state. This has been an extremely strong convention for several decades. If you write code that changes state when a page is loaded, you are breaking this convention.
I'd solve this by warning users who attempt to reuse consumed links that the link has been used already, and likely list broken email providers that I suspect are using software that breaks this. And then wait. Let them complain to their IT, or whomever is responsible for picking broken software.
If I was feeling really petty, the clown that wrote this link scanning software isn't in charge of the networking, so you could eventually enumerate the subnets that MS uses, and black list them. Then the links might actually get to users connecting from non MS data centers.
You could roll over and decrease your security so that MS can claim they increased theirs... But you shouldn't! They can only get away with turning security into a negative sum game if you play along. Please don't?
The thing is, most websites already know how to workaround that particular issue (https://news.ycombinator.com/item?id=42804447), so when users notice that something breaks with just your service and not everyone elses, you can say "Outlook is shit" all you want, the users will blame you for it, since you weren't able to fix what others could, for better or worse.
> You could roll over and decrease your security so that MS can claim they increased theirs
What part of your security would decrease if you "roll over" and what exactly does "roll over" entail here? Websites who've dealt with this issue implemented what I linked to above, they're no more/less secure than the website who didn't manage to work around this issue, they're just less buggy for Outlook users, if anything.
If outlook is clicking on links or buttons that generate POST requests, then outlook is broken. If outlook is loading a page, and the page without further interaction is sending a POST, that's just as bad, if not worse than expiring the token on that same GET.
I wouldn't call that a work around, would you?
It isn't though, it's loading URLs it finds in emails, and then runs scripts on those loaded websites, like many "modern" scrapers/crawlers.
So if your JavaScript on that URL automatically does POST requests on load, those will happen automatically when their scanner loads the website.
But if you instead don't do a POST request on JavaScript load, and do that request when the user presses an actual button on the loaded website, the scanner won't trigger that button automatically (that would be a whole new level of craziness, we're not there (yet))
So yes, it is a workaround. I've implemented this 10s of times already, because it's been an issue for a long time.
Edit: The submission article also makes it abundantly clear that this is the very problem they're suffering from:
> Microsoft’s security scanning will now not only visit the links you mail out, they will also run the JavaScript on your page, and will also send out any POSTs generated by that JavaScript:
The problem is that their JavaScript automatically issues POST request on load, not that Outlook loads and executes JavaScript on the page (although that sucks too, don't get me wrong).
Personally, I'd happily blame Microsoft, but the practical significance of this fact is nil.
I am in the very small minority of users who will sometimes complain to our IT when Microsoft forces shit down our throats. But I do this because it feels good, not because I imagine any realistic probability that doing so will make a difference.
User: Hey IT, a site I'm trying to use says that I can't use Outlook, can we switch provider
IT: Heck no. Are there any alternatives
User: I guess I'll try to find them.
Eventually you have to choose doing what's right, and doing what's expedient. I can't draw your line for you. Thankfully for me I've always been able to always draw mine at protecting users from abuse.
Or Microsoft might start blocking your email altogether for circumventing security procedures or whatever.
Right. Thanks for consuming my SSO magic links.
E-mails show up with obfuscated links all the time; you can't detect phishing just from the URL if legitimate e-mails are using https://us123.list-manage.com/track/click?u=87958734095826 as an URL.
You need to load the URL, if you want to check if a fake Google login page shows up or something like that.
And the phishers are trying to evade your URL scanner. If your URL scanner has an identifiable user-agent, or doesn't execute javascript, or there's anything else that makes it identifiable, they'll show a boring legitimate page to your scanner and only phish the real users.
As I understand it, self-serve ad networks have similar challenges detecting ads placed by scammers.
If you want to use a third party mailing list, marketing juicer or link tracker, go nuts, but you won't be getting my clicks.
Good guys send out email links -> Bad guys start sending out email links -> Security scanners start checking link contents
Good guys hide behind automatic POST -> Bad guys start hiding behind automatic POST -> Security scanners start checking behind automatic POST
Good guys hide behind button click (we are here) -> Bad guys start hiding behind button click -> Security scanners start checking behind button click
Good guys hide behind link that doesn't work until 10 minutes after sending -> ...
Good guys hide behind captcha -> ...
Good guys hide behind plain text code that has to be copy/pasted from email -> ...
Eventually the security scanners will be indistinguishable in function and intelligence from a human being.
Might as well just merge it with your personal AI assistant and it will do everything for you...including getting scammed by the bad guys.
What you should do is send your user to a page with a form requiring a manual action from them.
There’s tons of stuff out there like this, just assume apps are being disrespectful and plan accordingly.
1. Most “safe browsing” browser features do this to some extent
2. Any browser or mail extension with access to the URL might also do this
(1) and (2) might be done by remote servers, even in remote countries.
This is one of the reasons why you should avoid magic links (like login links or bearer tokens like S3 signed URLs), because you may inadvertently be handing them to other parties.
Though also the “I'm sure I want to unsubscribe” is in part to deliberately add extra steps to unsubscribing.
Not sure what time-frames we're talking about here, but I remember having to work around this particular issue more than 4 years ago, I'm sure it was also an issue before too. It's been like this for a long time.
So maybe there might be a way to disincentivize this behavior?
I wish for a harsh, comprehensive enforcement of Schrems II sometime soon. Sadly it looks like the EU will instead be bullied into making exceptions to it's own basic data protection regulations and other IT-related laws.
Some users might argue that if they don't "sign up for services", i.e., use other peoples' computers for basic tasks instead of using their own, then many problems caused by so-called "tech" companies never happen to them. That is, "signing up for services" introduces new problems.
Security scanners really should not be clicking on things on your behalf. There's a lot worse danger there, like potentially agreeing to things you would never have agreed to.
If it doesn't have my hand-written signature then it's not an agreement.
I can't "agree" to something I haven't read, haven't been notified about, and haven't agreed to.
A robot clicking things does not mean I agreed to whatever it clicked it. It means that the the other end of the transaction can't tell the difference between me and a robot.
I wouldn't bet my company on that.
If someone sends us an email - probably with legal weasel words included saying it's only for use by the intended recipient - and asks for confirmation of something by following a private link and pressing a confirm button and if as far as that supplier is aware we have then done that and continued accordingly then I would not be at all surprised if a court found that they were acting in good faith and we were not.
Similarly if we sent something to a customer and their own IT system actively simulated a sequence of actions the intended recipient would take to confirm something then I would hope that would stand up in court as well. Otherwise we enter a legal climate where no-one in business can ever say or do any little thing without some kind of verified human approval process. It's hard to imagine how annoying and inefficient that might become for everyone. Maybe it would prompt a new generation of electronic communications and record-keeping where authenticity was built in unlike many of today's most common technologies - but it would still be a nightmare to do business until that happened.
Yes exactly. Given the escalating sophistication of malicious actors and their robots, the scenario you present is viable today. That's dangerous in ways that I cannot even begin to articulate, and I'm not even well-versed in contract law.
> if we sent something to a customer and their own IT system actively simulated a sequence of actions the intended recipient would take to confirm something then I would hope that would stand up in court as well.
I absolutely hope that would not stand up in court.
To my knowledge a contract requires (at a minimum) a meeting of minds and consideration. You cannot agree to something you did not know about. You cannot come to a meeting of minds if you weren't told about it. That payment could be for anything. You might think it's for this one service and I might think it's for all services provided, not just the one I clicked on. Who will a court side with if you cannot prove that I, a human, agreed to it?
> Otherwise we enter a legal climate where no-one in business can ever say or do any little thing without some kind of verified human approval process.
Yup! And I say that's a good thing given that non-humans cannot enter into agreements, and there are plenty of non-humans who have no idea what they're getting themselves into in the current form of electronic agreements.
> It's hard to imagine how annoying and inefficient that might become for everyone.
You mean... you might have to actually employ people to verify that your customers are actual humans? That's a good thing all around. Unless you can't afford to employ people, in which case: your business does not have a valid business model.
Fortunately, many courts do not agree, given that lot of disabled folks would be SOL under the "physical ink signature only" theory of agreeing to contracts. Not to mention a bunch of e-commerce considerations.
> can't "agree" to something I haven't read
I realize that is part of an ANDed condition, but it's absolutely possible for people to agree--in very definitive ways--to something they didn't read.
The alternative leads to: "Judges hate this one weird trick! Just say you didn't actually read it!"
Do Microsoft devs use Copilot to code?
Regardless though, once you have a web browser 0-day its usually not very hard to convince a user to click on a link. Especially for a targeted attack.
However, that opens up ANOTHER similar attack vector as Bert is saying:
"We may wonder also what fun a determined hacker could have with Microsoft running random bits of JavaScript on their servers and allowing these to talk to the world (or to Microsoft itself even)."
Like its possible you could get something there, but i could think of a lot more juicy targets if you have a chrome 0-day.
This applies also to the (really annoying) MFA emails (and we really should stop doing this shit, and instead support at the very least TOTP), "magic" links and similar, who also require you to visit the link from the same device, when perhaps I am on a public computer without my email signed in; and getting into gmail or outlook to find your f-ing link would be annoying, because I have 2FA there too.
Instead, just send me a code. It can even be in the subject field, like "012345 is your login code for WHATEVER", and I'll see it at a glance on my notifications. Then I'll input it on the device where I'm logging in (such as the public desktop computer) and go on with my day.