3 ms·
First, this is a great article showing the bias in Cryptocat's very awkward PRNG code. However, the off-by-one bias was actually the least of the problems with
by zaroth 13y ago
First, this is a great article showing the bias in Cryptocat's very awkward PRNG code.
However, the off-by-one bias was actually the least of the problems with Cryptocat's random numbers...
From reading Steve's write-up, the problem was that their keys were ridiculous undersized, because they called their own function wrong:
May 7, 2012 (switched from DH to ECC):
myPrivateKey = Cryptocat.randomString(32, 0, 0, 1);
April 19, 2013:
rand = Cryptocat.randomString(32, 0, 0, 1);
myPrivateKey = BigInt.str2bigInt(rand, 10);
June 3, 2013:
rand = Cryptocat.randomString(64, 0, 0, 1, 0);
myPrivateKey = BigInt.str2bigInt(rand, 16);
> The bug that lasted 347 days was the confusion between a string and an array of integers. This made the ECC private keys ridiculously small because they passed a string of decimal digits into a function expecting an array of 17, 15 bit integers. Each character was considered an element in the array. So each of those "15 bit integers" were only the values 0 to 9 (3.32 bits). Also the least significant 3 bits are zeroed giving you a key space of 2*10^16 (2^54.15). -- http://tobtu.com/decryptocat.php http://tobtu.com/decryptocat.php
See for yourself here: https://github.com/cryptocat/cryptocat/commit/a17bb1599463e0c079137d8200eb32002ac1afc7#src-core-js-lib-multiparty-js-P4 https://github.com/cryptocat/cryptocat/commit/a17bb1599463e0...
Even now looking at this code, for me it just doesn't pass the 'WTFs per minute' test... It still looks fucking wrong to me... Cryptocat.randomString(64, 0, 0, 1, 0) returns a 64 character string of 0-9, why are they calling str2bigInt with a hex radix? Did they add the last '0' in the wrong place? Or maybe I'm looking at the wrong check in...
EDIT: Ok, it WAS still wrong as of June 4th... It wasn't until July 4th until it finally became:
var rand = Cryptocat.randomString(64, 0, 0, 0, 1)
See: https://github.com/cryptocat/cryptocat/commit/8fb7f4b8e59c76c78c06bd16f87d3e5fa9defc7a#L1L91 https://github.com/cryptocat/cryptocat/commit/8fb7f4b8e59c76...
EDIT EDIT: So just to be clear... v2.1.11 which was supposed to fix this problem has this 'incorrect radix' bug in it? Please tell me I'm wrong, or do we need another CVE and another release?
- marshray 13y agoMaddening isn't it?
- tptacek 13y agoI am totally, completely in the dark as to which coding errors (there have been several in the past few months) attach to which CVEs and which versions, and about when these vulnerabilities were reported to the project and when they were subsequently disclosed. I can't be the only one confused, and I do wonder whether that confusion is strategic. Pointing this out would be be gratuitous, except that Cryptocat's project leader has very high standards when it comes to the disclosure behavior of that project's competitors: https://github.com/SilentCircle/silent-phone-base/issues/5 https://github.com/SilentCircle/silent-phone-base/issues/5 (Cryptocat is "kaepora" in that thread; the context there is that Mark Dowd had reviewed ZRTPCPP, an open source implementation of the ZRTP protocol that Silent Circle funds and relies on, and found several memory corruption vulnerabilities. Mark had gone public with those vulnerabilities quickly as a result of a miscommunication with the Silent Circle team, but then redacted his disclosure and agreed to embargo the findings while Silent Circle coordinated fixes with all of the Silent Circle competitors that relied on that library; what you see in that thread is, apparently, the lead developer of Cryptocat, which doesn't use ZRTPCPP, repeatedly criticizing Silent Circle's handling of the incident.) The project should meet the standards that it has loudly set for others, and I don't think it has. I'd be happy to be corrected on this.
- oinksoft 13y agoAnyone saying, "oh, this is just the little guy trying so hard, take it easy on him" really ought to read the thread you linked. The author of CryptoCat's demeanor is surprisingly aggressive in his comments.
- DanBC 13y ago[edited to keep this thread constructive]
- tptacek 13y agoMy concern is substantive: In the process of handling an embargoed disclosure, Silent Circle groomed (perhaps aggressively) a Github pull request thread. Handling a coordinated disclosure on a Github pull request is tricky under the best of circumstances, but the Silent Circle team was dealing with an unplanned partial disclosure and was, with Dowd's cooperation, trying to get the genie back into the bottle long enough for (from what I can tell) their competitors to get patched. This was, as is evident from the thread, a problem for Cryptocat's uninvolved, un-implicated lead developer. Meanwhile: I cannot immediately tell from the record which of the independently discovered vulnerabilities in Cryptocat correspond to which CVEs or which advisories and which severity descriptions. The problem isn't one of demeanor; it's that I can't tell what's going on with this project. Does this sound fiddly? Let's make it more concrete: did an exploitable vulnerability get reported to the Cryptocat project, mitigated in a public Github commit, and sit there for months without any acknowledgement from the project? Cryptocat's project leader is an HN commenter, and if this confusion is my own doing --- totally possible --- I'd be happy for some clarification; not about Silent Circle, but on how someone would get a record of what vulnerabilities were disclosed in Cryptocat, when, and what the timeline was for each from discovery to public disclosure. It's plausible that there's a clear record somewhere and I just missed it.