wolfSSL — Predictable DRBG Seed from the Millisecond Clock in EBSnet RTP Builds
On EBSnet RTP builds, wolfSSL's seed function seeds the platform generator once from the system millisecond clock and returns rtp_rand() output as the DRBG seed. The whole seed is a function of one clock reading, so it, and everything drawn from the DRBG, can be recomputed by searching a window of milliseconds.
- Advisory
- BYTERAY-2026-0326
- CWE
- CWE-323
- CVSS
- 7.4 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N)
- Vendor
- wolfSSL
- Product
- wolfSSL
- Reported
- 2026-09-27
- Disclosure
- 2026-12-03
- Affected
- wolfSSL 5.9.2 (tested at master commit d95483f), builds with HAVE_RTP_SYS, or EBSNET with RTPLATFORM non-zero, that do not supply their own seed source
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
wolfSSL's random number generator is a Hash_DRBG. It takes its entropy from wc_GenerateSeed(), which has one implementation per platform. The implementation selected for the EBSnet RTP platform has no entropy source. It calls rtp_srand() once with the system millisecond clock and fills the seed buffer from rtp_rand().
The only input is one millisecond-clock sample. rtp_rand() is a deterministic generator and adds nothing, so the seed buffer, and the DRBG state instantiated from it, is a fixed function of a value an observer can bound. Someone who sees a value the DRBG produced, such as a TLS hello random or an AES-GCM IV, can search the candidate milliseconds for the one that reproduces it and then compute every other value the generator gave out.
Only builds for the EBSnet RTP platform take this branch. A default ./configure build does not; it seeds from /dev/urandom.
Affected Products and Versions
- Component:
wolfcrypt/src/random.c,wc_GenerateSeed(), theHAVE_RTP_SYS/EBSNETbranch. - Required build: the branch is selected by
HAVE_RTP_SYSorEBSNET(wolfcrypt/src/random.c:7907). Thertp_rand()form described here is compiled whenHAVE_RTP_SYSis defined, orEBSNETwithRTPLATFORMnon-zero (wolfcrypt/src/random.c:7911). - No seed override in place.
CUSTOM_RAND_GENERATE_SEEDandCUSTOM_RAND_GENERATE_SEED_OScome first in the same chain (wolfcrypt/src/random.c:7743,wolfcrypt/src/random.c:7756). - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default
./configurebuild does not include this code. - Other releases were not checked.
Technical Details
The function is at wolfcrypt/src/random.c:7914-7924:
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
word32 i;
rtp_srand(rtp_get_system_msec());
for (i = 0; i < sz; i++ ) {
output[i] = rtp_rand() % 256;
}
return 0;
}
The generator is seeded once, at wolfcrypt/src/random.c:7918, and never again during the call. Every output byte is the next rtp_rand() value reduced to eight bits. The function always returns 0. Two calls in the same millisecond return the same buffer.
The other form of the branch, for EBSNET builds where RTPLATFORM is zero, has the same shape with KS_SEED(ks_get_ticks()) and KS_RANDOM() (wolfcrypt/src/random.c:7925-7936). ByteRay's report and test cover the rtp_rand() form.
How the seed is used:
wc_InitRng()(wolfcrypt/src/random.c:3400) calls_InitRng()(wolfcrypt/src/random.c:2745)._InitRng()requests the seed fromwc_GenerateSeed()(wolfcrypt/src/random.c:3135). WithWC_RNG_SEED_CBthe default callback is the same function (wolfcrypt/src/random.c:390). Reseeding also calls it (wolfcrypt/src/random.c:4685).- The branch above fills the buffer from one clock reading.
Hash_DRBG_Instantiate()takes that buffer as its entropy input (wolfcrypt/src/random.c:3178).wc_RNG_GenerateBlock()hands out DRBG output (wolfcrypt/src/random.c:5605).- That output reaches the wire: per-message AES-GCM IVs from
wc_AesGcmSetIV()(wolfcrypt/src/aes.c:15126), session ticket IVs fromDefTicketEncCb()(src/internal.c:44924), and TLS handshake randoms. Keys generated on the device come from the same stream.
Reachability and Preconditions
- The library is built with
HAVE_RTP_SYS, or withEBSNETand a non-zeroRTPLATFORM, and uses the stock seed function. - Any integration that calls
wc_InitRng(), or lets the TLS layer do so, seeds its DRBG through this branch. No unusual option or call sequence is involved. - The attacker is a passive observer of TLS or DTLS traffic from the device. No authentication and no interaction with the device are needed.
- The attacker can bound the value of
rtp_get_system_msec()at seeding time, typically from boot time and uptime, and observes at least one DRBG-derived value to confirm a candidate. - The attacker needs the platform's
rtp_rand()algorithm.
Impact
On these builds the DRBG seed is determined by one millisecond-clock reading. An observer who pins that reading recovers the DRBG state and can compute the session keys, GCM IVs, session ticket keys and locally generated keys drawn from it. Predictable per-message IVs also break GCM's integrity guarantee through nonce reuse. The main effect is that secret material on affected builds can be derived from public observations.
ByteRay compiled the unmodified wolfCrypt sources with HAVE_RTP_SYS on a Linux host, with the RTP clock and generator calls replaced by stand-ins. Two separate processes started at the same millisecond produced identical AES-GCM IV, tag and ciphertext, and a search over a window of 16384 candidate boot times reproduced a captured IV and tag through wc_InitRng() and wc_AesGcmSetIV(); a control build seeded from the host's /dev/urandom did not repeat.
Behaviour on an EBSnet target, with the vendor's own rtp_rand(), was not measured.
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 seed this port from a real entropy source: a hardware RNG where the target has one, or several independent noise sources combined. A single rtp_get_system_msec() sample expanded by rtp_rand() should not be the seed. Where no trustworthy source exists, wc_GenerateSeed() should return an error such as RNG_FAILURE_E, so that the DRBG refuses to instantiate instead of running from a predictable seed.
Workaround: define CUSTOM_RAND_GENERATE_SEED to a function that reads a hardware or system entropy source. That macro takes precedence over this branch. Treat keys generated by a build that used the stock function as exposed and replace them.
Timeline
- 2026-09-27 — Reported to wolfSSL.
- 2026-12-03 — Public disclosure.
Credits
Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.
References
- EBSnet RTP branch of wc_GenerateSeed at the tested commit
- BYTERAY-2026-0325, the PIC32 branch of the same function
- BYTERAY-2026-0327, the INtime RTOS branch of the same function
- BYTERAY-2026-0328, the Apache Mynewt branch of the same function
- BYTERAY-2026-0329, the Deos branch of the same function
- BYTERAY-2026-0330, the Nucleus RTOS branch of the same function