Skip to content

Various security fixes and tests#10088

Open
anhu wants to merge 10 commits intowolfSSL:masterfrom
anhu:new_various
Open

Various security fixes and tests#10088
anhu wants to merge 10 commits intowolfSSL:masterfrom
anhu:new_various

Conversation

@anhu
Copy link
Copy Markdown
Member

@anhu anhu commented Mar 27, 2026

Fixes:
zd21412
zd21413
zd21414
zd21415
zd21417
zd21418
zd21422
zd21423
zd21426

anhu added 9 commits March 27, 2026 09:44
Add missing hashLen validation in dilithium_verify_ctx_hash() to match
the check already present in the sign path. Without this, a caller
could pass a hashLen larger than WC_MAX_DIGEST_SIZE.
Validate that the received key share data length (keLen) is at least
as large as the expected ciphertext size (ctSz) before passing it to
wc_KyberKey_Decapsulate. A malicious TLS 1.3 server could send a
short ML-KEM key share.
Add bounds check for oriOIDSz against MAX_OID_SZ before copying into
the oriOID stack buffer in wc_PKCS7_DecryptOri. A crafted CMS
EnvelopedData message could set an OID length larger than 32 bytes.
Save key->heap before calling wc_*_free(), which zeros the entire key
structure via ForceZero. The saved heap pointer is then passed to XFREE
instead of the now-zeroed key->heap.
Add check before word32 addition in dilithium_hash256() that
could wrap to zero, bypassing the size check.
Also reject absurdly large msgLen (> UINT32_MAX/2) in
wc_dilithium_verify_ctx_msg.
Validate ECC key imports when the untrusted flag is set to prevent
invalid curve attacks. The TLS key exchange path (internal.c) passes
untrusted=1 for peer keys. Trusted imports (cert parsing) pass
untrusted=0 and skip the check.
…1422)

Replace single last-byte padding check with full PKCS#5/PKCS#7
validation: verify padLen is non-zero and within block size.
Both wc_PKCS7_DecodeEnvelopedData and wc_PKCS7_DecodeEncryptedData
paths are fixed.
Reinitialize pointer fields in WOLFSSL_SESSION after raw XMEMCPY or
XFREAD in wolfSSL_memrestore_session_cache and
wolfSSL_restore_session_cache. After restore, ticket is reset to
staticTicket, ticketLenAlloc to 0, and peer to NULL.
Increase buff size from 8 to 24 bytes in PrintPubKeyRSA and related
EVP PKEY print functions.
@anhu anhu requested a review from wolfSSL-Bot March 27, 2026 13:48
@anhu anhu self-assigned this Mar 27, 2026
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.

1 participant