Safely Reviving Shared Memory
hacks.mozilla.org
hacks.mozilla.org
IMO, this Google doc is a better explainer of COOP and COEP, how they work, and why they help.
https://docs.google.com/document/d/1zDlfvfTJ_9e8Jdc8ehuV4zME...
> "We now assume any active code can read any data in the same address space. The plan going forward must be to keep sensitive cross-origin data out of address spaces that run untrustworthy code, rather than relying on in-process checks."
- https://web.dev/coop-coep/ - https://web.dev/why-coop-coep/
although I think the Mozilla article in the OP is a really nice, succinct high-level overview.
The work needed to implement an HTTP server is growing and growing and growing. There was some speculation a few days ago on why this is happening, and why big companies are benefiting from this. I don't think there's any conscious conspiracy anywhere, just a lot of people try to make a name for themselves. (There was a discussion on this a few days ago here: https://news.ycombinator.com/item?id=23833362)
But I just hate this growing complexity everywhere. HTTP can and should be much simpler than it's becoming.
This new complexity is about javascript execution, and creating a browser that can run javascript has never been simple!
It's a header. We've all had 25 years to get those implemented :)
Let’s start by making native apps as instantly accessible as websites — iOS App Clips are a step in that direction.
Next, let people share links into native apps.
Nor is it required, see evolution. Completely non-directed, but the beneficiary still benefits which reinforces the change.
It feels like some kind of selection pressure where big companies pollute the world with complexity to remove competition. This can be intentional of course, but even if it's an accidental random mutation then the result is the same.
This will be big for Web Assembly. Real threads will make it possible to port more stuff and get better performance.
I really don't want to grant that.
Web browsers are failing badly at resource controls. I don't want to hand my whole computer over to a greedy web site. I expect my browser to stop the abusive web site resource consumption, not enable it.
i.e., if I have a page with sensitive client side data, I need to set this header to prevent a page on a different domain from opening a popup to that page then doing a Spectre-like attack on my web page and exfiltrating that sensitive client side data.
I don't actually entirely understand the purpose or effect of Cross-Origin-Embedder-Policy. I thought browsers already blocked cross origin requests without CORS headers in the response that allow it. Does this header UNDO that by default?
CORS applies to XHR/fetch APIs, not browser loading of subresources specified in the HTML of the page.
COEP optionally extends CORS-type protection to subresources.
Very excited to dive back into some WASM/WebWorker projects that got abandoned due to performance limitations.
I know safety isn't all about about malicious attacks, but I like to imagine living in a world without the need for locks, passwords, keys, safes, signatures, contracts, lawyers, ... we would probably all be fed and populating the solar system by now.
Typo? Or are we finally acknowledging the contributions of the porn industry? :)
The Germans.
Hey, these days the military is using consumer grad iPads, because they are cheaper and good enough.
There are more things in heaven and earth than just the military and SV.
One big example that's often brought up of military tech leading the way is programmable computers. And, yes, in our history that's what happened. But International Business Machines was hot on their heels purely for commercial computing. (If the militaries of the world hadn't blown up so many resources, business would have likely come up with programmable computers a few years earlier, thus completely eliminating the gap.)
A large part of why have democracy and separation of powers is to protect from bad actors.
But yeah, not having to deal with bad actors can enable massive achievements. The pyramids were built when Egypt was more or less safe from any external invasion and ruled by god-kings who could coordinate massive building projects.
With all its faults democracy has these edge cases handled and makes the elected group of rukers much more acountable with mens to get ridd of they if they turn out to be too unfit to rule.
Or by example: You still want someone to organise weekly garbage collection efficiently and equitably. The government does that.
Of course, details depend for example on what our 'no bad actor' assumption actually means, and perhaps on what ideas you have about human nature and history.
> Even in a no-bad-actors world you still have many different competing interests to balance due to different people's needs and preferences, so you probably want some kind of polling/citizens forum/whatever to gather input for making decisions, and an organisation that looks at all the details and makes the decisions on behalf of the collective.
Yes, you'll want some kind of organisation. My comment was just that the organisation would probably not look like a monarchy, benevolent or otherwise.
There's no such thing as bad actors. Just people who's interests are not aligned to yours (you are their "bad actor")
Have a look at eg https://www.lesswrong.com/posts/tJQsxD34maYw2g5E4/thomas-c-s... or https://www.lesswrong.com/posts/2SeN2MjmMzZB25hBo/insights-f... for some ideas about alternative definitions.
You could also go by something like 'You are not a bad actor, if (outside of emergencies) you don't lie, cheat, murder or steal.' Or you can go with something closer to game theory, and emphasis cooperation in something like a prisoner dilemma.
[cue John Lenon at the piano]
But a less flippant way to put it is that a world without "bad" actors isn't a stable equilibrium. It cannot and will not ever happen. If you need convincing, look to nature. An equilibrium is only formed through a multitude of mixed strategies.
Artificial selection might result in what you desire, but that would be.. unpopular, to say the least.
Just making a note that if you want to foster PWAs over native, or Electron workarounds, better not make us jump through many hoops.
Then again, I suppose there are enough people out there who just want to FTP up their wordpress code and call it a day, so... ugh.
> I would argue that using Apache in the first place is non-optimal
What would you prefer? nginx is not suited to shared environments at all.
I haven't heard this. I'm running WordPress via NGINX with no issues.
If we could get an open-source flash player that was not so insecure and/or make an open source equivalent to Adobe air that spits out web standard code, we would not lose the flexibility that adobe flash gave us.
we really don't have an answer to losing Adobe flash, similarly to when we lost the spaghetti code enabling yet so pragmatically useful visual basic 6.
https://adobe-flash.github.io/crossbridge/
And here is Unreal Engine 3 using it,
https://www.youtube.com/watch?v=UQiUP2Hd60Y
WebAssembly has delayed progress for 10 years, politcs that is all, and for what?
"Everything Old is New Again: Binary Security of WebAssembly" - USENIX 2020
http://www.software-lab.org/publications/usenixSec2020-WebAs...
I don't understand this requirement. Very few sites use SharedArrayBuffer, those few that do probably had to rewrite code to deal with it being disabled.
I also don't understand how cross-origin has anything to do with it either. Either your sandbox works, in that case cross-origin isolation shouldn't matter, or it doesn't work, in which case cross-origin isolation is not a real protection.
Am I missing something here?
Firefox is only maybe 5% of users and it has other performance problems, if SharedArrayBuffer doesn't "just work" then I'm inclined to have them take that performance hit or use a different browser.
https://docs.google.com/document/d/1zDlfvfTJ_9e8Jdc8ehuV4zME...
So I guess you're right that if the sandbox "works" you don't care about cross-origin isolation, but it turns out that sandboxes don't work if you run multiple sandboxes in the same process.
The mitigation browsers have chosen is to isolate each origin in its own process, preventing other origins from communicating with it. To regain access to SharedArrayBuffer, you have to opt in to this extreme form of cross-origin isolation.
It would be nice to just make the whole web default to cross-origin isolation, but tons of websites rely on cross-origin communication features, and browsers can't just force them all to be compatible with isolation, so isolation has to be opt-in.
I can see that site-isolation is arguably too expensive on mobile and why you might want an opt-in mechanism there, somewhere down the line.
However, I don't think there are good arguments for not just enabling it on Desktop right now, without making developers jump through hoops. Until Chrome enables SharedArrayBuffers on mobile, I have no reason to care anyway.
Enabling that on desktop today would break every website that embeds cross-origin images, e.g. everybody using a separate CDN for images would be broken.
Chrome has been doing site isolation with multiple processes for a for a while, it "just works" and it doesn't break sites.
Also, you seem to be missing something: Chrome is going to implement the same set of headers, with the same set of restrictions when they are applied. This isn't an arbitrary firefox decision, every web browser is expected to follow suit. See the various mentions of "chrome" in https://web.dev/coop-coep/
That is not true.
https://www.chromium.org/Home/chromium-security/site-isolati...
Why? It's a straightforward matter. You can have the conventional behavior with the necessary limitations to which everyone has adapted, or you can opt in to a modified environment with new rules that would break some sites but provides additional capabilities.
> Am I missing something here?
Yes; the clearly explained rational is somehow being missed. The sandbox is an OS process as necessitated by Spectre. Without the new opt-in capability content from multiple origins -- some of them hostile -- are mixed into a process, and so the shared memory capabilities must be disabled. This new opt-in capability creates the necessary mapping; when enabled the content from arbitrary origins will not be mixed in a process and so the shared memory and HRT features can be permitted.
That's an arbitrary requirement on the part of Firefox developers, and it's a security issue in its own right. Any of the numerous exploits that regularly show up in Firefox could take advantage of this, not just Spectre.
Chrome has site-isolation enabled by default, at least on Desktop, I don't see why Firefox shouldn't follow suit.
Say you have a web page at https://a.com that does <img src="https://b.com/foo.png">. That's allowed in browsers (including Chrome with site isolation enabled), because it's _very_ common on the web and has been for a long time, and disallowing it would break very many sites. But in that situation the browser attempts to prevent a.com from reading the actual pixel data of the image (which comes from b.com). That protection would be violated if the site could just use a Spectre attack to read the pixel data.
So there are three options if you want to keep the security guarantee that you can't read image pixel data cross-site.
1) You could have the pixel data for the image living in a separate process but getting properly composited into the a.com webpage. This is not something any browser does right now, would involve a fair amount of engineering work, and comes with some memory tradeoffs that are not great. It would certainly be a bit of a research project to see how and whether this could be done reasonably.
2) You can attempt to prevent Spectre attacks, e.g. by disallowing things like SharedArrayBuffer. This is the current state in Firefox.
3) You can attempt to ensure that a site's process has access to _either_ SharedArrayBuffer _or_ cross-site image data but never both. This is the solution described in the article. Since current websites widely rely on cross-site images but not much on SharedArrayBuffer, the default is "cross-site images but no SharedArrayBuffer", but sites can opt into the "SharedArrayBuffer but no cross-site images" behavior. There is also an opt-in for the image itself to say "actually, I'm OK with being loaded cross-site even when SharedArrayBuffer is allowed"; in that case a site that opts into the "no cross-site images" behavior will still be able to load that specific image cross-site.
I guess you have a fourth option: Just give up on the security guarantee of "no cross-site pixel data reading". That's what Chrome has been doing on desktop for a while now, by shipping SharedArrayBuffer enabled unconditionally. They are now trying to move away from that to option 3 at the same time as Firefox is moving from option 2 to option 3.
Similar concerns apply to other resources that can currently be loaded cross-site but don't allow cross-site access to the raw bytes of the resource in that situation: video, audio, scripts, stylesheets.
I hope that explains what you are missing in your original comment in terms of the threat model being addressed here, but please do let me know if something is still not making sense!
I think the really compelling example is cross-origin script loading. I can't imagine a realistic way to keep the script data out of process but let it be used with low overhead.
I agree that doing this for script (and style) data is much harder from a conceptual point of view! On the other hand, the protections there are already much weaker: once you are running the script, you can find out all sorts of things about it based on its access patterns to various globals and built-in objects (which you control).
I can see how option #4 is a problem from a theoretical standpoint, I still have trouble imagining an actual attack.
* Earnings projections (and in general slides from non-public presentations that the user but not the attacking website has access to)
* Medical imaging
That's after thinking about this for 15 seconds. I'm sure there are many more in practice.
Or is that not what you were asking?
It doesn't work in general. It kind of works if you're putting each sandbox into its own process. Assuming there aren't any undiscovered microarchitectural attacks at the moment.
`about:config` -> `dom.workers.serialized-sab-access` -> true
Otherwise you risk sites opting in to Spectre. Why Mozilla thinks this is a good thing is beyond me.
All in all, I thought it was a sober and mature approach to the problem.