Knowledge is Power

Sitewide Search

Search Bare Metal Cyber

Search courses, individual lessons, wiki entries, books, podcasts, magazine articles, Daily Cyber News, and Darwin.

MITRE D3FEND™ Learning Center

D3-CFI — Control Flow Integrity

Enforcing legal control flow transfers during application process execution.

1Parent technique
5Related artifacts
3Source references

Harden · D3FEND ontology 1.6.0 · Active

Open official technique ↗
Official D3FEND definition

Definition

Enforcing legal control flow transfers during application process execution.

Official D3FEND knowledge-base content

How it works

Control flow integrity (CFI) restricts the destinations of control flow transfer instructions---particularly indirect function branches such as indirect function calls, jumps, and returns---such that execution can only proceed along paths determined to be valid at compile-time or load-time.

CFI is typically implemented by instrumenting a program during compilation or binary rewriting. A control flow graph is constructed that defines the legitimate targets for each indirect control flow transfer. At runtime, before an indirect branch is taken, a check is performed to ensure that the target address is a member of the allowed target set. If the check fails, a defensive response such as process termination or exception handling is triggered.

Implementations vary in granularity and enforcement mechanism:

By preventing execution from jumping to attacker-controlled or unintended code locations, CFI mitigates a wide range of exploitation techniques, including return-oriented programming (ROP), jump-oriented programming (JOP), and function pointer overwrite attacks.

  • Compiler-based CFI inserts runtime checks that validate indirect call targets against type or signature-based constraints.
  • Operating system–assisted CFI maintains a bitmap or table of valid indirect call targets and verifies them at runtime before allowing execution to continue.
  • Hardware-assisted CFI enforces control flow integrity using architectural features such as shadow stacks and specific CPU instructions.

Considerations

While control flow integrity significantly raises the bar for control flow hijacking attacks, several considerations affect its effectiveness:

CFI is most effective when combined with complementary defenses such as stack canaries, memory safety checks, address space layout randomization (ASLR), and hardware-backed memory protections.

  • Granularity trade-offs: coarse-grained CFI allows larger target sets and may permit some unintended control flow paths, while fine-grained CFI offers stronger guarantees at the cost of performance and complexity.
  • Performance overhead: runtime checks or hardware enforcement may introduce execution overhead, particularly in applications with frequent indirect branches.
  • Compatibility limitations: some legacy code patterns, dynamic code generation, or just-in-time (JIT) compilation workflows may require special handling or reduced CFI enforcement.
  • Data-only attacks: CFI does not prevent attacks that manipulate program behavior without altering control flow, such as logic corruption or data-oriented programming.
  • Bypass techniques: if an attacker can redirect execution to a valid but unintended target within the allowed control flow graph, exploitation may still be possible.
Bare Metal Cyber interpretation

Implementation perspective

Control Flow Integrity should be treated as a technical defensive capability rather than a product checkbox. In practice, teams should define the protected scope, the conditions under which the technique acts, and the observable evidence that demonstrates the intended behavior. For this technique, likely engineering context includes the relevant system, activity, and evidence sources.

Use the technique to increase the effort, prerequisites, or constraints an adversary must overcome before exploitation or misuse succeeds.

Questions to ask

  • Which component, configuration, credential, interface, or behavior is being hardened?
  • What secure baseline or policy defines the intended state?
  • How are exceptions approved, time-limited, and reviewed?
  • How is the hardened state verified after deployment and significant change?

Evidence and validation

  • Approved hardening standards and configuration baselines
  • Automated configuration or integrity assessment results
  • Exception records with owners, rationale, and expiration dates
  • Test results demonstrating that the intended restriction is enforced

Common failure patterns

  • A secure setting is documented but not enforced consistently across the environment.
  • Hardening breaks required functions and is permanently weakened through undocumented exceptions.
  • Teams measure deployment of a product rather than verification of the hardened condition.

This implementation perspective is original Bare Metal Cyber educational content. It does not replace the official D3FEND definition or establish that a specific product implements the technique.

Ontology hierarchy

Technique hierarchy

Direct child techniques

None listed at this level.

D3FEND graph relationships

Artifacts and ontology entities

These relationships describe how D3FEND connects a defensive technique to artifacts or other ontology entities. They describe graph semantics, not a product certification.

Explicit technique relationships

enforcesControl Flow Policy
monitorsCall Stack
monitorsShadow Stack
validatesControl Flow Graph
validatesMemory Address
Source record

Authoritative sources