アプリ置き場

アプリ置き場

http://www.moreread.net/

Meltdown、Spectre、そしてJavaScript

CPUのOut Of Orderやら投機実行における脆弱性というところの仕組み(キャッシュに展開される)はなんとなくわかったのだけど、それはどうやって読み出すのだろう?JavaScriptからも可能ってのはどういうことなんだろう?
CPUのキャッシュに放り込むための投機実行のコードをJSで書けるのはわかるんだけども、

CPUキャッシュから情報を抜き出すための、FLUSH+RELOADなる方法が使われているようだ。サイドチャネルアタック(いろんな手段で観察して情報を推測したりする攻撃)らしいが。
読み取れないはずの領域のデータを添え字にしてメモリアクセスすると、
そこがキャッシュされるため、アクセス時間を正確にはかれば、データ内容が復元できる…?
 
JavaScript does not provide access to the rdtscp in-
struction, and Chrome intentionally degrades the accu-
racy of its high-resolution timer to dissuade timing at-
tacks using performance.now()[1].
However, the Web Workers feature of HTML5 makes it simple to cre-
ate a separate thread that repeatedly decrements a value
in a shared memory location [18, 32]. This approach
yielded a high-resolution timer that provided sufficient resolution
 
Javascriptからはperformance.now()といった高精度タイマーや、Workerを使うと再現でけると。
 
Jann Horn of Google Project Zero Security reported that speculative execution performed by modern CPUs could leak information through a timing side-channel attack. Microsoft Vulnerability Research extended this attack to browser JavaScript engines and demonstrated that code on a malicious web page could read data from other web sites (violating the same-origin policy) or private data from the browser itself.
Since this new class of attacks involves measuring precise time intervals, as a partial, short-term, mitigation we are disabling or reducing the precision of several time sources in Firefox. The precision of performance.now() has been reduced from 5μs to 20μs, and the SharedArrayBuffer feature has been disabled because it can be used to construct a high-resolution timer.
Mozillaはタイマーの制度を下げたのか。
SharedArrayBufferというのはWorker間でメモリを共有する仕組みで、高精度タイマーを作れちゃうのでこれをOffる対応も入ってると。