Skip to content

michal/crypto/fix-aead-cipher-key-buffer-overread/OTP-20244#11337

Merged
Mikaka27 merged 1 commit into
erlang:maintfrom
Mikaka27:michal/crypto/fix-aead-cipher-key-buffer-overread/OTP-20244
Jul 24, 2026
Merged

michal/crypto/fix-aead-cipher-key-buffer-overread/OTP-20244#11337
Mikaka27 merged 1 commit into
erlang:maintfrom
Mikaka27:michal/crypto/fix-aead-cipher-key-buffer-overread/OTP-20244

Conversation

@Mikaka27

@Mikaka27 Mikaka27 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Prevents chacha20-1305 aead cipher encryption/decryption from accepting too long/short key size. For chacha20-1305 openssl reads fixed 32 bytes from the buffer passed by the user, even if the buffer is shorter in reality, triggering out of bounds read, and we had checks for that disabled.

In addition to that EVP_CIPHER_CTX_set_key_length calls were added for all aead ciphers, this might detect invalid key sizes set by the programmer in the source code, because this function will validate the key size even for fixed key size ciphers.
Contains the fix from #11330 because added validation also causes an early exit, and destructor trying to free a garbage pointer.

@Mikaka27 Mikaka27 self-assigned this Jul 3, 2026
@Mikaka27 Mikaka27 added the team:PS Assigned to OTP team PS label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

  2 files   14 suites   4m 37s ⏱️
195 tests 177 ✅  18 💤 0 ❌
497 runs  346 ✅ 151 💤 0 ❌

Results for commit f8d01d6.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@Mikaka27 Mikaka27 added the testing currently being tested, tag is used by OTP internal CI label Jul 3, 2026
@Mikaka27
Mikaka27 requested review from Whaileee, garazdawi and jhogberg and removed request for Whaileee July 9, 2026 08:33
@u3s
u3s self-requested a review July 21, 2026 12:07
Comment thread lib/crypto/c_src/aead.c Outdated
Comment thread lib/crypto/test/crypto_SUITE.erl Outdated
Comment thread lib/crypto/c_src/aead.c
Comment thread lib/crypto/test/crypto_SUITE.erl
Comment thread lib/crypto/test/crypto_SUITE.erl Outdated
@Mikaka27
Mikaka27 force-pushed the michal/crypto/fix-aead-cipher-key-buffer-overread/OTP-20244 branch from 9852099 to f8d01d6 Compare July 23, 2026 08:52
@Mikaka27
Mikaka27 requested a review from u3s July 23, 2026 08:55
@Mikaka27
Mikaka27 merged commit 6aac650 into erlang:maint Jul 24, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants