4 ms·
Pretty neat approach to adding an additional layer of security... I didn't finish reading the paper but did look at this component example: E = (function()
by taf2 13y ago
Pretty neat approach to adding an additional layer of security... I didn't finish reading the paper but did look at this component example:
E = (function() {
var F = function(x) {
var secret = 42, key = 0xC0C0ACAFE;
return x===key ? secret :0
};
return function G_F(x) { return F(x>>>0) }
})();
The neat thing about this is that at runtime you can't get to the secret. I initially thought you might be able to toString the function but that won't work because it will only show you the algorithm used e.g.
function G_F(x) { return F(x>>>0) }
Still, I was thinking if you could devise a plan to remotely fetch the source then you could, I believe defeat all of this extra security... unless of course the server can secure things such that the key is unique to each request...
- fooyc 13y agoIs there a chance this could be vulnerable to timing attacks ? Is comparing two integers fixed time ? It may be pure hazard, but in the following two calls, E(0x000000FE); E(0xC0000000); The second one is significantly slower: http://jsperf.com/qsmflkjtest http://jsperf.com/qsmflkjtest
- russellsprouts 13y agoI get the same thing. On my machine it's 80% slower. One solution is to use a string comparison. The high number is only 7% slower in that case. http://jsperf.com/qsmflkjtest/2 http://jsperf.com/qsmflkjtest/2
- tlrobinson 13y agoHow do you defend against side channels? A: We only focus on semantic language safety, and if you use the translation to ProVerif, the correctness of the protocol implementation. There are many side channels available to a same-origin attacker - the most obvious ones being time and memory. In SJCL, we sometimes try to mitigate those channels - for instance, in CCM tag validation. However, we do not have any formal proof of robustness against any side-channel attacker - furthermore, user-written DJS code must also take into account this risk. For instance, use the AES.ctEq function for constant time string comparison.
- columbo 13y ago<script id="test"> E = (function() { var F = function(x) { var secret = 42, key = 0xC0C0ACAFE; return x===key ? secret :0 }; return function G_F(x) { console.log(document.getElementById("test").innerHTML.split("secret")[1].substr(3,2)); return F(x>>>0); } })(); E(); </script> The above is very hacked together... does this break the security? Or am I misreading this?
- tlrobinson 13y agoI'm not sure, but I think if it's loaded from an external file there's no way to get at the text of script.
- fooyc 13y agoUsually the script would be remote (script src="..."), and the same origin policy would prevent you from getting its source in a similar way.
- columbo 13y agoAh! Ok that makes more sense then
- marcopolo 13y agoThe problem lies when you have the function accessible in the global scope. Example: A = E; E = function(x){ window.secret=A(x); return window.secret }; As you can just change how the function works.