wolfSSL — Weak Default Minimum DH and RSA Key Sizes in TLS Context Initialization
In a default build InitSSL_Ctx sets the minimum accepted key sizes to 1024 bits for Diffie-Hellman and 1024 bits for RSA, about 80-bit security. Every connection inherits them, so a client completes a handshake with a server that sends a 1024-bit DHE group or presents a 1024-bit RSA certificate. The 2048-bit floors exist only in opt-in hardened builds.
- Advisory
- BYTERAY-2026-0391
- 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 non-FIPS 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
Every TLS context carries minimum key sizes that the library will accept from a peer. InitSSL_Ctx() sets them when the context is created, and each connection and the certificate manager inherit them.
In a default build, with no WOLFSSL_HARDEN_TLS, no WOLFSSL_MAX_STRENGTH and no FIPS, those minimums are 1024 bits for Diffie-Hellman and 1024 bits for RSA. That is roughly 80-bit security. RFC 9325 section 4.1 and NIST SP 800-57 call for at least 112-bit security, which means 2048-bit keys. wolfSSL's own hardening profile enforces that value, but only when it is switched on.
A deployment built with defaults completes a handshake with a peer that offers a 1024-bit DHE group or presents a 1024-bit RSA certificate. Sessions protected by a 1024-bit DH exchange can be recorded and decrypted offline later by a well-resourced attacker. Default builds are affected.
Affected Products and Versions
- Component:
src/internal.c,InitSSL_Ctx(), and the checks that consume the floors inGetDhPublicKey()and the peer certificate path. - Required build: none. The weak floors apply when
WOLFSSL_HARDEN_TLS,WOLFSSL_MAX_STRENGTHandHAVE_FIPSare not set.--enable-harden-tlsis disabled by default (configure.ac:376-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
Three compile-time defaults set the floors. DH_MIN_SIZE is 1024 in the non-FIPS branch (wolfssl/wolfcrypt/settings.h:5278). WOLFSSL_MIN_RSA_BITS is 1024 in the bare default branch (wolfssl/internal.h:2005). WOLFSSL_MIN_ECC_BITS is 224 (wolfssl/internal.h:1968). The byte floors MIN_DHKEY_SZ, MIN_RSAKEY_SZ and MIN_ECCKEY_SZ derive from them as 128, 128 and 28. Under WOLFSSL_HARDEN_TLS the same macros become 2048 or 3072 bits, and compile-time checks cite RFC 9325 section 4.1 (wolfssl/internal.h:1258-1266, wolfssl/internal.h:2008-2016). Those apply only in the hardened build.
InitSSL_Ctx() stores the defaults without condition:
#ifndef NO_DH
ctx->minDhKeySz = MIN_DHKEY_SZ;
ctx->maxDhKeySz = MAX_DHKEY_SZ;
#endif
#ifndef NO_RSA
ctx->minRsaKeySz = MIN_RSAKEY_SZ;
#endif
wolfSSL_CTX_new()reachesInitSSL_Ctx(), which assigns the floors (src/internal.c:2787,src/internal.c:2791,src/internal.c:2795).SetSSL_CTX()copies them into each connection's options (src/internal.c:8021,src/internal.c:8025,src/internal.c:8031).wolfSSL_CertManagerNew_ex()applies the same values to the certificate manager (src/ssl_certman.c:157,src/ssl_certman.c:160).GetDhPublicKey()reads the length of the DHE prime from the server'sServerKeyExchange(src/internal.c:36049) and accepts it when it is at leastssl->options.minDhKeySz(src/internal.c:36056-36059). A 128-byte prime passes.- The peer certificate RSA check accepts a key of at least
minRsaKeySz(src/internal.c:17729-17736,src/internal.c:17062-17081). A 1024-bit RSA certificate passes.
The default cipher suite list includes DHE-RSA-AES128-SHA256 (src/internal.c:4597-4607), so the DH path needs no special configuration. The ECC floor of 224 bits meets the 112-bit minimum and is not part of this issue.
Reachability and Preconditions
- Default build. The application has not called
wolfSSL_CTX_SetMinDhKey_Sz()orwolfSSL_CTX_SetMinRsaKey_Sz()and has not overridden the macros. - For the DH case, a DHE_RSA suite (not ECDHE) is negotiated. The attacker is a rogue TLS server, or an active party in the path able to steer suite selection, and sends a 1024-bit prime.
- For the RSA case, the peer presents a 1024-bit RSA certificate that chains to a root the verifier trusts, for example in a private or legacy PKI.
- The floors accept weak parameters. They do not force them. Compromise also needs a weakly configured endpoint and heavy offline computation. Both checks are skipped if the application disables verification.
Impact
Loss of forward secrecy for recorded TLS sessions that used a 1024-bit DH group. A well-resourced attacker can compute the discrete logarithm offline, or reuse precomputation for a shared prime, as in the Logjam attack. Separately, RSA peer identities of 80-bit strength are accepted where a 2048-bit floor was expected. Trust-chain signature verification still applies to peer certificates. The floor lowers the key strength admitted 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 shipped defaults for DH_MIN_SIZE and WOLFSSL_MIN_RSA_BITS to 2048, matching the hardened profile, and to keep the 1024-bit values behind an explicit legacy option. Integrators on default builds can call wolfSSL_CTX_SetMinDhKey_Sz(ctx, 2048) and wolfSSL_CTX_SetMinRsaKey_Sz(ctx, 2048) on every context and mirror the setting in any certificate manager. Building with --enable-harden-tls or WOLFSSL_MAX_STRENGTH raises the floors at compile time. Preferring ECDHE suites over finite-field DHE removes the weak-group case.
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.