2115
tz_peripheral u_tz_peripheral(
.clk(clk),
.rst(rst),
.data_in(rdata),
// This port is no longer grounded, but instead driven by the appropriate signal
.data_in_security_level(rdata_security_level),
);
...
endmodule
Example 2:
Here is a code snippet from the Ariane core module in the HACK@DAC'21 Openpiton SoC
[REF-1362]. To ensure full functional correctness, developers connect the ports with names.
However, in some cases developers forget to connect some of these ports to the desired signals
in the parent module. These mistakes by developers can lead to incorrect functional behavior or, in
some cases, introduce security vulnerabilities.
Example Language: Verilog (Bad)
...
csr_regfile #(
...
) csr_regfile_i (
.flush_o ( flush_csr_ctrl ),
.halt_csr_o ( halt_csr_ctrl ),
...
.irq_i(),
.time_irq_i(),
.*
);
...
In the above example from HACK@DAC'21, since interrupt signals are not properly connected,
the CSR module will fail to send notifications in the event of interrupts. Consequently, critical
information in CSR registers that should be flushed or modified in response to an interrupt won't be
updated. These vulnerabilities can potentially result in information leakage across various privilege
levels.
To address the aforementioned vulnerability, developers must follow a two-step approach. First,
they should ensure that all module signals are properly connected. This can often be facilitated
using automated tools, and many simulators and sanitizer tools issue warnings when a signal
remains unconnected or floats. Second, it is imperative to validate that the signals connected to a
module align with the specifications. In the provided example, the developer should establish the
correct connection of interrupt signals from the parent module (Ariane core) to the child module
(csr_regfile) [REF-1363].
Example Language: Verilog (Good)
...
csr_regfile #(
...
) csr_regfile_i (
.flush_o ( flush_csr_ctrl ),
.halt_csr_o ( halt_csr_ctrl ),
...
.irq_i (irq_i),
.time_irq_i (time_irq_i),
.*
);
...
MemberOf Relationships
CWE Version 4.14
CWE-1277: Firmware Not Updateable
CWE-1277: Firmware Not Updateable