Spectre in JavaScript
leaky.page
leaky.page
Linus said he wanted the workarounds disabled by default, why didn't anyone listen?
I'm not browsing javascript sites on my linux server!?
If the server is compromised they don't need to use meltdown/spectre to do damage since servers need root for everything useful (open port <1024)?!
- there are lots of useful things you can do without root
- you don’t need root to bind to port numbers below 1024 on Linux, just CAP_NET_BIND_SERVICE
- when you do need root, you can usually drop it either partially or completely
Can you combine that with nohup?
nohup setcap 'cap_net_bind_service=+ep' blabla...
You should probably run production services using something other than nohup, though, like systemd.
How do you do that if you're not root?
And if you are building an executable with that capability, how do you enable your Makefile to set it?
I think we might need "CAP_SET_CAP_NET_BIND_SERVICE" as well.
In fact, I might want to allow a user to bind to port 200 only.
So in this case "CAP_SET_CAP_NET_BIND_SERVICE_PORT_200" is needed.
And here we see the inflexibility of the entire approach :)
Alternatively, if you're only concerned about other privileged ports, with a systemd socket unit, you could have systemd do the binding and pass your unprivileged process the socket, so that your process no longer needs the privileged-bind capability at any time; that'd probably be the easiest way if you're willing to modify the application code a bit. If you don't like systemd, you could have another helper program do it.
Or you could put your process in its own network namespace which has a filtered bridging or routing configuration between it and whichever namespace has the ‘real’ connectivity, which is complex and awkward but allows your process to ‘think’ it has full access, which might help if the code would otherwise balk.
Or you could use various other userspace sandboxing frameworks that let you install a BPF syscall filter, which I like a lot in theory but don't currently have personal experience with.
> And if you are building an executable with that capability, how do you enable your Makefile to set it?
The goal is to bind without passing through root, not to never have root at all, so you could run the service with it as an ambient capability (supported by e.g. systemd). Or setcap as root after building.
> In fact, I might want to allow a user to bind to port 200 only.
Program with the capability on its file to check the user, bind the socket, drop the capability, and exec. (I’m sure something existing does that, but I don’t have one to recommend since I’ve never needed it.)
But there’s also iptables and friends as alternative solutions to the same problem that still don’t require giving the process root at any point.
Nowadays, the focus going forward is much more on giving every piece the privileges it needs, and not have an "absolute privilege" entity. (Outside of the kernel, although even for that it's less and less true anymore.)
No. A million times no. Absolutely no. It is not. You are doing a disservice to actual real people when you take away what they own.
I own my hardware. I am root. I have absolute privileges. The idea that root has absolute privileges is the core if why I use Linux.
If you had physical access, you could add a flag at boot to enable access to these services, but this was not enabled by default, which is good.
Which is why NT was designed from the ground up with capabilities.
Interestingly the Chromium blog posted about mitigating side-channel attacks just earlier today.
https://blog.chromium.org/2021/03/mitigating-side-channel-at...
The Google Security blog also has a writeup on this PoC.
https://security.googleblog.com/2021/03/a-spectre-proof-of-c...
JavaScript usually gets JIT'ed into machine language code. That code gets executed locally. There are usually a bunch of differences in terms of form and restrictions around that code, but this might well be a case where most of those differences don't matter.
Or in other words, browsers are just compilers/interpreters like any other, albeit very hardened ones because of the large exposure of untrustworthy code they are subject to. But if an attack fundamentally skirts around sandboxes, the browser sandbox won't help.
It's Turing machines all the way down.
[Error] RuntimeError: Out of bounds memory access (evaluating 'this.wasm.exports.oscillateTreePLRU2')
<?>.wasm-function[2] (memory_frame.html:78)
wasm-stub
oscillateTreePLRU2
_timeL1 (memory_frame.html:78)
leakMeTestSet (memory_frame.html:146)
Global Code (memory_frame.html:165)Chrome is doing it. What about Firefox and Safari? What about Edge? Do they implement site isolation?
Or completely redesigning those aspects of CPU behavior to remove the ability for similar timing attacks.
That this is generally considered ok boggles the mind. That browser vendors have made it difficult for users to disable this is insane! Even MS Internet Explorer gave users at least that security tool!
People like you who want to turn js off are a very small niche. And you have better solutions. Run your browser in a remote server using rdp or vnc. I think it may be equally safe and you may actually have a larger chunk of web working for you.
I get that some people would like that because they think all those things belong in native apps, but that’s not where the “modern web” is today.
If we didn't complain about Flash, we still would have Flash applets.
Yesterday there was however people that were saying, "that's how it is, deal with it" or "But, but... Without it we can't have this and that" or "The ship has sailed, get over it".
Today, we have reasons to complain about JS. Yes, it enhances interactivity, but it also abused. There's a lot of unwanted interactivity (the type of one-way interactivity that lets a server know more than necessary about their clients).
You can still have branch prediction and caches, which is a very good thing, because not having those would cut the performance of modern CPUs to less than 1% of what it currently is.
On Chrome I have "too many false negatives" on 1st gen Ryzen.
My searching indicates firefox's performance.now precision is 20us, but the demo claims to be able to get timing differences of 2ms pretty easily.
EDIT: 20us precision might be outdated... running this repeatedly on osx and linux, I'm distinctly getting my results "bucketed" into whatever the unit on the x-axis is. Based on that, I'm guessing timer precision on firefox is actually 1ms.
Increasing the cache timer repetitions gets me to a smooth graph, but still no separation of the peaks.
The fact that I can get the graph to go from discrete buckets to smooth normal curves makes me think this can indeed overcome reduced timer precision
The fact that I can't get the peaks to separate makes me wonder if some other mitigation is protecting me.
That's pretty bad.
https://agoric.com/taxonomy-of-security-issues/ and https://ses-demo.netlify.app/demos/challenge/
When the people injecting JavaScript are interested in exploits rather than dumb ISP value added services and notifications, it becomes more obvious that running code from untrusted sources, even if it's sandboxed, is dangerous.
I'm using HTTP securely just fine when I connect to it with my own client and my own encryption!
Servers don't use browsers.
We don't need HTTPS, we need less complexity and HTTP is just fine for transport!
https://obscuritory.com/essay/incredible-boxes-of-hock-wah-y...