Fix buffer overflow in wc_HpkeLabeledExtract via oversized ECH#9927
Closed
anhu wants to merge 1 commit intowolfSSL:masterfrom
Closed
Fix buffer overflow in wc_HpkeLabeledExtract via oversized ECH#9927anhu wants to merge 1 commit intowolfSSL:masterfrom
anhu wants to merge 1 commit intowolfSSL:masterfrom
Conversation
…config SetEchConfigsEx accepted arbitrarily large ECH configs without bounds checking rawLen. This allowed attacker-controlled data (from DNS HTTPS records or TLS retry_configs) to overflow the fixed 512-byte labeled_ikm stack buffer in wc_HpkeLabeledExtract during ClientHello construction. Add MAX_ECH_CONFIG_RAW_SZ to reject oversized configs at parse time, and add bounds checks in both wc_HpkeLabeledExtract and wc_HpkeLabeledExpand before writing into their fixed-size buffers. Fixes ZD#21309
philljj
reviewed
Mar 9, 2026
| * is concatenated into a MAX_HPKE_LABEL_SZ buffer in wc_HpkeLabeledExtract | ||
| * along with version (7) + suite_id (HPKE_SUITE_ID_LEN) + label (~12) + | ||
| * TLS info prefix (8) overhead. */ | ||
| #define MAX_ECH_CONFIG_RAW_SZ (MAX_HPKE_LABEL_SZ - 50) |
Contributor
There was a problem hiding this comment.
Where does the - 50 come from?
Member
Author
|
Closing because #9737 fixes this issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SetEchConfigsEx accepted arbitrarily large ECH configs without bounds checking rawLen. This allowed attacker-controlled data (from DNS HTTPS records or TLS retry_configs) to overflow the fixed 512-byte labeled_ikm stack buffer in wc_HpkeLabeledExtract during ClientHello construction.
Add MAX_ECH_CONFIG_RAW_SZ to reject oversized configs at parse time, and add bounds checks in both wc_HpkeLabeledExtract and wc_HpkeLabeledExpand before writing into their fixed-size buffers.
Fixes ZD#21309