Score:0

Alternative to CBC mode encryption?

in flag

Given that CBC mode encryption is vulnerable to padding oracle attacks, what is the next best alternative ?

a) Include a hash check in the API scheme, validate the hash and then proceed with CBC. If hash check fails then return error indicating same. Eg: Include HMACSHA256(AES256(plaintext)) checksum that is required to be validated as part of message.

b) Implement a custom CBC mode that include a hmac/equivalent checksum at the end of each encryption block (on the lines of padding). Eg: Create own scheme on the lines of - "AES/CBC/PKCS5Padding/HMACSHA256". Are there any plans drafted by NIST / W3C to incorporate such a scheme?

c) Switch to GCM mode encryption. How does it compare to CBC in terms of cryptographic strength?

kelalaka avatar
in flag
The guide to GCM is here; [What are the rules for using AES-GCM correctly?](https://crypto.stackexchange.com/q/84357/18298)
Score:3
in flag

GCM is a very good alternative, it provides built in message authentication, so encrypted messages can not be manipulated by an attacker.

The encryption itself is based on CTR mode which is well understood and is secure when used correctly.

Main thing to notice is the severity of nonce reuse, reusing a counter value with the same key is catastrophic, be sure you use GCM correctly and you will be fine.

SAI Peregrinus avatar
si flag
GCM-SIV (or just SIV) mode doesn't lose security catastrophicly when a nonce is re-used with the same key, but it's 2-pass. OCB is now patent-free and faster than GCM.
in flag
Believe had come across the 'nonce' requirement once before (although could not recollect while framing the question) and consequently hesitant to adopt GCM. Having NIST come up with a mode that involves CBC with checksum still seems the better option. But guess until then we'll have to trust the GCM implementations in libraries.
Meir Maor avatar
in flag
After multiple padding attacks, people are simply mooving away from CBC, though we have some CBC based implemntaitions we don't currently know how to attack effectively moving away from where we burned multiple times seems safer.
in flag
Guess moving away from CBC is natural. But adopting GCM with the terms-and-conditions involves appears just as risky (in the long-run). Guarding CBC with an integrity check (eg: application-layer / extended-cbc-scheme-with-integrity-check) seems to be more straightforward than have the possibility of some reused nonce based vulnerability show up in some library every now and then. Source code may not always be available for scrutiny in case of GCM or it could be overlooked.
in flag
Given the complications, I guess we could consider `CBC`as a known enemy and `GCM` as an unknown friend.
Meir Maor avatar
in flag
TLS1.3 ditched CBC, and I think it was a wise choice.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.