Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Padding Oracle vulnerability #5

Open
mcgnus opened this issue Nov 14, 2019 · 0 comments
Open

Possible Padding Oracle vulnerability #5

mcgnus opened this issue Nov 14, 2019 · 0 comments

Comments

@mcgnus
Copy link

mcgnus commented Nov 14, 2019

The unpadding function treats wrong and correct padding differently. Because the CBC mode is malleable an attacker can change the decrypted plaintext when modifying the IV (or the block before the targeted block). The order of blocks can be changed, too.

If an attacker is able to distinguish these two cases (e.g. via timing channels or length of returned array) of valid and invalid padding it is possible to decrypt ciphertexts without knowing the key.

For more information see TLS-Padding-Oracles from RUB or this question on crypto.stackexchange

There are options to make the CBC mode more secure against this kind of POA, but to mitigate this an authenticated encryption scheme should be used.

radvpn/crypto/cbc.go

Lines 90 to 96 in b5bb965

if padLen > bLen || padLen > aes.BlockSize {
return b, errors.New("invalid padding size")
}
for _, p := range b[bLen-padLen : bLen-1] {
if p != pad {
return b, errors.New("invalid padding")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant