{"@ID": "1258", "@Name": "Exposure of Sensitive System Information Due to Uncleared Debug Information", "@Abstraction": "Base", "@Structure": "Simple", "@Status": "Draft", "Description": "The hardware does not fully clear security-sensitive values, such as keys and intermediate values in cryptographic operations, when debug mode is entered.", "Extended_Description": {"xhtml:p": "Security sensitive values, keys, intermediate steps of cryptographic operations, etc. are stored in temporary registers in the hardware. If these values are not cleared when debug mode is entered they may be accessed by a debugger allowing sensitive information to be accessible by untrusted parties."}, "Related_Weaknesses": {"Related_Weakness": {"@Nature": "ChildOf", "@CWE_ID": "212", "@View_ID": "1000", "@Ordinal": "Primary"}}, "Weakness_Ordinalities": {"Weakness_Ordinality": {"Ordinality": "Primary"}}, "Applicable_Platforms": {"Language": {"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}, "Operating_System": {"@Class": "Not OS-Specific", "@Prevalence": "Undetermined"}, "Architecture": {"@Class": "Not Architecture-Specific", "@Prevalence": "Undetermined"}, "Technology": {"@Class": "Not Technology-Specific", "@Prevalence": "Undetermined"}}, "Modes_Of_Introduction": {"Introduction": [{"Phase": "Architecture and Design"}, {"Phase": "Implementation"}]}, "Common_Consequences": {"Consequence": [{"Scope": "Confidentiality", "Impact": "Read Memory"}, {"Scope": "Access Control", "Impact": "Bypass Protection Mechanism"}]}, "Potential_Mitigations": {"Mitigation": {"Phase": "Architecture and Design", "Description": {"xhtml:p": "Whenever debug mode is enabled, all registers containing sensitive assets must be cleared."}}}, "Demonstrative_Examples": {"Demonstrative_Example": [{"Intro_Text": "A cryptographic core in a System-On-a-Chip (SoC) is used for cryptographic acceleration and implements several cryptographic operations (e.g., computation of AES encryption and decryption, SHA-256, HMAC, etc.). The keys for these operations or the intermediate values are stored in registers internal to the cryptographic core. These internal registers are in the Memory Mapped Input Output (MMIO) space and are blocked from access by software and other untrusted agents on the SoC. These registers are accessible through the debug and test interface.", "Example_Code": [{"@Nature": "Bad", "@Language": "Other", "#text": "In the above scenario, registers that store keys and intermediate values of cryptographic operations are not cleared when system enters debug mode. An untrusted actor running a debugger may read the contents of these registers and gain access to secret keys and other sensitive cryptographic information."}, {"@Nature": "Good", "@Language": "Other", "#text": "Whenever the chip enters debug mode, all registers containing security-sensitive data are be cleared rendering them unreadable."}]}, {"Intro_Text": {"xhtml:p": ["The following code example is extracted from the AES wrapper module, aes1_wrapper, of the Hack@DAC'21 buggy OpenPiton System-on-Chip (SoC). Within this wrapper module are four memory-mapped registers: core_key, core_key0, core_key1, and core_key2. Core_key0, core_key1, and core_key2 hold encryption/decryption keys. The core_key register selects a key and sends it to the underlying AES module to execute encryption/decryption operations.", "Debug mode in processors and SoCs facilitates design debugging by granting access to internal signal/register values, including physical pin values of peripherals/core, fabric bus data transactions, and inter-peripheral registers. Debug mode allows users to gather detailed, low-level information about the design to diagnose potential issues. While debug mode is beneficial for diagnosing processors or SoCs, it also introduces a new attack surface for potential attackers. For instance, if an attacker gains access to debug mode, they could potentially read any content transmitted through the fabric bus or access encryption/decryption keys stored in cryptographic peripherals.", "Therefore, it is crucial to clear the contents of secret registers upon entering debug mode. In the provided example of flawed code below, when debug_mode_i is activated, the register core_key0 is set to zero to prevent AES key leakage during debugging. However, this protective measure is not applied to the core_key1 register [REF-1435], leaving its contents uncleared during debug mode. This oversight enables a debugger to access sensitive information. Failing to clear sensitive data during debug mode may lead to unauthorized access to secret keys and compromise system security."]}, "Example_Code": [{"@Nature": "Bad", "@Language": "Verilog", "xhtml:br": [null, null, null, null], "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": [null, null], "xhtml:div": [{"@style": "margin-left:1em;", "xhtml:br": [null, null, null, null, null, null, null, null], "#text": "key_reg0[7],\n                        key_reg0[6],\n                        key_reg0[5],\n                        key_reg0[4],\n                        key_reg0[3],\n                        key_reg0[2],\n                        key_reg0[1],\n                        key_reg0[0]};"}, {"@style": "margin-left:1em;", "xhtml:b": ["key_reg1[7],", "key_reg1[6],", "key_reg1[5],", "key_reg1[4],", "key_reg1[3],", "key_reg1[2],", "key_reg1[1],", "key_reg1[0]};"], "xhtml:br": [null, null, null, null, null, null, null, null]}], "xhtml:b": "assign core_key1 = {", "#text": "assign core_key0 = debug_mode_i ? 'b0 : {"}, "#text": "module aes1_wrapper #(\n                  ...\n                  \n                  ...\n                  endmodule"}, {"@Nature": "Good", "@Language": "Verilog", "xhtml:br": [null, null, null, null], "xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": [null, null], "xhtml:div": [{"@style": "margin-left:1em;", "xhtml:br": [null, null, null, null, null, null, null, null], "#text": "key_reg0[7],\n                        key_reg0[6],\n                        key_reg0[5],\n                        key_reg0[4],\n                        key_reg0[3],\n                        key_reg0[2],\n                        key_reg0[1],\n                        key_reg0[0]};"}, {"@style": "margin-left:1em;", "xhtml:br": [null, null, null, null, null, null, null, null], "#text": "key_reg1[7],\n                        key_reg1[6],\n                        key_reg1[5],\n                        key_reg1[4],\n                        key_reg1[3],\n                        key_reg1[2],\n                        key_reg1[1],\n                        key_reg1[0]};"}], "xhtml:b": "debug_mode_i ? 'b0 :", "#text": "assign core_key0 = debug_mode_i ? 'b0 : { \n                     \n                     assign core_key1 =  {"}, "#text": "module aes1_wrapper #(\n                  ...\n                  \n                  ...\n                  endmodule"}], "Body_Text": "To address the issue, it is essential to ensure that the register is cleared and zeroized after activating debug mode on the SoC. In the correct implementation illustrated in the good code below, core_keyx registers are set to zero when debug mode is activated [REF-1436]."}]}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-2021-33080", "Description": "Uncleared debug information in memory accelerator for SSD product exposes sensitive system information", "Link": "https://www.cve.org/CVERecord?id=CVE-2021-33080"}, {"Reference": "CVE-2022-31162", "Description": "Rust library leaks Oauth client details in application debug logs", "Link": "https://www.cve.org/CVERecord?id=CVE-2022-31162"}]}, "Related_Attack_Patterns": {"Related_Attack_Pattern": [{"@CAPEC_ID": "150"}, {"@CAPEC_ID": "204"}, {"@CAPEC_ID": "37"}, {"@CAPEC_ID": "545"}]}, "References": {"Reference": [{"@External_Reference_ID": "REF-1435"}, {"@External_Reference_ID": "REF-1436"}]}, "Mapping_Notes": {"Usage": "Allowed", "Rationale": "This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.", "Comments": "Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.", "Reasons": {"Reason": {"@Type": "Acceptable-Use"}}}, "Content_History": {"Submission": {"Submission_Name": "Arun Kanuparthi, Hareesh Khattri, Parbati Kumar Manna, Narasimha Kumar V Mangipudi", "Submission_Organization": "Intel Corporation", "Submission_Date": "2020-02-12", "Submission_Version": "4.1", "Submission_ReleaseDate": "2020-02-24"}, "Modification": [{"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-08-20", "Modification_Version": "4.2", "Modification_ReleaseDate": "2020-08-20", "Modification_Comment": "updated Demonstrative_Examples, Description, Name, Related_Attack_Patterns, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-10-26", "Modification_Version": "4.13", "Modification_ReleaseDate": "2023-10-26", "Modification_Comment": "updated Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-07-16", "Modification_Version": "4.15", "Modification_ReleaseDate": "2024-07-16", "Modification_Comment": "updated Demonstrative_Examples, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Relationships, Weakness_Ordinalities"}], "Contribution": [{"@Type": "Content", "Contribution_Name": "Mohamadreza Rostami, Shaza Zeitouni, Ahmad-Reza Sadeghi", "Contribution_Organization": "Technical University of Darmstadt", "Contribution_Date": "2023-11-07", "Contribution_Comment": "suggested demonstrative example"}, {"@Type": "Content", "Contribution_Name": "Rahul Kande, Chen Chen, Jeyavijayan Rajendran", "Contribution_Organization": "Texas A&M University", "Contribution_Date": "2023-11-07", "Contribution_Comment": "suggested demonstrative example"}], "Previous_Entry_Name": {"@Date": "2020-08-20", "#text": "Sensitive Information Uncleared During Hardware Debug Flows"}}}
