11 ms·
I'm not that old, but I've been closely following these trends since the late 1990s, and it seems to me like we are descending into madness now. We are wiping o
by rayiner 6y ago
I'm not that old, but I've been closely following these trends since the late 1990s, and it seems to me like we are descending into madness now. We are wiping out years of single-core performance gains--which have been hard to come by over the last decade to begin with--through all of these mitigations. It seems to me like maybe the mental model is broken. If untrusted code is running on the same core/package/what have you, your security has already been breached.
- ghshephard 6y agoYou run untrusted code every day you browse the web.
- deleted 6y ago[deleted]
- asveikau 6y agoOne of the recent times where I pointed this out somebody retorted that the browsers got rid of js access to high resolution timers, making a timing attack infeasible. Is this true?
- georgyo 6y agoNot true, at most it increases the number of samples required. But the are other ways to simulate timers with adequate resolution.
- saagarjha 6y ago(Such as a loop.)
- namibj 6y agoNot without shared memory.
- saagarjha 6y agoThere are apparently ways to get around even this requirement.
- namibj 6y agoAre you able to substantiate that with a link or an explanation?
- saagarjha 6y agoI just realized that my comment made it appear as if you can get a high-resolution timer without SharedArrayBuffer; I don't know of anyone who has done that yet. But people have made exploits that don't rely on it: https://alephsecurity.com/2018/06/26/spectre-browser-query-cache/ https://alephsecurity.com/2018/06/26/spectre-browser-query-c...
- namibj 6y agoThere is a point where you re-key faster than your key leaks through that specific timing attack. Or re-randomize memory layout, etc. Or where the payoff (due to limits/quotas) implies a cap on the effort that's still worth it. It's like Backups: you do as much as you want to pay for, considering the amount of risk you'll be left with.
- mahkoh 6y agoPlease post an example showing that this works. I'll run the example with OS-mitigations disabled to confirm.
- dijit 6y agoThis is a browser checker that does not use the high precision timers: https://jsfiddle.net/lukelol/43015xpv/1/ https://jsfiddle.net/lukelol/43015xpv/1/
- mahkoh 6y agoIt shows "Browser not exploitable." even after rebooting with mitigations=off.
- dijit 6y agoCongratulations! Now pray that there is not another exploit that can be used. :) Like many things; security is an onion, there are layers to it and removing some of those layers can be fine because the outer layers may protect you, but ultimately you just increase risk.
- mahkoh 6y agoWhy did you even post if you were going to resort to "but can you prove that there isn't an exploit?" anyway? I could have saved myself two reboots if you had started with that.
- dijit 6y agoI assume good faith, you asked for an exploit that works without precision timers to test, I provided one. Don’t get mad about the fact it didn’t work, I’m glad it didn’t work, but you can’t walk away with the knowledge that something like that will _never_ work. I’m not sure what you were trying to prove, but you can’t tell people to prove you wrong without any knowledge of what browser you’re running with, or what version or what you’re expecting to see. A “fully working” exploit for the most modern browser is probably possible frankly, but it’s not something that anyone is looking at with seriousness because everyone has mitigation’s enabled anyway. It’s the very definition of high work low reward.
- jillesvangurp 6y agoAnd the reason it's mostly not an issue for companies and people to stay safe is that we have many layers of protection around that. Being able to run untrusted code is required in a world where the combined code you run on a daily basis containes millions/billions of lines of code coming from a wide variety of sources. IMHO in the cloud a sane mechanism to protect users would be to guarantee exclusive access to CPUs. The primary risk in the cloud is sharing CPUs with other cloud users. Cache flushing sounds like a sane thing to do in non performance critical applications where CPU sharing happens. There's a performance penalty but if you'd care about that you'd be using a different instance type anyway where you are guaranteed to have dedicated CPUs. For bare metal/desktop use, flushing caches makes less sense.
- clarry 6y agoAnd I think that is madness. The web should have never gone down that route. People should push back.
- asah 6y agoSo all webpages should be simple forms, not even validation? I remember those days, and actually shipped "dynamic" webpages before JavaScript/AJAX/DOM. I'll take cache flushing. Imagine if every like/upvote button required a screen refresh... imagine Google maps...
- clarry 6y agoYou are indeed very good at imagining a world where the only choices are the web exactly as it was in the 90s, and exactly as it is today. That's a rare display of creative ability, but also a false dichotomy.
- mcherm 6y agoIlluminate it for us, then. What is the middle ground that permits SOME computation in the client, yet is so restricted that it cannot take advantage of timing or cache attacks to steal information from other processes running on the same machine. The difficulty with both timing and cache attacks is that a "sandbox" approach is not possible... at least not without special hardware and OS level support like the ability to tell the OS to flush caches on context switches for certain processes.
- clarry 6y ago> What is the middle ground that permits SOME computation in the client You already went down the wrong road there. Can you imagine how to add functionality declaratively? The middle ground is extending user agents to support features that improve the browsing experience and enable new functionality, without turning it into an arbitrary application delivery framework. And yes, this means rejecting and scoping out some things that people do in browsers today. Just like in the past, you as a developer would get to choose whether to write a website (ubiquitous, accessible, runs on grandma's old potato, relatively easy and cheap to maintain; these are the things that made the web popular and businesses around the world decided that it's ok to to make their product a website even if that meant they couldn't have all the features you could with a desktop application), a native application (more effort, more complex, more expensive, more invasive, more friction, more concerning w.r.t. security), or both. To illuminate you, let's pick some examples from the false-dichotomy post... Consider form validation. In fact, this is already done (and could always be extended to support more cases). HTML5 has built-in form validation that works without javascript. And of course it's still perfectly backwards compatible with old browsers that don't do validation; they might send you invalid fields, but you will have to validate them server side anyway because you can't trust the client. https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_va... Static maps have already been done. Not a super smooth experience, but you could always improve that by speccing a zoomable & pannable tiled image element that'll send requests to the specified URL when you pan outside of the loaded area or zoom in. Add a set of loadable elements that are embedded into this image element and you get something that starts to resemble SVG. No JS required. Information about points of interest could already be shown with the hover selector, but there's no reason we couldn't spec an element whose visibility can be toggled with a click, no js needed. Upvote/downvote buttons just need an attribute that tells the browser to post the request but stay on the current page. (This also degrades trivially with browsers that don't support the attribute) You could even toggle the visibility of the arrows after posting; similar CSS selectors for checked inputs already exist. In general, there's no reason we can't have post or get requests that display the response in a new element without reloading the entire page. Semantically, not very different from target="_blank" or whatever you use to load something in a new tab / windows, except this time you want the target to be an element. (At this point I'd also like to note that frames exist and yes they suck but hilariously a lot of the new web does exactly the kind of stateful non-linkable things that framesets were derided for; only worse, because you actually could right-click a frame and link directly to it, but you can't right-click and link the arbitrary DOM that was cooked by your client-side javascript) Going with the tiled image element theme, there's no reason we can't have more elements that instruct the browser how to load more data on demand. These same elements could let the user agent decide whether to paginate or scroll infinitely, or how many items to display per page. (There's no reason we can't load images progressively and on demand.. progressive JPEG exists already, but for some reason devs still insist on giving me a blur and nothing more will load unless I enable scripts) The way we currently do things really sucks for the user (because they have very little control over how the script behaves; the user agent is degraded to a mere dumb client with little meaningful configurability) and it sucks for developers who would rather just focus on the content and let the browser provide whatever UX fits the user & their platform best. Web devs are in a hurry to paper over the deficiencies of browsers but in doing so (and not fixing browsers), we end up with something worse and every goddamn website becomes a complex application. We're stuck in a worst-of-both-worlds state, where the browser runs applications that lack the power of desktop applications, yet are invasive, heavyweight -- don't run on grandmas old potato, complex & expensive to develop and maintain (every website shipping complex UI logic that should be part of the browser instead), increasingly less accessible and less reliable, less linkable & crawlable, less secure.. it's all I never wanted.
- jeffdavis 6y agoIt may not be fully untrusted, but it's good to have barriers as well. Also, this problem is fundamental and not limited to a single core, package or machine. Any time you are making opportunistic optimizations (of which caching is one), and the opportunities available depend on what happened outside of a privilege boundary, you can have this problem. A similar thing happens at a higher level of abstraction with, for example, btree operation timings in a database.
- paulryanrogers 6y agoI wonder if we can make some of these mitigations conditional. When I'm doing key handling or online banking I want max protection. When gaming I want max performance. And I don't want to reboot to switch up kernel parameters.
- craftinator 6y agoI've done hardly any work on kernels before; would it be possible to make such a major change in the fly?
- saagarjha 6y agoI have not looked at the implementation, but I’m sure you could come up with a scheme that checked a flag on context switch and choose to clear the cache or not, which would mean you could ensure it takes effect the very next switch. In practice there may be practical or complexity constraints that would prevent this.
- monocasa 6y agoThe current patch set is implemented as a prctl that you can turn on and off at will.
- the8472 6y agoSome of the mitigations can be opted into on a per-process level via prctl
- bibabaloo 6y agoAm I wrong to assume that cloud vendors are the most worried about these sort of exploits? Having exploits that would allow customers running on the same hardware to access each others' data seems like it would be disastrous for them. So much so that they're probably OK with paying the performance penalty (or, more accurately, passing the extra costs onto their customers!).
- _pmf_ 6y agoTo me, it sounds like it should help ARM64 gain some ground (efficient physically separate machines instead of VMs); not for HPC, but for more traditional workloads.
- eklitzke 6y agoDo you care to elaborate? You can already do this on Linux with any architecture (x86 or anything else) using cpusets.
- vertex-four 6y agoI imagine that it is likely that sharing most hardware will lead to side channel vulnerabilities, and the per-core cache is not special. Smaller, cheaper SoCs could allow for sharing less of that hardware. The problem of course being that CPUs that rival performance of a decently-specced x86 VM are going to be pricy, mooting the point.
- blattimwind 6y agoFor high core count (server) CPUs all levels of cache are local to core(s). For example, in Intel's current plattform each core has a 1.x MB L3 slice attached to it. In AMD's Zen 2 design, each CCX (group of four cores) has 16 MiB of L3 attached to it. Based on these architectural features Intel has had CAT, which essentially turns LLC slices into private caches for certain cores. That's intended for performance, but is now also relevant for security.
- 6y ago
- bsder 6y ago> If untrusted code is running on the same core/package/what have you, your security has already been breached. This used to only be true on x86--IBM and DEC took security seriously and bitched about this incessantly. Nobody cared. x86 was cheap. Eventually everybody just threw up their hands and went to superscalar, deeply predicting, out-of-order microprocessor architectures because that got you better benchmarketing x86 was always insecure. It's just that nobody cared until The Cloud(tm). Malicious client-device Javascript just made it all worse.
- LargoLasskhyfv 6y agoBenchmarketing made me smile. Can't be forgotten now...
- msla 6y ago> If untrusted code is running on the same core/package/what have you, your security has already been breached. This goes against decades of OS design, possibly all serious OS design once you pass over program loaders like MS-DOS and various ROM BASIC iterations. More to the point, there's enough advantages to being able to run untrusted code that a performance trade-off is worth it: If it comes down to being able to run your business at a penalty and having to close up shop, it doesn't take much to figure out what Amazon is going to do with AWS.
- rmrfstar 6y agoDoes Xen have an option like this? In this arena, advice for the "paranoid" has a habit of becoming conventional wisdom. [1] [1] https://www.theregister.co.uk/2018/06/20/openbsd_disables_intels_hyperthreading/ https://www.theregister.co.uk/2018/06/20/openbsd_disables_in...
- dman 6y agoI am hoping control of these mitigations is given to the user in terms of easy to control knobs. I don't have the same concerns as your bigco cloud provider and would like to run my home machines without these mitigations in place. (I do my browsing etc on a laptop and have a workstation that I use mostly/purely for work. In some benchmarks for 10700k the chip has proven to be slower than 9900k and it is being speculated that mitigations in hardware are to blame. Well ... that is unfortunate.
- kees99 6y agoDo any of the common browsers have an option to pin javascript to a dedicated CPU core?
- airocker 6y agoI believe you can write a program to do so: http://man7.org/linux/man-pages/man2/sched_setaffinity.2.html http://man7.org/linux/man-pages/man2/sched_setaffinity.2.htm... Just manually figure out all(or the chosen ones) thread ids spawned by the chrome process.
- kevingadd 6y agoSadly that wouldn't help much since lots of important stuff happens on the same thread(s) that run JS. You also have the issue of javascript from website 1 trying to steal data from website 2, in that case pinning them both to your JS core wouldn't actually protect you from the attack. Among other things there are now mechanisms for doing page rasterization (PaintWorklet) and sound synthesis (AudioWorklet) in JS, so the overhead involved in making all your JS share a single core becomes more dramatic. There's also lots of stuff out there that uses Shared Workers and Workers to do background computation and that won't be background anymore if you pin them all to your JS core.
- kzrdude 6y agoSounds like that will require a 3-year effort to rewrite the javascript engine in that case.
- eecc 6y agoSo, back to ASCII bbs browsing? Because any JS, weird Unicode, or media parsing is a potential occasion for untrusted cose execution
- rbanffy 6y agoWe can at least use iso 8859-1...
- curlypaul924 6y agoYes, please!
- AsyncAwait 6y ago> it seems to me like we are descending into madness now All of the speculative execution mitigations can be turned off with a single flag, I much prefer to have the option to turn them on/off, rather than either not having them at all or not having the ability to disable them. So from my point of view, we're exactly where one would hope we would be in the face of these hardware flaws.
- throwaway_pdp09 6y ago1. It's optional. So you don't have to do it 2. It's for the paranoid. So you don't have to do it 3. It's on context switches. These aren't that common, and reloading it will pull entire cache lines in from the L2 cache which is pretty quick anyway. But this I agree with: > If untrusted code is running on the same core/package/what have you, your security has already been breached. The biggest untrusted sod to be running is usually the browser. Of course if you're worried about that, how about turning off JS thereby blocking the biggest attack vector in it? (and loads of bloody irritating behaviour, as a blissful bonus). Edit: why the world-is-going-to-shit attitude I keep seeing everywhere? The worst possible interpretation is put upon everything, instead of evaluating the risk/reward rationally then choosing appropriate actions.
- josteink 6y ago> It's optional. Until it's proven not to be so, through another POC. And then OPs point stands: Lots of Intel's performance gains since the 90s has been through out-of-order execution and branch-prediction. If those improvements are deemed incompatible with being able to securely run JS in your browser, I would argue Intel is having a very fundamental problem now. Hopefully AMD does better, but I don't think they are entirely immune to this category of security-issues either.
- throwaway_pdp09 6y agoNo, it's optional in the sense of you choosing to enable it. I also suspect the performance hit will be minimal, however I'm not an expert. > If those improvements are deemed incompatible with being able to securely run JS in your browser, I would argue Intel is having a very fundamental problem now. Well it is, yet people are overwhelmingly willing to expose a turing complete language controlled by some 3rd party they know little or nothing about directly to the open internet. The problem there is nothing to do with hardware. It's people. (agreed about AMD)
- globular-toast 6y ago> It's on context switches. These aren't that common A context switch probably happens thousands of times per second on modern systems. What do you mean by "not that common"?
- lmm 6y agoTransparent caches are always a mistake - there are only two hard problems in computer science, after all. The problem isn't untrusted code (because untrusted data is equivalent, and virtually everyone processes untrusted data at some point), the problem is hardware that's too clever by half, because it tries to guess what you meant instead of just doing what you told it.
- Symmetry 6y agoI think I would come to exactly the opposite conclusion. Performant caching is so hard to do right that you'd be fooling to do your own rather than trust the vendor provided solution which has had far more testing than anything you could hope to do yourself.
- diroussel 6y agoThat is not the opposite to Imm's point. Transparent caching is when the client and the server don't know it's happening.
- zbuf 6y agoI think we just stretched the 'unix' model in the wrong direction -- attempts to solve every problem, at every layer, all of the time. Trying to be everything to everyone never works out very well. It would have been better to preserve users (UIDs) as the 'security' boundary for data. Leaving processes (PIDs) to offer the containment for safety (virtual memory etc.), and specifically not security of data. Then this specific case would only need the cache flushed on context switching between UIDs, but not all processes. Attempts to retro-fit security of data between processes are resulting in as much a negative as a positive -- eg. performance loss; or usability issues like regular users on Linux gdb'ing their own processes now has to be explicitly enabled by root. Of course, the new thing is all this untrusted code we're running; understood. I would suggest to preserve UIDs as the security boundary for data, then direct these issues through a mechanism that makes it as easy for an unprivileged user to 'fork' a UID for a purpose, just as they fork() a process. This gives a clear role to UIDs/PIDs and a sandboxing capability that makes use of all the existing implementation and boundaries.
- wtallis 6y agoFrom an end-user perspective, what really needs to happen is a new layer between UIDs and PIDs, corresponding to applications or services. It shouldn't matter whether under the hood an application uses multiple threads or multiple processes, as long as they're all contained to the same sandbox. I agree that fitting this model to current standard Unix capabilities probably means each application running under a separate UID—which is already common for services running on a server, but not for desktop/GUI applications.
- josteink 6y ago> I agree that fitting this model to current standard Unix capabilities probably means each application running under a separate UID Separate UIDs quickly get confusing too. I think such separation would be better done via cgroups and namespaces instead.
- zbuf 6y agoNo, I believe that misses my original point. cgroups and namespaces are privileged mechanisms that only 'root' can use, and share UIDs and other scopes across them (UID namespaces are complex and a risk in themselves.) It's required to re-implement all the required policy. Separate UIDs need get no more confusing than PIDs. I agree we really don't want /etc/passwd with a gazillion entries; we should only be managing them only as much as we "manage" temporary PIDs. But imagine a command to view the "UID" tree like the PID one. I agree it might not be how we'd design it if we designed from scratch. But then we may have chosen cgroups that integrated into the process tree and several other design decisions would change. The name "user" ID distorts the conversation because it's unintuitive, but I am suggesting that UIDs already embody much of the policy that is needed.
- badrabbit 6y agoI disagree completely with this comment. Processors are expected to execute hostile code without dilluting memory between contexts. Especially in the early days of computing,multi-terminal access to a computer was common. We routinely rely on virtualization and containers for isolation. Even in this very browser you're using, you are supposed to expect untrusted hostile code to run in other tabs. Imagine going to a website and their JS is reading memory from your password mananger, and would you then have a similar reaction? Why do you need single core performance so badly. I can't even think of an example where single core performance has been an issue for me, and I routinely run tasks on decade old CPUs. And even if it was an issue, You are essentially saying security should be an after-thought,sorry but your reasonig is very dangerous. Would you get in a car where the engineer of the car thinks "if people are ramming your car on the freeway,you have bigger problems,let's focus on making it lightweight,fast and fuel efficient". And to be frank with you, people that have been doing admin/engineering work since the 90's with that attitude are a bigger security threat to most orgs (and themselves) than any hacker (with the exception of the few orgs/people that receive targeted attacks frequently). The days of treating security as a perimeter issue have been long gone for about a decade now. Whether it is network, system or software security,the entry points and perimeters have been rendered meaningless (lookup zero trust, I think it applied here too).
- dirtydroog 6y ago> Why do you need single core performance so badly Because on the cloud, performance is directly correlated to your monthly bills.
- badrabbit 6y agoSo is security, cloud cryptominer bots come to mind if you don't care about data security. I think you should take up billing issues with your provider, if the security mitigation slows down your processing speed then I hope your bill lowers proportionally as well.
- devwastaken 6y agoThat's the fault of cpu manufacturers. Specifically Intel. Nobody likes it, but the mitigations are necessary. We live in a software world that relies upon the Internet. Intel should be held accountable. A fine every quarter they continue to put national security at harm.
- MintelIE 6y agoWe? What "we?" I think it's much better to lay the blame at the feet of the companies who made these decisions, rather than generically blaming everybody. Theo De Raadt called out Intel in particular when they started taking all kinds of crazy shortcuts like this, all the way back in 2007.