-
Notifications
You must be signed in to change notification settings - Fork 21
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
Incorrect padding removal condition #36
Comments
PR: #37 |
Hello @ksivask , Thanks a lot for pointing out the issue. I realize that the CBC padding implementation is incorrect... |
@babelouest, I have opened the PR #37 for the fix. |
Yes, but the patch fixed the case when a unpadding with 16 iterations of I've added some improvements in the fix-cbc-padding branch to cover padding when payload size is a 16-bytes set of blocks, and raise an error when the unpadding is wrong. This should make it PKCS#7 padding compatible now. |
with cbc, the padding char <= block_size, the code in
r_jwe_remove_padding
incorrectly checks for<
instead of<=
References:
[1] Original Code: https://github.com/babelouest/rhonabwy/blob/master/src/jwe.c#L2258
[2] GnuTLS: https://github.com/gnutls/gnutls/blob/master/lib/crypto-api.c#L519
Sample JWKS:
Sample Data:
a) <32: {'sub':'sivak','uid':8,'vni':4}
b) ==32:{'sub':'sivak','uid':8,'vni':14}
c) >32:{'sub':'sivak','uid':8,'vni':148}
Pre-Fix (using apt install rnbyc)
Post-Fix
The text was updated successfully, but these errors were encountered: