Hardware Internal or Debug Modes Allow Override of Locks

System configuration protection may be bypassed during debug mode.


Description

Device configuration controls are commonly programmed after a device power reset by a trusted firmware or software module (e.g., BIOS/bootloader) and then locked from any further modification. This is commonly implemented using a trusted lock bit, which when set, disables writes to a protected set of registers or address regions. The lock protection is intended to prevent modification of certain system configuration (e.g., memory/memory protection unit configuration). If debug features supported by hardware or internal modes/system states are supported in the hardware design, modification of the lock protection may be allowed allowing access and modification of configuration information.

Demonstrations

The following examples help to illustrate the nature of this weakness and describe methods or techniques which can be used to mitigate the risk.

Note that the examples here are by no means exhaustive and any given weakness may have many subtle varieties, each of which may require different detection methods or runtime controls.

Example One

For example, consider the example Locked_override_register example. This register module supports a lock mode that blocks any writes after lock is set to 1.

However, it also allows override of the lock protection when scan_mode or debug_unlocked modes are active.

module Locked_register_example(input [15:0] Data_in,input Clk,input resetn,input write,input Lock,input scan_mode,input debug_unlocked,output reg [15:0] Data_out);reg lock_status;always @(posedge Clk or negedge resetn)if (~resetn) // Register is reset resetnbeginlock_status <= 1'b0;endelse if (Lock)beginlock_status <= 1'b1;endelse if (~Lock)beginlock_status <= lock_statusendalways @(posedge Clk or negedge resetn)if (~resetn) // Register is reset resetnbeginData_out <= 16'h0000;endelse if (write & (~lock_status | scan_mode | debug_unlocked) ) // Register protected by Lock bit input, overrides supported for scan_mode & debug_unlockedbeginData_out <= Data_in;endelse if (~write)beginData_out <= Data_out;endendmodule

If either the scan_mode or the debug_unlocked modes can be triggered by software, then the lock protection may be bypassed.

Either remove the debug and scan mode overrides or protect enabling of these modes so that only trusted and authorized users may enable these modes.

See Also

Debug and Test Problems

Weaknesses in this category are related to hardware debug and test interfaces such as JTAG and scan chain.

General Circuit and Logic Design Concerns

Weaknesses in this category are related to hardware-circuit design and logic (e.g., CMOS transistors, finite state machines, and registers) as well as issues related t...

Comprehensive CWE Dictionary

This view (slice) covers all the elements in CWE.

Weaknesses without Software Fault Patterns

CWE identifiers in this view are weaknesses that do not have associated Software Fault Patterns (SFPs), as covered by the CWE-888 view. As such, they represent gaps in...

Weaknesses Introduced During Implementation

This view (slice) lists weaknesses that can be introduced during implementation.


Common Weakness Enumeration content on this website is copyright of The MITRE Corporation unless otherwise specified. Use of the Common Weakness Enumeration and the associated references on this website are subject to the Terms of Use as specified by The MITRE Corporation.