5 ms·
marcan tweeted that the JavaScript verification mentioned in the article is completely broken: https://twitter.com/marcan42 https://twitter.com/marcan42 I thou
by comex 14y ago
marcan tweeted that the JavaScript verification mentioned in the article is completely broken: https://twitter.com/marcan42 https://twitter.com/marcan42
I thought MEGA's sales pitch was pretty good. And then I saw their Javascript hashing code. Oh, the hilarity.
They're using a broken variant of CBC-MAC to authenticate their Javascript. Except CBC-MAC isn't a hash. The key is public, so it's a joke.
CBC-MAC only works as a MAC, not as a hash function. You can replace all of their JS, do a trivial subtract, and make it "hash" the same.
They also make other mistakes, like not authenticating the length and just concatenating the various files, so other attacks are possible.
- tptacek 14y agoCBC-MAC is also tricky to get right even if you know what it is. It's a very weird choice. But I wouldn't want to dignify the notion that one piece of Javascript can "validate" other Javascript "files" anyways; the whole notion of Javascript validation is dubious, because what you need to validate is the whole JS runtime, not just individual files. Browsers don't provide tools to do that.
- comex 14y agoHuh? It's perfectly valid in theory for one piece of trusted JavaScript to download another from an insecure source and validate it before evalling it - the attack scenario is not the browser being compromised, it's the source delivering malicious code. (Whether this is really a useful thing to do compared to serving all the JS in one place is another question.)
- tptacek 14y agoReal systems that try to implement this scheme generally wind up implementing the misconception that everything that contributes to the JS runtime comes from discrete Javascript files.
- dmix 14y agoDo you have a source? I tried googling javascript runtime (primarily v8) exploitation and haven't been able to find any examples of this ever happening. Edit: I'm not saying its not plausible, but wouldn't it require root/user access? What benefit would it provide over other type of attacks with that level of access? Just because there's no browser tools to check for it?
- marshray 14y agoThis looks like a good read: http://www.adambarth.com/papers/2009/barth-weinberger-song.pdf http://www.adambarth.com/papers/2009/barth-weinberger-song.p... Cross-Origin JavaScript Capability Leaks: Detection, Exploitation, and Defense Although these vulnerabilities are imple- mentation errors in WebKit, the presence of the bugs illustrates the fragility of the general architec- ture. (Other browsers have historically had similar vulnerabilities [17, 18, 19].) We detail these vulner- abilities and construct proof-of-concept exploits to demonstrate how an attacker can leverage a leaked JavaScript pointer to inject a malicious script into an honest security origin.
- dmix 14y agoThanks I'll check it out, but I thought that tptacek was talking about manipulation of JS runtimes instead of exploitations of XSS bugs in webkit.
- marshray 14y agoThat's the thing about Javascript. The tiniest little XSS or subtle origin violation results in the entire browser app being 100% 'pwned' (to use the technical term). The pwnage can even persist into the future for that user when you consider the ability of browsers to cache content and HTML5's data store.
- sneak 14y agoAre you implying that they overlook other js contexts like onload tag attributes and such? I get what you're driving at, but can't infer what you're conspicuously not explaining in full.
- jy-p 14y agoagreed, doing aes-256-cbc with a MAC is not exactly the first thing that comes to mind when it's a clear case for using a pbkdf. you can probably drive a nail with a screwdriver handle if you try hard enough.
- tptacek 14y agoNot following how PBKDFx and CBC-MAC are comparable primitives.
- mkjones 14y agoI think he's confusing the key-derivation function this article talks about for your "master key" with the MAC-in-JS this particular thread is discussing.
- jy-p 14y agoi wasn't suggesting that they were comparable, rather that in mega's system a pbkdf makes more sense where they chose to use cbc-mac. without going back and looking at the mega js, i recall it working as follows password --> CBC-MAC --> master key --> decrypt RSA private key with derived master key if you're deriving a key from a password, seems to make sense to use a password-based key derivation function.
- sp332 14y agoThere's already a proof-of-concept here: https://news.ycombinator.com/item?id=5101318 https://news.ycombinator.com/item?id=5101318