← ALL ADVISORIES

LOW BYTERAY-2026-0531Disclosed

wolfSSL — One-Time RDSEED Repeating-Output Check in Seed Generation

wc_GenerateSeed_IntelRD checks RDSEED for a repeating 64-bit value only on its first call, then sets a static flag and never compares again. If RDSEED starts returning repeated words later in the life of the process, those words are copied into DRBG seeds without detection.

Advisory
BYTERAY-2026-0531
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_RDSEED or HAVE_AMD_RDSEED on CPUs that report RDSEED
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

When wolfSSL is built with RDSEED seeding, wc_GenerateSeed_IntelRD() fills seed buffers from the x86 RDSEED instruction. It contains a guard against a known hardware failure in which the instruction keeps returning the same 64-bit value.

The guard runs once. On the first call the function draws words and compares them, then sets a static flag. Every later call skips the comparison and copies RDSEED words straight into the seed buffer. If the source begins to repeat after that first check, for example after a microcode, virtualization or suspend and resume fault, the seeds are filled with repeated words and nothing on this path notices.

Those seeds feed the Hash_DRBG. The DRBG seed test still catches a stuck output made of one repeated byte value. The gap is a repeating 64-bit word made of varied bytes. RDSEED seeding is a compile-time option and is off by default.

Affected Products and Versions

  • Component: wolfcrypt/src/random.c, wc_GenerateSeed_IntelRD().
  • Required build: HAVE_INTEL_RDSEED or HAVE_AMD_RDSEED, and a CPU that reports RDSEED at run time.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • Both options are documented as off by default (wolfcrypt/src/random.c:71-72). A default build is not affected.
  • Other releases were not checked.

Technical Details

The check is gated by a static latch, rdseed_sanity_status (wolfcrypt/src/random.c:7105). Abridged:

    if (rdseed_sanity_status == 0) {
        /* draw two words; if equal, draw a third and compare again */
        ...
        rdseed_sanity_status = 1;
    }
    else if (rdseed_sanity_status < 0) {
        return WC_HW_E;
    }
  1. On the first call the status is 0. The function draws two words and, if they match, a third. If the repeat persists it sets the status to -1 and returns WC_HW_E; every later call then fails (wolfcrypt/src/random.c:7116-7147).
  2. Otherwise it sets the status to 1 (wolfcrypt/src/random.c:7143). The flag is never reset.
  3. On every later call the block is skipped. The fill loop writes each IntelRDseed64_r() word into the output with no comparison against the previous word (wolfcrypt/src/random.c:7149-7180).
  4. The buffer is returned to wc_GenerateSeed(), which is the seed input for Hash_DRBG instantiation and reseeding.

The Windows, Linux kernel module, BSD kernel module and generic Unix branches of wc_GenerateSeed() all call this function (wolfcrypt/src/random.c:7864, wolfcrypt/src/random.c:9058, wolfcrypt/src/random.c:9109, wolfcrypt/src/random.c:9753). The Windows and Unix branches return as soon as RDSEED succeeds, so RDSEED is the only seed source there (wolfcrypt/src/random.c:7862-7872, wolfcrypt/src/random.c:9751-9765).

wc_RNG_TestSeed() applies a repetition count test with a cutoff of 31 identical bytes (wolfcrypt/src/random.c:2505-2507). A repeated word of varied bytes produces no long run of one byte value and passes.

Reachability and Preconditions

  • Build: RDSEED seeding enabled at compile time. Off by default.
  • The RDSEED source must start returning repeated values after the first successful check in the process. This is a hardware, microcode or hypervisor fault. An attacker cannot cause it through input to the library.
  • The repeated word must not consist of a single byte value. That form is caught by the DRBG seed test and fails closed.
  • No authentication or network position is relevant.

Impact

If the fault occurs, every later DRBG seed on the affected host is built from repeated 64-bit words, and the randomness derived from it degrades without an error: TLS randoms, session-ticket material and generated keys. The check that exists to catch this failure class covers first use only.

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 make the comparison continuous: keep the last word accepted by the fill loop, compare each new word against it on every call, and latch the failure and return WC_HW_E on a repeat, as the first-use check already does. A healthy RDSEED source practically never returns the same 64-bit value twice in a row, so the cost is small. Builds that do not need RDSEED seeding can leave HAVE_INTEL_RDSEED and HAVE_AMD_RDSEED undefined and seed from the operating system.

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