Skip to content

Hardening in TLSX_KeyShare_ProcessPqcHybridClient#10327

Open
embhorn wants to merge 1 commit intowolfSSL:masterfrom
embhorn:zd21704
Open

Hardening in TLSX_KeyShare_ProcessPqcHybridClient#10327
embhorn wants to merge 1 commit intowolfSSL:masterfrom
embhorn:zd21704

Conversation

@embhorn
Copy link
Copy Markdown
Member

@embhorn embhorn commented Apr 27, 2026

Description

Set pointer to NULL to prevent double free with a malformed ECDH key.

Fixes zd21704

Testing

Added test_tls13_pqc_hybrid_malformed_ecdh

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@embhorn embhorn self-assigned this Apr 27, 2026
Copilot AI review requested due to automatic review settings April 27, 2026 19:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens TLS 1.3 PQC-hybrid KeyShare client processing to avoid a double-free / UAF when the ECDH portion of a hybrid key share is malformed, and adds a regression test to cover the failure mode described in zd21704.

Changes:

  • Clear keyShareEntry->key after non-async/non-pending hybrid ECDH processing to prevent cleanup code from freeing an already-freed key pointer.
  • Add test_tls13_pqc_hybrid_malformed_ecdh to exercise the malformed-ECDH-but-correctly-sized hybrid key_share path.
  • Register the new test in the TLS 1.3 API test list.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/tls.c Clears keyShareEntry->key on non-pending return from inner ECDH processing to prevent double-free/UAF during later cleanup.
tests/api/test_tls13.c Adds a crafted ServerHello test case with a malformed X9.63 ECC point inside a correctly-sized PQC-hybrid key_share.
tests/api/test_tls13.h Declares and registers the new TLS 1.3 PQC-hybrid malformed-ECDH test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 27, 2026

MemBrowse Memory Report

No memory changes detected for:

Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #10327

Scan targets checked: wolfssl-bugs, wolfssl-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/tls.c Outdated
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

Successfully merging this pull request may close these issues.

4 participants