DragonFlyBSD Kernel Audit
← triage · dashboard
DF-2243

Early-boot RC4 stream keyed with uninitialized kernel stack because read_random() returns 0 before CSPRNG initialized

Summary

arc4_randomstir() allocates uint8_t key[256] on stack (arc4random.c:53) and only fills it from read_random() when r>0 (arc4random.c:62-65). Fallback when r<=0 is by author comment just use what was on the stack i.e. RC4 KSA keyed with uninitialized kernel-stack residue. arc4_init_pcpu() called from SMP bringup (mp_machdep.c:513/571/1680) strictly before rand_initialize() at SI_BOOT2_POST_SMP (kern_nrandom.c:562). read_random() returns 0 when csprng_pcpu==NULL (kern_nrandom.c:693-696). Every CPU first RC4 keystream after boot derived from largely-deterministic stack contents rather than real entropy. 300s/16384-run reseed budget means FIRST ~300 seconds of karc4random output on each CPU including tcp_syncache.hash_secret (long-lived boot-time secret) pf_status.hostid ASLR/stack-gap offsets derived from stack-garbage key. Attacker targeting fixed DragonFlyBSD appliance/embedded build (pinned compiler/config/boot path) can reconstruct early RC4 keystream predicting syncache hash secret (blind SYN-flood/hijack) pf hostid (state-key derivation) ASLR offsets for processes execd in first reseed window. Occurs on every cold boot. Impact bounded by stack residue predictability build/hardware dependent.

Discussion (0)

No comments yet.