888
Applicable Platforms
Language : Verilog (Prevalence = Undetermined)
Language : VHDL (Prevalence = Undetermined)
Technology : System on Chip (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Access Control Bypass Protection Mechanism
System configuration cannot be programmed in a secure
way.
Potential Mitigations
Phase: Architecture and Design
During hardware design all register write-once or sticky fields must be evaluated for proper
configuration.
Phase: Testing
The testing phase should use automated tools to test that values are not reprogrammable and
that write-once fields lock on writing zeros.
Demonstrative Examples
Example 1:
consider the example design module system verilog code shown below.
register_write_once_example module is an example of register that has a write-once field defined.
Bit 0 field captures the write_once_status value.
Example Language: Verilog (Bad)
module register_write_once_example
(
input [15:0] Data_in,
input Clk,
input ip_resetn,
input global_resetn,
input write,
output reg [15:0] Data_out
);
reg Write_once_status;
always @(posedge Clk or negedge ip_resetn)
if (~ip_resetn)
begin
Data_out <= 16'h0000;
Write_once_status <= 1'b0;
end
else if (write & ~Write_once_status)
begin
Data_out <= Data_in & 16'hFFFE; // Input data written to register after masking bit 0
CWE Version 4.14
CWE-1224: Improper Restriction of Write-Once Bit Fields
CWE-1224: Improper Restriction of Write-Once Bit Fields