{"action":"created","issue":{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/1","labels_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/1/comments","events_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/1/events","html_url":"https://github.com/lars-t-hansen/ecmascript_sharedmem/issues/1","id":97097853,"number":1,"title":"Security consideration: Multi-threading helps cache-based side channel attacks","user":{"login":"mseaborn","id":85055,"avatar_url":"https://avatars.githubusercontent.com/u/85055?v=3","gravatar_id":"","url":"https://api.github.com/users/mseaborn","html_url":"https://github.com/mseaborn","followers_url":"https://api.github.com/users/mseaborn/followers","following_url":"https://api.github.com/users/mseaborn/following{/other_user}","gists_url":"https://api.github.com/users/mseaborn/gists{/gist_id}","starred_url":"https://api.github.com/users/mseaborn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mseaborn/subscriptions","organizations_url":"https://api.github.com/users/mseaborn/orgs","repos_url":"https://api.github.com/users/mseaborn/repos","events_url":"https://api.github.com/users/mseaborn/events{/privacy}","received_events_url":"https://api.github.com/users/mseaborn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/milestones/1","html_url":"https://github.com/lars-t-hansen/ecmascript_sharedmem/milestones/Stage%202","labels_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/milestones/1/labels","id":1323003,"number":1,"title":"Stage 2","description":"Issue that has to be resolved before the proposal can go to Stage 2.","creator":{"login":"lars-t-hansen","id":4823190,"avatar_url":"https://avatars.githubusercontent.com/u/4823190?v=3","gravatar_id":"","url":"https://api.github.com/users/lars-t-hansen","html_url":"https://github.com/lars-t-hansen","followers_url":"https://api.github.com/users/lars-t-hansen/followers","following_url":"https://api.github.com/users/lars-t-hansen/following{/other_user}","gists_url":"https://api.github.com/users/lars-t-hansen/gists{/gist_id}","starred_url":"https://api.github.com/users/lars-t-hansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lars-t-hansen/subscriptions","organizations_url":"https://api.github.com/users/lars-t-hansen/orgs","repos_url":"https://api.github.com/users/lars-t-hansen/repos","events_url":"https://api.github.com/users/lars-t-hansen/events{/privacy}","received_events_url":"https://api.github.com/users/lars-t-hansen/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2015-09-24T22:39:01Z","updated_at":"2015-09-24T22:41:11Z","due_on":null,"closed_at":null},"comments":15,"created_at":"2015-07-24T17:30:27Z","updated_at":"2015-10-06T00:51:02Z","closed_at":null,"body":"Shared memory allows the construction of a high-resolution timer (nanosecond resolution), which enables cache-based side channel attacks, such as those described in the paper \"The Spy in the Sandbox -- Practical Cache Attacks in Javascript\" (http://arxiv.org/abs/1502.07373).\r\n\r\nFor example, key press handling code produces a detectable signature of accesses to L3 cache sets.  An attacker can use timings to deduce when the user is pressing keys.\r\n\r\nShould the SharedArrayBuffer spec discuss this as a security consideration?  This might help us come up with mitigations.\r\n\r\nFor comparison, browsers have tried to mitigate cache side channels by reducing the resolution of performance.now().  (e.g. See https://crbug.com/506723 for Chrome.)  With multi-threading, though, it's easy to build your own high-res timer by creating a thread that increments a memory location in a tight loop.\r\n\r\nI'm not terribly optimistic about mitigating this.  Finding a solution is a research problem and may well be infeasible.  I doubt this should block Shared Array Buffers, but if we're adding multi-threading to the Web platform we should at least be aware of what we're letting ourselves in for.\r\n\r\nSee also the Chromium issue tracking this: https://crbug.com/508166\r\n\r\n[Aside: is there a preferred forum for discussing the SharedArrayBuffer spec?  Brad Nelson and Ben Smith -- who are working on Chromium's support for SharedArrayBuffers -- told me there isn't one yet and recommended I file an issue in this issue tracker.]\r\n"},"comment":{"url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/comments/145711884","html_url":"https://github.com/lars-t-hansen/ecmascript_sharedmem/issues/1#issuecomment-145711884","issue_url":"https://api.github.com/repos/lars-t-hansen/ecmascript_sharedmem/issues/1","id":145711884,"user":{"login":"jfbastien","id":298127,"avatar_url":"https://avatars.githubusercontent.com/u/298127?v=3","gravatar_id":"","url":"https://api.github.com/users/jfbastien","html_url":"https://github.com/jfbastien","followers_url":"https://api.github.com/users/jfbastien/followers","following_url":"https://api.github.com/users/jfbastien/following{/other_user}","gists_url":"https://api.github.com/users/jfbastien/gists{/gist_id}","starred_url":"https://api.github.com/users/jfbastien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfbastien/subscriptions","organizations_url":"https://api.github.com/users/jfbastien/orgs","repos_url":"https://api.github.com/users/jfbastien/repos","events_url":"https://api.github.com/users/jfbastien/events{/privacy}","received_events_url":"https://api.github.com/users/jfbastien/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T00:51:02Z","updated_at":"2015-10-06T00:51:02Z","body":"This type of infoleak has existed for a while in Chrome using [PNaCl's atomics](https://developer.chrome.com/native-client/reference/pnacl-c-cpp-language-support#memory-model-and-atomics), is available in all browsers through [Flash's shareable byte array](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/ByteArray.html#shareable), and is possible in [JavaScript on x86 using denormals](https://cseweb.ucsd.edu/~dkohlbre/papers/subnormal.pdf).\r\n\r\nThese are just a few examples: it seems like very high precision timing information leaks are an inevitability, and SAB are adding a redundant attack surface.\r\n\r\nIt would be worth exploring the following in separate issues:\r\n* How can one write proper timing-independent code (e.g. to avoid leaking keys)?\r\n* How does SAB affect the web API surface area? Most APIs weren't designed to be called from multiple threads, and have led to exploits in the past e.g. [pwn2own 2015](https://code.google.com/p/chromium/issues/detail?id=468936)."}}