Various fixes#10142
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes multiple missing bounds/length checks across TLS 1.3 handshake, OCSP processing, and sniffer ClientHello parsing to prevent out-of-bounds reads/writes and invalid-length parsing.
Changes:
- Added maximum certificate extension count guards in TLS 1.3 certificate/OCSP flows.
- Added minimum-length checks before reading OPAQUE16-sized fields from buffers.
- Improved error return behavior/documentation for certificate status request buffer writing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/tls13.c | Adds MAX_CERT_EXTENSIONS bounds checks around CSR-to-buffer writing and TLS 1.3 certificate sending. |
| src/tls.c | Adds OPAQUE16 minimum-length validation and caps OCSP request processing to MAX_CERT_EXTENSIONS. |
| src/sniffer.c | Adds OPAQUE16 minimum-length validation for several ClientHello extensions. |
| src/internal.c | Adds MAX_CERT_EXTENSIONS bounds checks while generating/sending OCSP status responses. |
Comments suppressed due to low confidence (1)
src/internal.c:1
- This loop can still read past the end of
chainOcspRequestbecauseiis incremented inside&responses[++i]. After the last valid increment, the nextwhilecondition evaluatesssl->ctx->chainOcspRequest[i]withi == MAX_CERT_EXTENSIONS, causing an out-of-bounds read before the in-loop bounds check runs. Refactor to avoid pre-increment in the call (incrementiseparately after a bounds check) and ensure the bounds check occurs before anychainOcspRequest[i]dereference.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
src/internal.c:1
- The bounds check happens after indexing
ssl->ctx->chainOcspRequest[i], so ifiis already>= MAX_CERT_EXTENSIONSthis can read out-of-bounds before the new guard runs. Move/adjust the check to validatei < MAX_CERT_EXTENSIONSbefore evaluatingssl->ctx->chainOcspRequest[i](e.g., incorporate it into thewhilecondition or add a pre-check before the assignment).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d83ef81 to
86bb867
Compare
…GetFromBuffer. Thanks to Zou Dikai for the report.
…riteCSRToBuffer. Thanks to Zou Dikai for the report.
… chain. Thanks to Zou Dikai for the report.
Thanks to Zou Dikai for the report.
… to read the length before attempting the actual read. Thanks to Zou Dikai for the report.
86bb867 to
7251018
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
…ays equal 1 + MAX_CHAIN_DEPTH, and the latter is the length of the array.
Description
Fix multiple missing bounds and length checks.
Fixes zd#21536, zd#21537, zd#21538, zd#21540, zd#21541
Testing
Built in tests, provided reproducers
Checklist