Safeguard
Application Security•

CWE-1313 Hardware That Lets Test or Debug Logic Activate at Runtime

Test and debug features reachable during normal operation can alter state and leak secrets. CWE-1313 with the MITRE CVEs and the boot-window fix.

Safeguard Security Team
4 min read

CWE-1313 is about test and debug features that stay live after the device is supposed to be in normal operation. During runtime, the hardware allows test or debug logic to be activated, which lets someone change the state of the hardware. That can alter the intended behavior of the system and allow alteration and leakage of sensitive data.

Test and debug features are powerful by design. They exist to see and change things normal operation forbids. That is precisely why they need a fence.

How it happens

MITRE explains that an adversary can take advantage of test or debug logic made accessible during normal operation to modify intended behavior. Two illustrations from the record:

  • An accessible test or debug mode may allow read and write access to any system data.
  • Error injection, a common test or debug feature, used during a transmit or receive operation on a bus, can modify data and produce an unintended message.

On the confidentiality side, a feature that gives access to secrets can compromise them directly.

So the feature itself is fine in the lab. The weakness is that the hardware lets it be turned on at the wrong time, by the wrong party, when the system is running for real.

The record lists two observed examples, both for processors:

  • CVE-2021-33150: a hardware processor allows activation of test or debug logic at runtime.
  • CVE-2021-0146: a processor allows activation of test or debug logic at runtime, allowing escalation of privileges.

What an attacker gains

The listed consequences are broad. They include reading and modifying memory, executing unauthorized code or commands, gaining privileges or assuming identity, and bypassing protection mechanisms. On the availability side they include crash, exit or restart, instability, and resource consumption of CPU, memory and other resources. Confidentiality, integrity and availability are all in scope.

The CVE above states the key result: escalation of privileges. Feature access that should belong to a trusted engineering context becomes available to whoever can trigger it.

How to find it

The record lists no detection methods. Work through these checks:

  1. Inventory every test and debug mode in the hardware, including error injection, scan access and any privileged modes that unlock them.
  2. For each, document how it is activated, who or what can activate it, and during which operating states.
  3. In a normal runtime state, attempt to activate each one from an untrusted context. Any success is a finding.
  4. Repeat the test after firmware updates, since configuration changes can reopen a window.

If you buy devices instead of designing them, ask the vendor how test and debug logic is disabled in production and keep an eye on advisories for the processors you deploy.

How to fix it

MITRE gives the same guidance at the architecture and design, implementation and integration stages: insert restrictions on when the hardware's test or debug features can be activated.

Its specific suggestions:

  1. In normal operating modes, the hardware's privileged modes that allow access to these features cannot be activated.
  2. Configure the hardware so it only enters a test or debug mode within a window of opportunity, such as during boot or the configuration stage.
  3. As a result, test and debug features and their associated modes are disabled during normal runtime operation.

The window idea is the practical core. Treat debug access as something that exists briefly at a controlled point and then closes, with no route to reopen it from software that is running normally.

Add to that a firm verification step. A restriction nobody tests is a hope. Write a test that tries to activate each feature after the window closes and fail the release if any succeeds.

Quick check

Why is error injection an example in the record?

It is a common test feature, and if usable during a bus transmit or receive operation it can modify data and produce an unintended message.

What is the window of opportunity approach?

Allow the device to enter test or debug mode only at a controlled point such as boot or configuration, and disable those modes during normal runtime.

What do the two CVEs in the record share?

Both describe processors that allow activation of test or debug logic at runtime, and one notes it allows escalation of privileges.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.