COMMON WEAKNESS ENUMERATIONIncomplete

CWE-1037

Processor Optimization Removal or Modification of Security-critical Code

The developer builds a security-critical protection mechanism into the software, but the processor optimizes the execution of the program such that the mechanism is removed or modified.

Abstraction

Base

Structure

Simple

Likelihood of Exploit

Low

Understand the problem

What is the problem?

The developer builds a security-critical protection mechanism into the software, but the processor optimizes the execution of the program such that the mechanism is removed or modified.

Root cause

How and when does the problem arise?

Lifecycle phase

Architecture and Design

Optimizations built into the design of the processor can have unintended consequences during the execution of an application.

Risk

What does successful exploitation lead to?

Bypass Protection Mechanism

Affected security scopes: Integrity

A successful exploitation of this weakness will change the order of an application's execution and will likely be used to bypass specific protection mechanisms. This bypass can be exploited further to potentially read data that should otherwise be unaccessible.

Defence

How is it prevented and fixed?

  • Follow secure coding guidelines for input handling and boundary checking.
  • Enforce strict security reviews and automated static analysis (SAST) checks.

Verification

How is it detected?

White Box

Opportunistic
In theory this weakness can be detected through the use of white box testing techniques where specifically crafted test cases are used in conjunction with debuggers to verify the order of statements being executed.

Although the mentioned detection method is theoretically possible, the use of speculative execution is a preferred way of increasing processor performance. The reality is that a large number of statements are executed out of order, and determining if any of them break an access control property would be extremely opportunistic.