← ALL ADVISORIES

LOW BYTERAY-2026-0533Disclosed

wolfSSL — Raw RDRAND Output Returned Without DRBG or Repetition Check

In HAVE_INTEL_RDRAND builds on CPUs with RDRAND, wc_RNG_GenerateBlock returns raw RDRAND output and no Hash_DRBG is instantiated. The only controls are the carry flag and a retry bound. Nothing detects an instruction that reports success while returning the same value, a failure the adjacent RDSEED path checks for.

Advisory
BYTERAY-2026-0533
CWE
CWE-1213
CVSS
2.5 (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/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), builds with HAVE_INTEL_RDRAND on CPUs that report RDRAND
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

In builds that enable the RDRAND fast path (HAVE_INTEL_RDRAND), wc_RNG_GenerateBlock() returns RDRAND output directly when the CPU reports the instruction. RNG initialization marks the generator as ready without creating a Hash_DRBG.

RDRAND is an on-chip DRBG and is normally sound. The code does not monitor it. The only checks are the carry flag and a bounded retry loop. Nothing detects the failure in which the instruction reports success and keeps returning the same value. The RDSEED seeding path in the same file has a repeating-value check for exactly this failure class. The RDRAND path has none.

If RDRAND became stuck while reporting success, every random value in the process would repeat with no error and no fallback. The option is off by default, and a remote attacker cannot cause the fault.

Affected Products and Versions

  • Component: wolfcrypt/src/random.c, wc_RNG_GenerateBlock() and wc_GenerateRand_IntelRD().
  • Required build: HAVE_INTEL_RDRAND, and a CPU that reports RDRAND at run time.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • The option is documented as off by default (wolfcrypt/src/random.c:70). A default build is not affected.
  • Other releases were not checked.

Technical Details

The short circuit is at wolfcrypt/src/random.c:5635-5638:

#ifdef HAVE_INTEL_RDRAND
    if (IS_INTEL_RDRAND(intel_flags))
        return wc_GenerateRand_IntelRD(NULL, output, sz);
#endif
  1. At initialization, _InitRng() sees that the CPU supports RDRAND, sets rng->status = DRBG_OK and returns. No DRBG is instantiated (wolfcrypt/src/random.c:2928-2941).
  2. A consumer calls wc_RNG_GenerateBlock(). The function returns wc_GenerateRand_IntelRD() before any DRBG code.
  3. wc_GenerateRand_IntelRD() writes 64-bit RDRAND words into the output (wolfcrypt/src/random.c:7230-7267). Each word is accepted when the carry flag reports success, within a retry bound of INTELRD_RETRY attempts (wolfcrypt/src/random.c:7219-7227).
  4. The bytes go to the caller. There is no comparison between consecutive words, no repetition count or adaptive proportion test, and no conditioning beyond what the chip does.

A hard failure, where the carry flag stays clear, does propagate as an error. The gap is a fault that repeats output while the carry flag reports success. For comparison, wc_GenerateSeed_IntelRD() draws RDSEED words on first use, compares them, and latches WC_HW_E when they repeat (wolfcrypt/src/random.c:7105-7147).

Reachability and Preconditions

  • Build: HAVE_INTEL_RDRAND. Off by default.
  • The CPU must report RDRAND. Every caller of wc_RNG_GenerateBlock() then takes this path.
  • Harm requires a hardware, firmware or hypervisor fault that makes RDRAND repeat while reporting success. A remote attacker cannot cause it. A hostile hypervisor that can intercept RDRAND already controls the guest.
  • No authentication or network position is relevant.

Impact

Under the fault described, TLS client and server randoms, session-ticket IVs, TLS 1.3 key shares, ECDHE keys and ECDSA nonces would be identical or predictable, and the library would report no error. Without the fault, output quality is that of RDRAND. This is a missing health check on a path that bypasses the DRBG.

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 apply a repeating-value check to wc_GenerateRand_IntelRD(): track consecutive identical 64-bit outputs and return WC_HW_E on a repeat. Full repetition count and adaptive proportion tests on the raw source would go further. As defense in depth, the Hash_DRBG can be instantiated in these builds as well, with RDRAND as a seed input. Builds that do not need the fast path can leave HAVE_INTEL_RDRAND undefined, which restores the Hash_DRBG.

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.

References