by CiPHPerCoder · 8y ago · 0 comments
The only cryptographic weakness Cure53 identified was that a malicious API server could exfiltrate encryption keys.
Cure53 deemed it a hard problem to solve. I wrote a proposed strategy for mitigating it: https://github.com/bitwarden/core/issues/392
Regarding Bitwarden's cryptographic security, a cursory read through their code yields the following:
* It's using RSA-OAEP to encrypt AES keys (EDIT: formerly "some data") https://github.com/bitwarden/jslib/blob/b4fad203b94da53d3369...
* It's using AES-256-CBC https://github.com/bitwarden/jslib/blob/b4fad203b94da53d3369... + https://github.com/bitwarden/jslib/blob/b4fad203b94da53d3369... + https://github.com/bitwarden/jslib/blob/2045e7047a66599b2c8a...
It doesn't appear to be authenticating the AES-CBC-encrypted ciphertexts in all cases, which makes me suspect padding oracles are still in-scope.
https://robertheaton.com/2013/07/29/padding-oracle-attack/
RSA-OAEP is the better RSA mode. (You don't want PKCS1v1.5)
In closing: As long as you're not for some reason storing unauthenticated AES-CBC ciphertexts in the server, the encryption is really boring.
(Boring is good for encryption.)
Recommendation: If there is no HMAC tag with a ciphertext, immediately throw an exception. It makes it clearer that a decryption failure occurred (thus avoiding false positives).
[1]: https://github.com/bitwarden/jslib/blob/master/src/services/...
The AES-CBC thing is tied to the key, right? So the downgrade attack isn't possible.
I don't know the details of the security proof for RSA-PKCS though, just that there is one.
https://paragonie.com/blog/2018/04/protecting-rsa-based-prot...
Actually data? You'd usually expect RSA to be protecting a symmetric key in this sort of setup - is that what the data is, or something else?
Usually when I see RSA-OAEP in a casual stroll through something's code, I stop there and move onto looking for other issues.
Reason: Very few users of RSA encryption bother to use a secure padding mode. If they're doing that much, the chances of doing something very stupid (a.k.a. "RSA-ECB") is low enough to discount for the purposes of message board discussions.
(Obviously, if I'm being paid to review something, I spend a lot more time on it.)
When I wrote my post above, all I cared about was the modes being used. That's why I vaguely said "some data".
A further analysis (i.e. where rsaEncrypt() is invoked) yields: They're only using RSA for encrypting AES keys, which is a sane design.
Hopefully my lazy word choice didn't cause you (or anyone else) any undue alarm.
Thanks for replying to put my mind at ease on this.