wolfSSL — Weak Default Key-Size Floors in Peer Certificate Check ProcessPeerCertCheckKey
ProcessPeerCertCheckKey compares the public key size of each certificate in a peer's chain with the connection's minimum. In a default build that minimum is 1024 bits for RSA and 224 bits for ECC, so a 1024-bit RSA certificate that chains to a trusted root is accepted and the peer is authenticated at about 80-bit strength.
- Advisory
- BYTERAY-2026-0392
- CWE
- CWE-1188
- CVSS
- 5.9 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N)
- Vendor
- wolfSSL
- Product
- wolfSSL
- Reported
- 2026-09-28
- Disclosure
- 2026-12-03
- Affected
- wolfSSL 5.9.2 (tested at master commit d95483f), default builds without WOLFSSL_HARDEN_TLS or WOLFSSL_MAX_STRENGTH and without raised runtime key-size floors, with certificate verification enabled
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
When a TLS endpoint verifies the chain its peer presents, ProcessPeerCertCheckKey() compares each certificate's public key size with a configured minimum. It runs for every certificate of the chain during handshake processing.
In a default build the minimums are 128 bytes for RSA and 28 bytes for ECC. They are inherited from the TLS context defaults, and a key is rejected only when it is smaller. A 1024-bit RSA certificate issued by a private or legacy CA is accepted, and the handshake completes with the peer treated as authenticated at roughly 80-bit strength.
An attacker who holds such a weakly keyed but trusted certificate, or who can factor a 1024-bit RSA key, can impersonate the endpoint. The certificate must still chain to a locally trusted root. Default builds are affected.
Affected Products and Versions
- Component:
src/internal.c,ProcessPeerCertCheckKey(), called fromProcessPeerCerts(). - Required build: none. The weak floors apply when
WOLFSSL_HARDEN_TLSandWOLFSSL_MAX_STRENGTHare undefined. - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default
./configurebuild is affected unless the application raises the floors at run time. - Other releases were not checked.
Technical Details
The function starts at src/internal.c:17048. Its RSA case is:
case RSAk:
if (ssl->options.minRsaKeySz < 0 ||
args->dCert->pubKeySize <
(word16)ssl->options.minRsaKeySz) {
The key is rejected with RSA_KEY_SIZE_E only when pubKeySize is strictly below the floor (src/internal.c:17062-17069). In a default build minRsaKeySz is MIN_RSAKEY_SZ, 1024 / 8 = 128 bytes (wolfssl/internal.h:2005, wolfssl/internal.h:2022). A 128-byte modulus passes. The ECC case applies minEccKeySz, 224 / 8 = 28 bytes (wolfssl/internal.h:1968), at src/internal.c:17074-17081. Ed25519 and Ed448 cases follow at src/internal.c:17086-17098. The shortfall is the RSA floor. A 224-bit ECC key is at the 112-bit level.
- The peer's Certificate message reaches
DoCertificate()(src/internal.c:19626), which callsProcessPeerCerts()(src/internal.c:19649). - Parsing each certificate fills
args->dCert, includingpubKeySizefrom the subject public key. - On parse success
ProcessPeerCerts()callsProcessPeerCertCheckKey()(src/internal.c:18587-18588). - The function returns at once if the application disabled verification (
src/internal.c:17052-17054). Otherwise it comparespubKeySizewith the floor. - The floors were set per context in
InitSSL_Ctx()(src/internal.c:2791,src/internal.c:2795) and copied into the connection bySetSSL_CTX()(src/internal.c:8025,src/internal.c:8031).
The comment above the function calls it a redundant check that duplicates another one (src/internal.c:17046-17047). The same floor is therefore applied at more than one place in the peer certificate path, including the checks at src/internal.c:17729 and src/internal.c:17808. This advisory covers this function. The defaults themselves are described in BYTERAY-2026-0391.
Reachability and Preconditions
- Default build with certificate verification enabled. The check runs in every such handshake.
- The attacker operates the remote endpoint: a server contacted by a wolfSSL client, or a client presenting a certificate in mutual TLS.
- The certificate carries a 1024-bit RSA key and chains to a CA in the verifier's trust store. Public CAs no longer issue such keys, so this is confined to private, legacy or internal PKIs.
- The threshold is a compile-time default. The peer cannot lower or disable it remotely.
- No floor has been raised with
wolfSSL_CTX_SetMinRsaKey_Sz()orwolfSSL_CTX_SetMinEccKey_Sz().
Impact
A TLS peer identity is accepted at 80-bit security. Factoring the weak key, about 2^80 work, or forging a signature with it allows impersonation of the endpoint against deployments that assumed a 2048-bit floor. Full chain-of-trust validation remains in force and is the binding constraint. The weak floor lowers the key strength admitted. It does not make an untrusted certificate trusted.
ByteRay did not build a proof of concept for this issue. The analysis is from source review.
Remediation and Mitigation
ByteRay has not confirmed a fixed wolfSSL release for this issue as of 2026-12-03, and has not checked it against wolfSSL changes made after the tested commit.
The fix direction is at the defaults, not at this call site: raise the shipped MIN_RSAKEY_SZ to at least 2048 bits and allow legacy sizes only behind an explicit option. The macros are defined once and enforced in several places, so correcting them repairs every enforcement point. Consolidating the duplicated key-size checks into one routine would keep them from diverging. Integrators can raise the floors per context with wolfSSL_CTX_SetMinRsaKey_Sz() and wolfSSL_CTX_SetMinEccKey_Sz(), which propagate to every connection, or build with WOLFSSL_HARDEN_TLS or WOLFSSL_MAX_STRENGTH.
Timeline
- 2026-09-28 — Reported to wolfSSL.
- 2026-12-03 — Public disclosure.
Credits
Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.