News for hackers. Stuff that matters.
Re:1Password GPU brute-force with 3M hash/s by StavrosK on Tuesday April 16, 2013 @08:11PM (#5561752)
I don't see why you say that the problem is that they run it twice. As I understand it, the problem is that they use AES with an 128-bit key, and they use it in CBC mode, which gets easily defeated once you know the last plaintext.

As I can see, they had various courses of action (don't take this to mean that they were remiss in securing their product, as they used best practices everywhere):

* Use AES-256, maybe deriving the key from a first run of the KDF and the IV from a second one, although that might also make for an attack.

* Use CTR mode. Unless I'm mistaken, the attacker would then need to guess both the key and the nonce to verify the block, which is significantly higher complexity.

* Re-encrypt the last block with the IV. This way, the attacker would have to decrypt with the other 128-bit key, and would need to know both to decrypt the last block.

* Pad the beginning, rather than the end. Or, since the string is of known length, just make it a multiple of the block size, and use no padding.

I'm really a crypto novice, though, so I might be completely mistaken. That said, it's a bit too bad that they didn't spend a bit of time thinking how they would crack their own product, they might have come up with this attack and mitigated it.

At any rate, running the KDF twice isn't a problem, unless you mean that it wastes CPU cycles for no good reason. In that case, I agree.

Re:1Password GPU brute-force with 3M hash/s by tptacek on Tuesday April 16, 2013 @08:20PM (#5561785)
You're not mistaken in that there are constructions they could have used that would tie both the first and the second PBKDF2 output to the whole decryption. Their construction doesn't, and that appears to have been a mistake.

But it's not a meaningful mistake, for two reasons: (1) they were being naive about how they used PBKDF2 to begin with (again: don't call it a second time to generate a key or a nonce) and the attack on their encrypted blobs still requires a brute force attack on the first output, and (2) we're discussing a minimal improvement on the complexity of an attack on their system, but there are much bigger improvements available to them if they move off PBKDF2.

But, really: deriving keys from PBKDF2 is just fine. If they had just used PBKDF2 (once!) to generate an AES key, and then used /dev/random to generate an IV, nobody would be talking about them right now.

(For what it's worth, a CTR nonce only gives you 64 more bits to play with).

Re:1Password GPU brute-force with 3M hash/s by StavrosK on Tuesday April 16, 2013 @08:34PM (#5561854)
I definitely agree with you on all your mentioned points, but I'm unclear on a few things:

* What do you mean that it requires a brute force attack on the first output? As I understand it, the attacker doesn't need to match all 256 bits of the derived key (only the first 128 bits), so the complexity is reduced by a lot. If those match, you can just run the KDF "properly" on the passphrase you guessed and get the rest of the bits, i.e. the IV. It thus weakens PBKDF2 to only need 2002 rounds of SHA, rather than 8000, and still allows you to decrypt the whole stream.

* If they used a random IV, they'd have to include it in the stream, which wouldn't really do anything more for security. The IV doesn't matter at all now either, but at least now it's secret. This attack doesn't use the key space of AES or the IV, though, so it's a bit moot.

* The CTR nonce would prevent the attacker from taking the 128-bit "shortcut", as they'd need all 256 bits of the derived key to decrypt the last block, which is the improvement I'm referring to.

Please correct me if I'm mistaken, I find crypto very interesting and would like to know where I'm wrong.

Re:1Password GPU brute-force with 3M hash/s by Camillo on Wednesday April 17, 2013 @12:16AM (#5562657)
IVs are not really meant to be secret, IIRC. They're just meant to be different each time, to avoid getting the same cypher text if you have to encrypt another plaintext that begins with the same block.
Re:1Password GPU brute-force with 3M hash/s by tptacek on Wednesday April 17, 2013 @12:26PM (#5565348)
To clarify, not that this should ever matter for you because you should never work with these primitives directly, but a CBC IV needs not only to be unique but also unpredictable (which is a different property than "secret", of course).
Re:1Password GPU brute-force with 3M hash/s by Camillo on Wednesday April 17, 2013 @07:47PM (#5568108)
This would be used in a chosen plaintext attack, right? If you saw a ciphertext C1 with IV1, and you were able to choose the following Pj and predict the corresponding IVj, then you could verify whether the plaintext of C1 was P1~ by choosing Pj = P1~ XOR IV1 XOR IVj, so that Cj = C1 iff Pj = P1~. This would allow you to test likely values of P1~ from a dictionary.
Re:1Password GPU brute-force with 3M hash/s by StavrosK on Wednesday April 17, 2013 @06:05AM (#5563601)
Indeed, that is the case.