5 ms·
Isn't one possible solution to this problem just not to allow untrusted programs access to clocks and timer features?
by Ono-Sendai 8y ago
Isn't one possible solution to this problem just not to allow untrusted programs access to clocks and timer features?
- ufo 8y agoYou can do these things as a mitigation but it doesn't fully solve the problem because untrusted programs can try to get timing info from other sources. For example, incrementing a counter inside an infinite while loop can give you a good estimate of time, measured in cpu clock cycles .
- ynniv 8y agoThat might not be possible in a single threaded environment like JavaScript.
- Klathmon 8y agoIf that single-threaded process can talk to another process or system, can't it gather or exfiltrate timing information through that channel?
- stefan_ 8y agoIt was until they added background workers. There is a known simple mitigation. Don't JIT random JavaScript, back to interpretation. Of course that means there is no use for V8, which is why it's not in this paper.
- ufo 8y agoInterpreters aren't enough either. If the interpreter contains pieces of code that are vulnerable to spectre then it can still be exploited.
- Klathmon 8y agoV8 has a JIT-free mode now, and it's still pretty damn fast in real world situations. It looks like in synthetic benchmarks they saw up to 80% decrease in performance, but in real-world applications they saw as little as a 6% decrease. https://v8.dev/blog/jitless https://v8.dev/blog/jitless But even an interpreted language can still be vulnerable to Spectre attacks.
- phire 8y agoAn attacker could probably use a remote server and mesure the timing differences between http packets. It doesn't matter if your timing source is high noise with lots of jitter, the attacker can repeat the mesurements over and over again and filter everything out. Even if the attacker can only pull out a few bytes per second, that might be enough to leak something critical like and encryption key or an ASLR offset.
- ufo 8y agoThe original article talks at length about the various timer mitigations the v8 team created, and why they still think they are not sufficient.
- Ono-Sendai 8y agoOk yeah makes sense. What about a pure functional language, in which a program computes a result that is a function of the input only. In this case the only timing information usable for side-channel info leakage would be in the input to the program. I guess the problems in this case become twofold: * How can we determine we are not leaking any such info in the input to the program? and * Is a pure, functional language sufficient to do the stuff we want, or are they too limited, e.g. for use as a browser scripting language.
- ufo 8y agoPurity is not enough to prevent timing attacks. A famous example is string equality. The running time of a typical implementation is proportional to the length of the largest common prefix between the two strings. To prevent this information leak the implementation must be written to always iterate until the end. But spectre is even worse than that as it attacks at the hardware level. If the CPU does any sort of speculative optimization, through things like caches or branch prediction buffers, then it likely can be the target of a spectre attack. You can try to add spectre mitigations to your language's compiler but, as the article discusses, this approach is an uphill battle.
- bluGill 8y agoPurity is enough, but purity is not useful. If java script was entirely pure it couldn't do any IO. You couldn't do anything with the string compare result because that requires IO to know what it is done, and that IO is not allowed. Pure algorithms are a useful thing in programming. However pure algorithms are not useful on their own, you always need something impure to get the output out.
- mhandley 8y agoThe article discusses why this is insufficient.
- deleted 8y ago[deleted]
- bartread 8y agoThere are going to be use cases that would break, for example with the Web Audio APIs, because it would make it impossible to precisely time or trigger events.
- amenghra 8y agoYou should read “Fantastic Timers and Where to Find Them: High-Resolution Microarchitectural Attacks in JavaScript” (https://gruss.cc/files/fantastictimers.pdf$ https://gruss.cc/files/fantastictimers.pdf$
- Ono-Sendai 8y agoYeah some pretty interesting stuff there. The counting thread achieves 2ns resolution :)