Bug 16 - CSRNG: AES Key and State Not Zeroized After Operation (Key Remanence)
Security feature bypassed
CSRNG key-material remanence protection - the post-operation zeroization of DRBG key state
Finding
After a CSRNG AES-CTR_DRBG operation the AES key (the DRBG state) and intermediate data
remain in registers: key_clear_i is hardwired to 0 and key_clear_o is unconnected -
the AES cipher core’s key clearing mechanism is explicitly disabled:
// csrng_block_encrypt.sv:116-117
.key_clear_i ( 1'b0 ), // BUG: Key clearing disabled
.key_clear_o ( ), // BUG: Clear output unconnected
Location or code reference
- hw/ip/csrng/rtl/csrng_block_encrypt.sv:116-117 -
.key_clear_i(1'b0), .key_clear_o()- zeroization disabled/unconnected
The attack flow for this bug is linked in the Attachments section below.
New Tools
Yes - static RTL audit (grep key_clear_i.*1'b0 - CONFIRMED at lines 116-117) +
module instantiation (Verilator 4.210): csrng_block_encrypt_tb.sv instantiates
the real module and confirms the disabled zeroization path
(see testbench/logs/rtl-test-simulation.log).
AI Tools
Yes
LLM
Yes
LLM Details
GPT-5.6-Sol from https://agentrouter.org/v1
Online LLM Details
Orchestrator session total: 38,176,115 in / 26,998 out tokens (the agentic session that ran the Lightsaber pipeline, session ses_031497488).
Estimated tokens for this bug’s run (from result.json turn log: csrng agentic run crashed on quota): not estimable (run crashed before writing result.json; finding recorded in session.json). Estimate = file bytes / 4 + ~2,600 system-prompt tokens per turn; the run was part of a larger multi-IP campaign, so the per-bug figure is an approximation.
LLM Prompts
Step-by-step discovery and verification (source: Lightsaber agentic audit (salvaged from agent log)):
- Lightsaber’s csrng agent produced a finding but the run crashed before writing
result.json(quota exhausted); the finding was recorded insession.json(title +focus: csrng). The agent log copy is empty, sosession.jsonis the evidence for this finding. - The finding: ‘AES key and internal data are not explicitly cleared after CSRNG encryption’ -
csrng_block_encrypt.svties.key_clear_i(1'b0)and leaves.key_clear_o()unconnected, so the DRBG key persists in the AES cipher core registers. - Verified on the RTL:
csrng_block_encrypt_tb.svconfirmskey_clear_i=0(see testbench logs).
Evidence:
- logs/lightsaber/session.json (entry: ‘AES key and internal data are not explicitly cleared after CSRNG encryption operations’)
Agent/session transcript: session transcript line 2625 (finding #9 (CSRNG remanence)).
Detection method
Static RTL audit + module instantiation. Security property: after operation completion the AES key registers must be zeroized; the evidence shows the zeroization request is never generated.
Security impact
DRBG state (128-bit K) persists in the AES cipher core registers after CSRNG operation. Combined with a register-read capability (debug bypass, scan chain, fault-induced register dump), an attacker recovers the DRBG state and predicts all past and future CSRNG output - every key derived since the state was loaded is compromised.
Adversary profile
Type 2 - physical attacker with register-read capability (JTAG/scan-chain access).
Proposed mitigation
.key_clear_i ( key_clear_req ), // connect to state machine
.key_clear_o ( key_clear_done ), // connect to state machine
State machine: after each CSRNG operation assert key_clear_i, wait for key_clear_o,
then idle.
CVSSv3.1 score and severity
4.9 - MEDIUM
CVSSv3.1 Details
CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N
- AV: Physical - register read via debug/fault
- AC: High - requires a register-read primitive
- PR: None
- S: Changed - crosses from CSRNG into all derived randomness
- C: High - full DRBG state disclosure