News for hackers. Stuff that matters.
Re:Reading privileged memory with a side-channel by jotux on Wednesday January 03, 2018 @06:14PM (#16066391)
Papers describing each attack:

https://meltdownattack.com/meltdown.pdf

https://spectreattack.com/spectre.pdf

From the spectre paper:

>As a proof-of-concept, JavaScript code was written that, when run in the Google Chrome browser, allows JavaScript to read private memory from the process in which it runs (cf. Listing 2).

Scary stuff.

Re:Reading privileged memory with a side-channel by jhallenworld on Wednesday January 03, 2018 @07:02PM (#16066710)
"Meltdown" is an Intel bug.

"Spectre" is very bad news and affects all modern CPUs. Mitigation is to insert mfence instructions throughout jit generated sandboxed code making it very slow, ugh. Otherwise assume that the entire process with jit generated code is open to reading by that code.

Any system which keeps data from multiple customers (or whatever) in the same process is going to be highly vulnerable.

Re:Reading privileged memory with a side-channel by kibwen on Wednesday January 03, 2018 @07:19PM (#16066810)
> Mitigation is to insert mfence instructions throughout jit generated sandboxed code making it very slow, ugh.

Here's the synchronized announcement from Chrome/Chromium: https://sites.google.com/a/chromium.org/dev/Home/chromium-se...

"Chrome's JavaScript engine, V8, will include mitigations starting with Chrome 64, which will be released on or around January 23rd 2018. Future Chrome releases will include additional mitigations and hardening measures which will further reduce the impact of this class of attack. The mitigations may incur a performance penalty."

Chrome 64 will be hitting stable this month, which means that it ought to be possible to benchmark the performance penalty via testing in Chrome beta. Anybody tried yet?

Re:Reading privileged memory with a side-channel by dannyw on Wednesday January 03, 2018 @07:40PM (#16066928)
The mitigations are to disable SharedArrayBuffer and severely round performance.now(). Not good that there aren’t other less intrusive ways to mitigate.
Re:Reading privileged memory with a side-channel by kibwen on Wednesday January 03, 2018 @07:46PM (#16066957)
I don't get the impression that those are the full extent of the changes though; I think those two were called out only because they're API changes rather than implementation details. Haven't checked the code so I could be wrong, of course.
Re:Reading privileged memory with a side-channel by mirashii on Wednesday January 03, 2018 @09:04PM (#16067400)
A little bit more info can be found here [1]. In particular, site isolation [2] will also assist in protecting against this vulnerability.

[1] https://support.google.com/faqs/answer/7622138#chrome [2] http://www.chromium.org/Home/chromium-security/site-isolatio...

Re:Reading privileged memory with a side-channel by DannyDaemonic on Thursday January 04, 2018 @01:01AM (#16068371)
Would it be practical to run each javascript VM in it's own sandbox?

Edit: Apparently you can already do something like this. Seems to be an option for Chrome starting with 63. (Which was an October release I believe?

http://www.chromium.org/Home/chromium-security/site-isolatio...

Re:Reading privileged memory with a side-channel by aidenn0 on Wednesday January 03, 2018 @08:18PM (#16067160)
That can't be right because they already round performance.now() so the Spectre attack didn't use it (it instead used a webworker with a tight-loop incrementing a counter)
Re:Reading privileged memory with a side-channel by olliej on Wednesday January 03, 2018 @09:07PM (#16067417)
the tight loop iteration used a shared array buffer to provide a high resolution timer, specifically to deal with the obvious fix of truncating precision of performance.now().

The reason for /further/ truncating performance.now() is that the relative cost in this attack means that you don't need as much precision as was needed for the original (page table? I think) attack.

A SAB timer just needs to increment a counter in one thread and read it in the host thread and the granularity is however long it takes to get through a for-loop.

Re:Reading privileged memory with a side-channel by aidenn0 on Wednesday January 03, 2018 @10:52PM (#16067910)
Thanks, I missed how important SAB was to their webworker timer.
Re:Reading privileged memory with a side-channel by jchw on Wednesday January 03, 2018 @08:10PM (#16067116)
> ...severely round performance.now().

This sucks, and is a side-effect that I didn't even think about. I guess it's probably pretty effective, but it will make benchmarking a lot harder, since you'll probably now have to do a lot more runs.

Re:Reading privileged memory with a side-channel by gchadwick on Thursday January 04, 2018 @05:25AM (#16069225)
If it was a big issue you can always introduce a 'benchmark mode' switch that allows you to put resolution back into the counter when you want to run a benchmark. Display a 'WARNING BROWSER INSECURE IN THIS MODE' banner for good measure.
Re:Reading privileged memory with a side-channel by user5994461 on Thursday January 04, 2018 @02:12AM (#16068579)
Doubt that. The Firefox news said they will round to 20 us.

That's much more accurate than necessary to benchmark any software code.

Re:Reading privileged memory with a side-channel by londons_explore on Thursday January 04, 2018 @07:55AM (#16069960)
Those are the mitigations firefox is doing. Is chrome doing the same?
Re:Reading privileged memory with a side-channel by mschuetz on Thursday January 04, 2018 @06:45AM (#16069615)
For some reason, performance.now() and even the performance profiler are capped at 1 milisecond precision on my machine, which make both pretty much useles. Can only get better for me. :|
Re:Reading privileged memory with a side-channel by simion314 on Wednesday January 03, 2018 @07:12PM (#16066772)
From the article it seems that is not 100% sure AMD and ARM are not affected by metldown, only that they could not trigger the issue, but authors mention this

"However, for both ARM and AMD, the toy example as described in Section 3 works reliably, indicating that out-of-order execution generally occurs and instructions past illegal memory accesses are also performed."

Re:Reading privileged memory with a side-channel by jhallenworld on Wednesday January 03, 2018 @07:47PM (#16066970)
I would think that any sane implementation would not transmit privileged data to waiting instructions.

Look at their Listing 2: Instructions 5 - 7 will be waiting for the privileged data from line 4 (they are not speculatively executed since they have a data dependency on line 4).

So why is Intel releasing the privileged data to the waiting instructions? An answer could be that violation checking is delayed until retire, but other implementations are possible.

Anyway, so it could be that AMD and ARM are vulnerable, but it's possible that they are not.

Re:Reading privileged memory with a side-channel by olliej on Wednesday January 03, 2018 @08:05PM (#16067088)
There are two different issues.

1. Intel only (so far) is related to prefetching privileged memory 2. More or less everyone: Speculatively executing code that has variable execution time.

Re:Reading privileged memory with a side-channel by bonzini on Thursday January 04, 2018 @03:34AM (#16068802)
> I would think that any sane implementation would not transmit privileged data to waiting instructions.

The point of VIPT caches is exactly to use data before all the checks are completed.

It's easy to judge the sanity of things ex post, but maybe it's not that easy if it took 20 years to find the issue.

Re:Reading privileged memory with a side-channel by contrarian_ on Thursday January 04, 2018 @06:11AM (#16069426)
I don't believe for a second that nobody came up with this idea before. I believe that nobody until now had the motivation to spend the time actually trying to confirm that it's a problem by developing a PoC. Most people would have given up on the idea simply because CPU vendors are not expected to make such a fundamental mistake.
Re:Reading privileged memory with a side-channel by londons_explore on Thursday January 04, 2018 @07:59AM (#16069988)
The mistake is clear from the design - thats why all CPU vendors are vulnerable to variants of the same bugs.

Previously side channel attacks like this have been seen by the security community as unreliable things which only work in very specific cases and have to be averaged over millions of runs.

This attack shows a side channel which is general purpose, reliable, and fast.

Re:Reading privileged memory with a side-channel by contrarian_ on Thursday January 04, 2018 @08:51AM (#16070280)
> The mistake is clear from the design

There is no fundamental reason why speculative instructions should be allowed to mutate the cache.

OTOH the contention-based side channel attack on speculation has been public knowledge for over a decade. [1]

[1] Z. Wang and R. B. Lee, "Covert and Side Channels Due to Processor Architecture," 2006 22nd Annual Computer Security Applications Conference (ACSAC'06), Miami Beach, FL, 2006, pp. 473-482. doi: 10.1109/ACSAC.2006.20

Re:Reading privileged memory with a side-channel by bonzini on Friday January 05, 2018 @03:10PM (#16081242)
> There is no fundamental reason why speculative instructions should be allowed to mutate the cache.

There is: hundreds of instructions can be in flight speculatively at the same time, especially if you take hyperthreading into account. Good luck rolling them all back.

The question is not whether the cache should be mutated during speculative execution. It's what kinds of speculative execution are allowed, and in some cases it's not even clear if fences should be placed by the programmer (whack-a-mole style), the compiler (not sure how) or the processor (probably not). It's non-obvious enough that how to solve it is to some extent a research problem.

Re:Reading privileged memory with a side-channel by wilun on Friday January 05, 2018 @10:48PM (#16083733)
About Meltdown, it was well known since even before that speculative execution has to stop at security boundaries.
Re:Reading privileged memory with a side-channel by asveikau on Thursday January 04, 2018 @01:41AM (#16068500)
> Mitigation is to insert mfence instructions throughout jit generated sandboxed code making it very slow, ugh. Otherwise assume that the entire process with jit generated code is open to reading by that code.

It seems like keeping untrusted code in a separate address space would be a suitable workaround? A lot of comments here seem to be implying that meltdown-style reading of separate address spaces is possible via Spectre, and my read is that it wouldn't.

Re:Reading privileged memory with a side-channel by valleyer on Thursday January 04, 2018 @03:37AM (#16068814)
No, the Spectre paper discusses cross-process attacks too. First, you use BTB poisoning to coerce the victim process to branch-mispredict to code of your choice (a "gadget"). You can get that code to load memory of your choice, which can be the code of shared libraries (which are usually loaded only once into physical memory for all processes). Then you can do timing attacks using the last-level cache to determine whether that memory is in cache.

It's certainly not easy, but it's doable.

Re:Reading privileged memory with a side-channel by rtpg on Thursday January 04, 2018 @07:19AM (#16069781)
This is mitigatable if the attacker process can't send a memory address to the victim process, right? Even if you can poke at the memory for cache prediciton misses, if you can't control what the victim process accesses, it seems harder to exploit.

We're all talking about how Spectre is this magic "get access to any memory from any process". But it looks to me like it's a new class of attack, that still requires specific entry points for the software you're trying to attack.

I'd like to be proven wrong on this, but it _feels_ like this is more of a software thing like other timing bugs. In theory you can write software that isn't vulnerable

EDIT: my reading of the "JS Spectre implementation" is "JIT code runs in the process of the browser + you can write JS code to read the process's own memory". I can imagine messiness with extensions (1Password in particular).

Re:Reading privileged memory with a side-channel by stupidcar on Thursday January 04, 2018 @08:55AM (#16070301)
I don't think so. My understanding from the paper is that you don't need to explicitly send a memory address to the victim, you just need a way to communicate with it (e.g. via a socket or some other API) in a way that causes it to do a branch.

Before you trigger the victim process, you perform some steps in your own, hostile, process that teaches the branch predictor where a particular branching operation will likely go. Then you trigger the victim process in the way you know will cause a very similar branching operation.

Even though it's operating within an entirely different process, the branch predictor uses what it learnt in the hostile process to predict the branch result in the victim process. It jumps to the address the hostile process taught it, and starts to speculatively execute code there. Eventually, it figures out it guessed wrong, but by then it's too late, and the information has leaked via a side-channel in a way that the hostile process can detect.

So, essentially, you're use the branch predictor's cache to send the memory address. And you're not sending it to the victim process, you're sending it directly to the CPU. The victim process will never even know it's been attacked, because when the branch predictor hides the consequences of its incorrect guess from being detected by conventional means.

Re:Reading privileged memory with a side-channel by rtpg on Thursday January 04, 2018 @09:32AM (#16070530)
this still seems off to me.

I get that the victim process' branch prediction can be messed with. But if my victim process is:

   password = "password"
   secret = "magic BTC wallet secret key"
   while True:
       password_attempt = input()
       if constant_time_compare(password, password_attempt):
           print(secret)
And my input is something like:

   result = ""
   while sys.stdin.peek() not in ['\n', EOF]:
      result += sys.stdin.get()
Then at no point is the victim program really exposing any pointer logic, so not even the victim process will be accessing the `secret` during execution, let alone the hostile process.

The examples given all include arrays provided by the hostile program, and some indexing into the arrays. I definitely see this being an issue in syscalls, but if that's the scope of this, I wouldn't call Spectre a "hardware bug" any more than other timing attacks would be hardware bugs.

Re:Reading privileged memory with a side-channel by stupidcar on Thursday January 04, 2018 @10:44AM (#16071159)
The victim code doesn't need to have some explicit pointer arithmetic, it just has to have some sequence of bytes, somewhere in its address space (the "gadget"), that can be used to read a memory address based on a value stored in a register that can be affected by input supplied from the hostile process. The branch prediction is used to speculatively execute that code. The "Example Implementation on Windows" section in the Spectre paper goes into more detail about this.
Re:Reading privileged memory with a side-channel by Certhas on Wednesday January 03, 2018 @07:17PM (#16066799)
After skimming the articles it sounds like a lot hinges on just how hard Spectre is to pull off in practice/in the wild. Anyone have any insights on that?
Re:Reading privileged memory with a side-channel by labster on Wednesday January 03, 2018 @09:16PM (#16067452)
I don't know much about this particular flaw, but I imagine it'll be pretty hard until someone releases an exploit kit, and then pretty easy after that.
Re:Reading privileged memory with a side-channel by contrarian_ on Thursday January 04, 2018 @06:13AM (#16069440)
It's an arms race, there will always be new ways of exploiting this flaw in unexpected ways unless speculation is disabled entirely on existing CPUs.
Re:Reading privileged memory with a side-channel by user5994461 on Thursday January 04, 2018 @02:16AM (#16068595)
They say they can reliably read memory around 120kB/s with one vulnerability and 1kB/s with the other. It just works, all the time. Some of the PoC takes a few minutes to initialize.

I'd say difficulty level is easy.

Re:Reading privileged memory with a side-channel by Certhas on Thursday January 04, 2018 @07:00AM (#16069681)
However, only one of the PoCs runs on AMD, and that doesn't cross process boundaries.

So how easy is it to turn that PoC into something I should worry about? Seems like browsers are the most affected by this scenario, but that also means harden the browser (separate process per page) and it might be difficult to exploit.

Re:Reading privileged memory with a side-channel by lrem on Thursday January 04, 2018 @07:52AM (#16069946)
As a general rule of thumb, if everyone already has a PoC, you should assume someone has been doing targeted practical attacks for a while.
Re:Reading privileged memory with a side-channel by Avamander on Thursday January 04, 2018 @06:08AM (#16069412)
Difficulty to exploit is easy once you have the exploit running. Writing a new exploit is really hard, otherwise we wouldn't be starting 2018 with these news.
Re:Reading privileged memory with a side-channel by FranOntanaya on Wednesday January 03, 2018 @09:45PM (#16067588)
It doesn't look that hard, and in any case, we will suffer the mitigation consequences either way.
Re:Reading privileged memory with a side-channel by contrarian_ on Thursday January 04, 2018 @06:13AM (#16069445)
Worse, no mitigation will ever be complete against Spectre, unless flat out disabling speculation across memory loads.
Re:Reading privileged memory with a side-channel by wilun on Friday January 05, 2018 @11:28PM (#16083853)
With the right new instructions inserted at the right place, assisted by a good type system, and a processor that does not share its resources like crazy in highly uncontrolled ways, this seems fixable.

Sadly, I feel the only part that won't happen will be the programming language part, but who knows.

Re:Reading privileged memory with a side-channel by olliej on Thursday January 04, 2018 @12:11AM (#16068207)
it isn't. There have been a few PoC referenced on twitter, and the spectre paper itself reference a PoC in browser hosted javascript (e.g. random ad can scan memory)

it's obviously not a free + zero time activity, but I'm going to assume someone making an ad to scan memory isn't super concerned about end user cpu usage or battery life..

Re:Reading privileged memory with a side-channel by binarycrusader on Wednesday January 03, 2018 @10:27PM (#16067807)
"Spectre" is very bad news and affects all modern CPUs

It's not yet clear whether it affects all modern CPUs, notably I have yet to see any mention of modern POWER/MIPS/SPARC-based designs. If someone has pointers, those particular cases would probably be quite interesting.

Re:Reading privileged memory with a side-channel by cthalupa on Wednesday January 03, 2018 @10:58PM (#16067936)
https://access.redhat.com/security/vulnerabilities/speculati...

Additional exploits for other architectures are also known to exist. These include IBM System Z, POWER8 (Big Endian and Little Endian), and POWER9 (Little Endian).

Re:Reading privileged memory with a side-channel by pizlonator on Wednesday January 03, 2018 @10:39PM (#16067859)
It affects CPUs that do speculative execution. Pretty sure some powers do.
Re:Reading privileged memory with a side-channel by binarycrusader on Wednesday January 03, 2018 @11:17PM (#16067998)
I wonder to what degree some systems are affected. I believe Solaris already uses separate address spaces on SPARC for user and kernel. I haven’t looked over the SPARC architecture manual to see if they allow speculative execution beyond privilege boundaries.
Re:Reading privileged memory with a side-channel by olliej on Thursday January 04, 2018 @12:08AM (#16068188)
That only prevent reading over higher privilege (the meltdown vulnerability) it doesn't protect the arbitrary user land reads from spectre.
Re:Reading privileged memory with a side-channel by ErikAugust on Wednesday January 03, 2018 @07:18PM (#16066804)
I've thrown the C code in the Spectre paper up if anyone wants to feel the magic: https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9...
Re:Reading privileged memory with a side-channel by dpwm on Wednesday January 03, 2018 @09:17PM (#16067454)
Just tested this on systems of varying age.

Works on processors going back as far as 2007 (the oldest I have access to now is an Athlon 64 X2 6000+), but the example code relies on an instruction that the Atom D510 does not suport.

Because Spectre seems to be an intrinsic problem with out-of-order execution, which is almost as old as the FDIV bug in intel processors, I would be very surprised if the Atom D510 did not turn out to be susceptible using other methods as outlined in the paper.

EDIT: I originally suspected this instruction was CLFLUSH and erroneously claimed the D510 doesn't support sse2. It does support sse2, so it must be that it does not support the RDTSCP instruction used for timing.

EDIT: This gets very interesting. I made some modifications to use a CPUID followed by RDTSC, which now runs without illegal instructions and works everywhere the previous version worked. Except on the D510, this runs but I cannot get the leak to happen despite exploring values of CACHE_HIT_THRESHOLD. Could the Atom D510 really be immune from Spectre?

Re:Reading privileged memory with a side-channel by ENOTTY on Wednesday January 03, 2018 @10:03PM (#16067688)
The D510 might not have speculative execution. https://en.wikipedia.org/wiki/Bonnell_(microarchitecture)
Re:Reading privileged memory with a side-channel by sargun on Thursday January 04, 2018 @04:07AM (#16068926)
Certain Atom CPUs have no speculative execution nor OoO execution.
Re:Reading privileged memory with a side-channel by ojiikun on Wednesday January 03, 2018 @07:43PM (#16066943)
Thanks for this. Would love an annotated version of this if anyone is up for it. My C is pretty good, but some high level "what is being done here" and "this is what shouldn't work" comments would be cool to see.
Re:Reading privileged memory with a side-channel by JetSpiegel on Wednesday January 03, 2018 @08:34PM (#16067243)
Worked on a Intel(R) Celeron(R) CPU 847 @ 1.10GHz.

With "gcc (GCC) 7.2.1 20171128", remove the parenthesis from CACHE_HIT_THRESHOLD macro[1] to compile correctly.

[1]: https://gist.github.com/ErikAugust/724d4a969fb2c6ae1bbd7b2a9...

Re:Reading privileged memory with a side-channel by airesQ on Wednesday January 03, 2018 @07:25PM (#16066850)
Worked on my system.

(Set cache_hit_threshold to the default value of 80, my cpu is an Intel i7-6700k.)

Re:Reading privileged memory with a side-channel by diyseguy on Wednesday January 03, 2018 @09:44PM (#16067581)
I thought it was supposed to be exploitable by javascript? If you can get to the machine and run c code, well, that doesn't seem like an exploit?
Re:Reading privileged memory with a side-channel by PeterisP on Friday January 05, 2018 @11:12AM (#16079448)
At its core both vulnerabilities are essentially local privilege escalation bugs (i.e. a random process can read e.g. secret keys from another process), but that still is a very important exploit - if I can run unprivileged C code on e.g. AWS and are able to read the memory of someone else running on the same shared machine, that's really bad.

The Javascript case is the main one that makes it remotely exploitable.

Re:Reading privileged memory with a side-channel by FranOntanaya on Wednesday January 03, 2018 @09:56PM (#16067651)
My understanding is it's anything that can make a running process mis-train the CPU core and read the values back. Consider, for example, shared hosts without separate process pools, running code from different users with the same interpreter processes.
Re:Reading privileged memory with a side-channel by ComputerGuru on Thursday January 04, 2018 @01:50AM (#16068516)
Just because it runs in a C PoC does not mean it only runs in C.
Re:Reading privileged memory with a side-channel by porjo on Wednesday January 03, 2018 @11:43PM (#16068098)
From the Spectre whitepaper:

> In addition to violating process isolation boundaries using native code, Spectre attacks can also be used to violate browser sandboxing, by mounting them via portable JavaScript code. We wrote a JavaScript program that successfully reads data from the address space of the browser process running it.

The whitepaper doesn't contain example JS code however

Re:Reading privileged memory with a side-channel by diyseguy on Thursday January 04, 2018 @12:01AM (#16068166)
This whitepaper describes the Javascript exploit in Section IV. I'm struggling to understand it though: http://www.cs.vu.nl/~herbertb/download/papers/anc_ndss17.pdf
Re:Reading privileged memory with a side-channel by diyseguy on Thursday January 04, 2018 @11:00AM (#16071321)
This too was provided as a proof of concept (without explanation): https://brainsmoke.github.io/misc/slicepattern.html. I'm not sure what I'm looking at though
Re:Reading privileged memory with a side-channel by diyseguy on Tuesday January 09, 2018 @08:42PM (#16111928)
This is the first implementation in Javascript I have seen so far: http://xlab.tencent.com/special/spectre/js/check.js
Re:Reading privileged memory with a side-channel by PeterisP on Friday January 05, 2018 @11:10AM (#16079433)
At its core both vulnerabilities are essentially privilege escalation bugs (i.e. a random process can read e.g. secret keys from another process), but the Javascript case is the one that makes it remotely exploitable.
Re:Reading privileged memory with a side-channel by mfukar on Thursday January 04, 2018 @10:01AM (#16070739)
It is.
Re:Reading privileged memory with a side-channel by leni536 on Thursday January 04, 2018 @03:59AM (#16068898)
Work's on Intel® Core™2 Duo Processor T7200. Had to replace __rdtscp(&junk) with __rdtsc(), the Core 2 doesn't have the former.
Re:Reading privileged memory with a side-channel by sqldba on Wednesday January 03, 2018 @10:53PM (#16067914)
Works on MacOS 10.13.2.

Looking back, the Mac patches were to address KPTI (Meltdown) which is separate to Spectre.

Re:Reading privileged memory with a side-channel by bspammer on Thursday January 04, 2018 @05:22PM (#16074642)
Terrifyingly, this seems to work on a DigitalOcean droplet. I'm assuming this means people could potentially read memory from other VMs on the same system, albeit with a great deal of difficulty.
Re:Reading privileged memory with a side-channel by diyseguy on Thursday January 04, 2018 @11:45AM (#16071734)
So... it reads a string that was declared at the top of the file?
Re:Reading privileged memory with a side-channel by theptip on Wednesday January 03, 2018 @07:07PM (#16066741)
I think this means we should consider all browser processes to be completely insecure, until mitigations are applied (e.g. Chrome's Site Isolation: https://www.chromium.org/Home/chromium-security/ssca).

Looks like any session token/state could be exfiltrated from your Gmail tab to a malicious JS app running in-process, for example.

Am I overreacting here?

Re:Reading privileged memory with a side-channel by kibwen on Wednesday January 03, 2018 @07:39PM (#16066921)
> Am I overreacting here?

Still skimming the paper, but the JS attack appears to be processor-intensive (please chime in if you interpret it differently!). Any widespread, indiscriminate use of such an attack in the wild seems like it would eventually be detected as surely as client-side cryptocurrency mining was discovered. If you aren't a valuable target, if you don't visit sites that are shady enough to discreetly mine bitcoin in your browser, and if you use an adblocker to defang rogue advertisers, then you probably shouldn't lose too much sleep over this (which is not intended to diminish how awesome (in the biblical sense) this attack is).

That said, if there were ever a time to consider installing NoScript, now's it: https://addons.mozilla.org/en-US/firefox/addon/noscript/

Re:Reading privileged memory with a side-channel by jwilk on Wednesday January 03, 2018 @07:42PM (#16066942)
And if you're a web developer, now it the good moment to make sure your site works correctly when JS is disabled.
Re:Reading privileged memory with a side-channel by deckard1 on Wednesday January 03, 2018 @08:05PM (#16067090)
We'll have to dig a time machine out and go back to 1998 then.

I'm being a facetious ass. But you know I'm not wrong, either.

Re:Reading privileged memory with a side-channel by dmm on Wednesday January 03, 2018 @08:12PM (#16067129)
You are wrong. Install the NoScript extension and you can see your site without js. NoScript also allows you to selectively enable js per site on a temporary or permanent basis. This is the default way that I and many other people browse the web.

https://noscript.net/

Re:Reading privileged memory with a side-channel by TikiTDO on Wednesday January 03, 2018 @08:30PM (#16067222)
Just looking around, general available figures for public internet (as opposed to tor) suggest that anywhere between 0.1% to 1.0% of users have JS disabled. These numbers have also been consistently going down over time. That's a fairly small number to dictate how a system should be designed.
Re:Reading privileged memory with a side-channel by losteric on Wednesday January 03, 2018 @08:51PM (#16067339)
That depends on your target demographic. JS is more frequently disabled among tech-literate customers, so a cloud provider's home page would probably benefit from working without JS.
Re:Reading privileged memory with a side-channel by gatmne on Wednesday January 03, 2018 @11:08PM (#16067964)
> These numbers have also been consistently going down over time.

That trend might reverse if vulnerabilities like these continue to surface.

Re:Reading privileged memory with a side-channel by alkonaut on Thursday January 04, 2018 @03:55AM (#16068882)
Right. It’s like designing for any other tiny group: color blind, blind, people who don’t read any of the 3 languages your site is already translated to, etc.

I’m not saying that shouldn’t be done, but business wise its probably usually best to instead add design changes for the latest smartphone screen.

The web isn’t a hypertext graph anymore, it’s a large JavaScript program with a thin html front now.

Re:Reading privileged memory with a side-channel by chrisseaton on Wednesday January 03, 2018 @08:33PM (#16067236)
I think you’re misunderstanding. The person you’re replying to wasn’t saying you couldn’t disable JavaScript. They are saying the websites they and many in the industry develop won’t work like that and haven’t since the turn of the century. That’s what they were claiming to be not wrong about, and they aren’t. Turning on NoScript shows the problem but doesn’t solve it.
Re:Reading privileged memory with a side-channel by jerrycruncher on Wednesday January 03, 2018 @11:34PM (#16068064)
"Turn of the century"? JS was used for little more than swapping images on mouseover and changing/"animating" title bar text back then. The "you will see absolutely nothing or a ream of {{blah}} text" without js enabled really only became prevalent in the last 5-or-so years. Even in the halcyon days of jQuery usage you could get around quite comfortably without js, as js was still being used to augment webpages rather than replace them entirely.
Re:Reading privileged memory with a side-channel by jeremyjh on Thursday January 04, 2018 @01:03AM (#16068377)
It wasn't common practice, but fully Javascript rendered applications were a thing as early as 2001. That was when my company developed the first one that I know of. It was a godawful ugly pig but it worked.

Most sites did nothing like that, but they did use Javascript and would break in various ways without it. At that time, there were a lot of people admonishing web developers to test their applications with Javascript disabled. Sort of like now.

ETA: I had to look it up - XHR was first available in IE 5 as an ActiveX control. The internet at large couldn't really expect it to be available but I believe that is where we first used it.

Initial release: March 18, 1999; 18 years ago

Re:Reading privileged memory with a side-channel by vanviegen on Thursday January 04, 2018 @03:08AM (#16068722)
Before XHR, there was an iframe trick that could be used to the same effect. We were abusing that to do streaming updates (stalling requests until the server had new data) on then likes of IE5 back in 2004. WebSocket eat your heart out! :-)
Re:Reading privileged memory with a side-channel by jerrycruncher on Thursday January 04, 2018 @02:22PM (#16073231)
I'm not denying that the technology was sort of there (especially/only if you were writing a corporate app that targeted one and only one browser, probably as a replacement for an in-house VB/WinForms app). My point, which you mostly reinforced, was that it was not at all common for a user opting not to enable javascript to see a completely broken public-facing site until relatively recently.
Re:Reading privileged memory with a side-channel by theclaw on Wednesday January 03, 2018 @08:53PM (#16067347)
That doesn't make the effort required of a developer to remove an existing JS dependency any easier, though, other than allowing them to see how the site breaks which can already be done using the F12 dev tools.

A lot of sites rely on JS to function even at a basic level these days and I think the parent was saying it's unlikely that that's going to change.

Re:Reading privileged memory with a side-channel by nostrademons on Wednesday January 03, 2018 @09:04PM (#16067402)
As a developer, it's even easier to test without Javascript: open Chrome Developer Tools, select Settings from the hamburger menu, and check "Disable Javascript".

As the other comments point out, though, the biggest problem is that this is economically irrational for most site owners. The figures on JS-disabled usage I had when I was still at Google (3+ years ago now) were at the lower end of TikiTDO's range. It generally doesn't make economic sense to spend developer time on an experience used by 0.1% of users, particularly if this requires compromises for the 99.9% of users who do have JS enabled.

Re:Reading privileged memory with a side-channel by confounded on Thursday January 04, 2018 @02:28AM (#16068629)
Culling all that JS can make things faster for everyone.

If you have a web app there’s no point, but if you’re displaying text and images and your site doesn’t work without JS, you’ve over-egged a solved problem.

(... While increasing perceived latency, especially for mobile users.)

Re:Reading privileged memory with a side-channel by keltor on Wednesday January 03, 2018 @10:58PM (#16067935)
I'd bet a certain percentage of THOSE were actually lynx/links/elinks users rather than no script users.
Re:Reading privileged memory with a side-channel by propogandist on Thursday January 04, 2018 @09:26AM (#16070487)
you are better off with uMatrix which gives the user significantly more control on what loads/executed: https://github.com/gorhill/uMatrix

(it's the more advanced version of uBlock, from the same dev)

Re:Reading privileged memory with a side-channel by yborg on Thursday January 04, 2018 @10:06AM (#16070783)
The old NoScript. The new WebExtension compatible version just blocks, it has no way to disable js.
Re:Reading privileged memory with a side-channel by Pyxl101 on Wednesday January 03, 2018 @09:02PM (#16067388)
I browse with NoScript and quite a lot of the web works just fine, in fact. I can selectively enable JavaScript for sites that need it, and that I trust.
Re:Reading privileged memory with a side-channel by CogitoCogito on Wednesday January 03, 2018 @10:28PM (#16067812)
Why was this downvoted? This is clearly true. I am in fact doing it right now. I am sitting in an airport and clicked around 20 different comment sections and articles from HN so that I could read them later. None of them gave any issues. The only js that I decided to allow was from HN so that I could expand/hide comments.

Does this mean that all websites work? Of course not. But this allows the user to choose which sites to allow to run js. I'm not going to pretend that this is an easy task for non-technical users, but we should be promoting these kinds of habits, not scoffing at them. We should educate as many users as possible that they can still (for now) control much of the web-based code executing on their machines.

Re:Reading privileged memory with a side-channel by pastage on Thursday January 04, 2018 @04:33AM (#16069037)
Well it's a severe case of confirmation bias. The people I know that uses NoScript like tools white list sites and third parties, that makes it seem like it works better than it really does. Further more they choose not to visit sites that work poorly. All the problems are visible as a new user, sure it's obviously possible to use NoScript but I need to white list too many sites to be able to say it actually works.
Re:Reading privileged memory with a side-channel by gspetr on Thursday January 04, 2018 @04:47AM (#16069082)
Some sites like NYT wouldn't even render text (!) for me by default with noscript on.

Then there was that time when I read on HN about Forbes loading 35 MB worth of crap (lots of JS too) when you first access it, sure enough it's completely broken with noscript too if you don't allow it.

Re:Reading privileged memory with a side-channel by thisacctforreal on Wednesday January 03, 2018 @08:01PM (#16067066)
Yes please!

Long live progressive enhancement and graceful degradation.

At least until we get a JS interpreter with proper permission controls and sandbox limits. Something closer to how Lua is embedded sounds nice.

Re:Reading privileged memory with a side-channel by voidmain on Wednesday January 03, 2018 @08:01PM (#16067064)
It seems like practical attacks rely on having a reasonably precise timer available. The spectre paper uses SharedArrayBuffer to synthesize a timer, which is a recent and obscure feature:

https://groups.google.com/a/chromium.org/forum/#!topic/blink...

https://groups.google.com/forum/#!topic/mozilla.dev.platform...

Chrome and Firefox's "intent to ship" posts both contain claims to the effect that there probably aren't any really serious timing channel attacks, which... seems to have been disproved. Why isn't SharedArrayBuffer already being disabled as a stopgap? I think users can turn it off in firefox, how about Chrome?

Re:Reading privileged memory with a side-channel by jncraton on Wednesday January 03, 2018 @09:49PM (#16067610)
SharedArrayBuffer will be disabled by default as a stopgap:

https://blog.mozilla.org/security/2018/01/03/mitigations-lan...

performance.now() accuracy is also being reduced.

Re:Reading privileged memory with a side-channel by kibwen on Wednesday January 03, 2018 @08:05PM (#16067093)
> I think users can turn it off in firefox, how about Chrome?

This month's stable Chrome release will be outright disabling SharedArrayBuffer until additional mitigations are enacted.

Re:Reading privileged memory with a side-channel by londons_explore on Wednesday January 03, 2018 @08:56PM (#16067358)
Which sucks for people who've built sites which rely on it.

It isn't exactly polyfillable.

Re:Reading privileged memory with a side-channel by erichurkman on Wednesday January 03, 2018 @10:12PM (#16067734)
That shouldn't be that many sites. It only hit Chrome stable in July 2017; Firefox in August 2017; and Edge November 2017.
Re:Reading privileged memory with a side-channel by olliej on Wednesday January 03, 2018 @08:06PM (#16067094)
I believe SAB is being disabled, and apparently precision of performance.now() as well? (based on other comments)
Re:Reading privileged memory with a side-channel by caf on Wednesday January 03, 2018 @08:32PM (#16067234)
about:config javascript.options.shared_memory in Firefox.
Re:Reading privileged memory with a side-channel by kiwijamo on Thursday January 04, 2018 @03:03AM (#16068709)
Turned off by default for me in 57.0.3/macOS. Is it usually on by default on other platforms?
Re:Reading privileged memory with a side-channel by scarygliders on Thursday January 04, 2018 @05:02AM (#16069144)
Just checked on Windows and it was on by default for me for Firefox 57.0.3
Re:Reading privileged memory with a side-channel by drdrey on Wednesday January 03, 2018 @07:53PM (#16067002)
Doesn't each tab run in a separate process?
Re:Reading privileged memory with a side-channel by theptip on Wednesday January 03, 2018 @08:14PM (#16067133)
That's true to first approximation in Chrome, but apparently not always.

This recent article contains a bit more detail on Site Isolation: https://arstechnica.com/gadgets/2017/12/chrome-63-offers-eve...

> Chrome's default model is, approximately, to use one process per tab. This more or less ensures that unrelated sites are kept in separate processes, but there are nuances to this set-up. Pages share a process if they are related through, for example, one opening another with JavaScript or iframes embedding (wherein one page is included as content within another page). Over the course of a single browsing session, one tab may be used to visit multiple different domains; they'll all potentially be opened within a single process. On top of this, if there are already too many Chrome processes running, Chrome will start opening new pages within existing processes, resulting in even unrelated pages sharing a process.

Which suggests there are a number of cases where multiple tabs could share a process.

Re:Reading privileged memory with a side-channel by zetafunction on Wednesday January 03, 2018 @08:32PM (#16067233)
Note that it's not just tabs sharing processes that's an issue: prior to the site isolation work, any iframe in the same page would always be in the same process as the main frame. With site isolation, it's possible to host cross-site [1] iframes in a separate process.

[1] Two pages are considered cross-site if they cannot use document.domain to become same origin. In practice, this means that the effective TLD + 1 component match.

Re:Reading privileged memory with a side-channel by kibwen on Wednesday January 03, 2018 @08:02PM (#16067074)
Chrome starts putting multiple tabs in the same process once certain resource thresholds are reached. There's an experimental "site isolation" option that you can toggle on to enforce this better, currently with some caveats: https://www.chromium.org/Home/chromium-security/site-isolati... .

Curious to know whether Firefox has anything similar in the pipe, since it uses a fixed number of content processes rather than a variable number of processes.

Re:Reading privileged memory with a side-channel by notriddle on Thursday January 04, 2018 @07:04PM (#16075306)
Re:Reading privileged memory with a side-channel by InclinedPlane on Wednesday January 03, 2018 @07:47PM (#16066963)
This is so incredibly bad. Spectre is basically unpatchable. We can do better than we are now with patches but it's all just turd polishing, essentially. A proper fix will require new CPU hardware. And as a kicker? Leaks are basically undetectable.
Re:Reading privileged memory with a side-channel by bonzini on Thursday January 04, 2018 @03:42AM (#16068840)
New CPU microcode is enough, though at a performance price. On pre-Zen AMD there is also a chicken bit to disable indirect branch prediction. (It feels good to be finally able to speak about this freely!!!)

I don't know for which processors Intel and AMD plan to release microcode updates.

Re:Reading privileged memory with a side-channel by contrarian_ on Thursday January 04, 2018 @07:24AM (#16069801)
> New CPU microcode is enough

What would that entail? Disabling speculation completely? Disabling memory accesses during speculation?

Re:Reading privileged memory with a side-channel by bonzini on Thursday January 04, 2018 @07:53AM (#16069950)
Disabling indirect branch prediction (and thus speculation after indirect branches) while in kernel mode, or flushing the indirect branch predictor on kernel mode entry. Both need OS support in addition to the microcode, but the change is less invasive than PTI.
Re:Reading privileged memory with a side-channel by contrarian_ on Thursday January 04, 2018 @07:57AM (#16069970)
That only fixes one variant of Spectre, and only for code running in kernel mode.

The "out of bounds" Spectre variant is still feasible.

Also: What about hyperthreads? It seems to be many people's assumption that the BTB is shared within a physical core.

Re:Reading privileged memory with a side-channel by bonzini on Thursday January 04, 2018 @08:56AM (#16070304)
The out of bounds variant is fixable in the OS, just add a fence instruction between the check and the load.

For code running in user mode, you flush the branch predictor on each context switch---again, new microcode + patched OS.

Hyperthreads are tricky. Those are not yet fixed by microcode AIUI, and in the future you may want a usermode program to say "I don't want indirect branch prediction because I am afraid of what the other hyperthread might do to me". That would require some new system call (like a new prctl on Linux) or something like that.

Re:Reading privileged memory with a side-channel by wilun on Friday January 05, 2018 @10:32PM (#16083688)
Great. Now we just have to think of new attacks using the same general idea to slow down all computers by yet another 10% :p
Re:Reading privileged memory with a side-channel by PeterisP on Friday January 05, 2018 @11:16AM (#16079473)
Wouldn't that be a serious performance hit?
Re:Reading privileged memory with a side-channel by bonzini on Friday January 05, 2018 @03:03PM (#16081197)
It is. Same ballpark as PTI on microbenchmarks, but a little better on macrobenchmarks.
Re:Reading privileged memory with a side-channel by minxomat on Wednesday January 03, 2018 @06:29PM (#16066505)
Getting flashbacks of brainsmoke's JS PoC: https://youtu.be/ewe3-mUku94?t=1766

Edit: Also, PoCs for unpatched Windows by pwnallthethings: https://github.com/turbo/KPTI-PoC-Collection

Re:Reading privileged memory with a side-channel by FLUX-YOU on Wednesday January 03, 2018 @06:57PM (#16066683)
I do also wonder if some speculative prediction / branching stuff can be controlled through undocumented CPU instructions: https://www.youtube.com/watch?v=KrksBdWcZgQ
Re:Reading privileged memory with a side-channel by waz0wski on Wednesday January 03, 2018 @06:46PM (#16066626)
Re:Reading privileged memory with a side-channel by rsync on Thursday January 04, 2018 @11:14AM (#16071457)
"As a proof-of-concept, JavaScript code was written that, when run in the Google Chrome browser, allows JavaScript to read private memory from the process in which it runs"

I am not sure what "the process in which it runs" means here ... do they mean private memory from within chrome ? Or within the child process spawned from chrome, or within the spawned JS sandbox or ... what ?

Practically speaking, I worry about a browser pageview that can read memory from my terminal process. Or from my 'screen' or 'sshd' process.

I think that is not a risk here, yes ?

Re:Reading privileged memory with a side-channel by marzell on Thursday January 04, 2018 @08:04AM (#16070021)
Will it be nontrivial to detect or at least identify these types of exploits as they occur in the wild? Can protection software see these when they happen, assuming a best case scenario where the attack is carried out but doesn't specifically use these methods to hide or disable detection? Is there a general sense yet of whether this exploit is already being leveraged?
Re:Reading privileged memory with a side-channel by pogba101 on Wednesday January 03, 2018 @07:37PM (#16066913)
Thanks for the links. As an undergrad with limited knowledge of this subject, I would love to see these annotated on Fermat's Library (https://fermatslibrary.com)
Re:Reading privileged memory with a side-channel by guftagu on Saturday January 06, 2018 @12:47AM (#16084046)
Guys, can't we just detect a program doing spectre-like behavior and just kill it instead of having every other application suffer a performance hit by the proposed changes? Antivirus software already does similar stuff