wolfSSL — Weak Default Key-Size Floors for CA Certificates in Certificate Manager AddCA
In a default build the certificate manager starts with minimum CA key sizes of 1024 bits for RSA and 224 bits for ECC. AddCA rejects only keys below those floors, so a 1024-bit RSA CA certificate loaded with verification enabled is installed as a trusted signer. Stronger floors exist but are opt-in.
- Advisory
- BYTERAY-2026-0390
- 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
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
The certificate manager decides whether a CA certificate may be installed as a trusted signer. When CA material is loaded or verified, AddCA() compares the CA's public key size with the manager's minimum for that key type and admits anything at or above it.
In a default build those minimums are 128 bytes for RSA and 28 bytes for ECC, which is 1024-bit RSA and 224-bit ECC. A 1024-bit RSA CA has roughly 80-bit security. It passes admission and anchors every chain it vouches for at that strength. The handshake-time checks do not evaluate the anchor again.
The stronger floors of 2048 or 3072 bits for RSA are in the code. They apply only with the build options WOLFSSL_HARDEN_TLS or WOLFSSL_MAX_STRENGTH, or after runtime setter calls the integrator has to make. Default builds are affected.
Affected Products and Versions
- Component:
src/ssl_certman.c,AddCA(), with the defaults set inwolfSSL_CertManagerNew_ex(). - Required build: none beyond RSA or ECC support. The weak floors apply when
WOLFSSL_HARDEN_TLSandWOLFSSL_MAX_STRENGTHare undefined.--enable-harden-tlsis disabled by default (configure.ac:377-379). - 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
wolfSSL_CertManagerNew_ex() sets cm->minRsaKeySz = MIN_RSAKEY_SZ (src/ssl_certman.c:157) and cm->minEccKeySz = MIN_ECCKEY_SZ (src/ssl_certman.c:160). In a default build WOLFSSL_MIN_RSA_BITS is 1024 (wolfssl/internal.h:2005), giving 128 bytes (wolfssl/internal.h:2022), and WOLFSSL_MIN_ECC_BITS is 224 (wolfssl/internal.h:1968), giving 28 bytes (wolfssl/internal.h:1979). The hardened branches at wolfssl/internal.h:1994-2001 are inactive.
AddCA() enforces exactly those values in a switch that runs when its verify flag is set (src/ssl_certman.c:3195):
case RSAk:
if (cm->minRsaKeySz < 0 ||
cert->pubKeySize < (word16)cm->minRsaKeySz) {
ret = RSA_KEY_SIZE_E;
The RSA case rejects only pubKeySize below the floor (src/ssl_certman.c:3202-3209). The ECC case does the same against its floor (src/ssl_certman.c:3214-3220), with Ed25519 and Ed448 cases at src/ssl_certman.c:3226 and src/ssl_certman.c:3235. A 128-byte RSA modulus equals the floor and is admitted. The shortfall is the RSA floor. A 224-bit ECC key is at the 112-bit level.
How CA material reaches the check:
ProcessBuffer()callsAddCA()for a loaded CA (src/ssl_load.c:211), andProcessChainBuffer()does so atsrc/ssl_load.c:2419. These servewolfSSL_CertManagerLoadCA(),wolfSSL_CertManagerLoadCABuffer()andwolfSSL_CertManagerVerifyBuffer().- The X.509 store add path calls it with verification on (
src/x509_str.c:2128). The OCSP CertID helper creates a fresh manager (src/ocsp.c:807) and callsAddCA()withverifyset to 1 (src/ocsp.c:822). - The key-size switch passes any RSA key of 128 bytes or more, and the CA is installed as a trusted signer.
The peer-chain add in ProcessPeerCerts() calls AddCA() with NO_VERIFY (src/internal.c:18922), so the switch is skipped there. This issue concerns CA material the operator provisions, not chains sent by a peer.
Reachability and Preconditions
- Default build, with no call to the runtime setters that raise the floors (
src/ssl_api_pk.c:1701-1703,src/ssl_api_pk.c:1772-1773). - A CA certificate with a 1024-bit RSA key is present in the application's trust store or can be enrolled into it. Legacy private PKIs are the typical case. An attacker who controls enrolment in a private PKI is another.
- The threshold is fixed at build time. The key size compared with it comes from provisioned certificate material, not from the TLS peer.
- Turning the admitted anchor into forged certificates requires recovery of the CA's private key offline, which takes a well-resourced attacker.
Impact
A PKI anchored on the admitted CA operates at roughly 80-bit security. An attacker who recovers the weak CA key can forge certificates for any identity the application trusts through that anchor, with loss of confidentiality and integrity for sessions validated against it. wolfSSL admits the weak key. It does not create it. Chain and signature validation still apply. The floor lowers the key strength accepted for a trust anchor and does not bypass CA validation.
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 to raise the certificate manager's default floors to the values the hardened profile already uses, at least 2048-bit RSA, and to make acceptance of legacy CA keys an explicit choice through the existing setter APIs. Integrators can build with --enable-harden-tls or WOLFSSL_MAX_STRENGTH, or raise the floors at run time with wolfSSL_CTX_SetMinRsaKey_Sz() and wolfSSL_CTX_SetMinEccKey_Sz(). Trust stores should be checked for CA keys at or near 1024-bit RSA.
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.