Skip to main content
Writing
·AI Paper Reviewauto·9 min read

Automated Template-free Synthesis of Instruction-Centric Leakage Contracts for Black-Box CPUs

Microarchitectural side-channel attacks such as Spectre, Meltdown, and speculative execution exploits have proven that the clean abstraction of the Instruction Set Architecture (ISA) is fundamentally broken.

Paper: Automated Template-free Synthesis of Instruction-Centric Leakage Contracts for Black-Box CPUsElvira Moreno, Tiziano Marinaro, Ryan Williams, et al. (arXiv)

Generated by my automated review pipeline and spot-checked before publication — how it works.

Contents

Image generated by AI

TLDR

  • What: malcos is the first template-free, black-box synthesis tool that automatically extracts instruction-centric microarchitectural leakage contracts from commercial CPUs without requiring RTL access or pre-defined clause templates.
  • Who's at risk: Cryptographic libraries and high-assurance software (e.g., secret-dependent implementations or secure enclave runtimes) executing on modern x86 and ARM CPUs where undocumented microarchitectural optimizations violate traditional "constant-time" security assumptions.
  • Key number: malcos achieves 100% soundness relative to its test suites and up to 100% precision on commercial CPUs, outperforming state-of-the-art template-based white-box tools whose precision drops to as low as 18% on complex microarchitectural leak profiles.

Microarchitectural side-channel attacks such as Spectre, Meltdown, and speculative execution exploits have proven that the clean abstraction of the Instruction Set Architecture (ISA) is fundamentally broken. To write secure software, developers of cryptographic libraries or secure enclaves rely on the "constant-time" programming model. This model assumes that execution time and cache behavior are independent of secret data.

However, modern commercial CPUs feature undocumented hardware-level optimizations—such as register file compression, silent stores, and data-dependent execution-unit short-circuits—that silently leak secret data. Traditionally, characterizing these leaks required chip designers with white-box access to Register-Transfer Level (RTL) designs to manually construct formal "leakage contracts" (specifications of what a CPU leaks).

This research introduces malcos (MicroArchitectural Leakage COntract Synthesizer), a framework that automatically extracts these leakage contracts directly from commercial black-box CPUs (such as Intel's Raptor Lake or ARM's Cortex-A76) without needing RTL access or hand-crafted templates.


Threat Model

Attacker A microarchitectural observer capable of monitoring side channels, such as execution timing (via RDTSCP) or cache states (via P+P or Flush+Reload).
Victim Secure software (e.g., cryptographic implementations, enclave-shielded applications) running on commercial off-the-shelf (COTS) CPUs.
Goal Synthesize a formal, instruction-centric leakage contract that precisely maps architectural execution states to microarchitectural leakage traces, allowing developers to identify data-dependent leaks.
Budget Black-box access to physical hardware. Relies on relational fuzzing or symbolic execution to generate test cases and hardware trace observations.

Background & Problem Setup

A leakage contract (defined by Guarnieri et al. [28]) formalizes the leakage behavior of a processor by mapping an ISA-level program execution to a sequence of formal observations (a leakage trace).

Prior contract synthesis frameworks were severely limited. They operated under a white-box model, requiring access to the processor’s RTL, and relied on user-provided templates to constrain the synthesis search space. If a leak was not explicitly accounted for in the manual template (for instance, a multiplication unit that short-circuits on 0 or 1), the synthesis tool would fail to capture it or over-approximate the leak, rendering the contract highly imprecise.

Comparison of Leakage Contract Synthesis Approaches

Dimension RTL2\muPath [32], VeloCT [20] LeaSyn [60], Mohr et al. [40] malcos (This Work)
CPU Access Required White-Box (RTL Design) White-Box (RTL Design) Black-Box (Physical CPU)
Target Scale Small open-source RISC-V cores Small open-source RISC-V cores Commercial Intel & ARM CPUs
Synthesis Method Template-based (User-provided) Template-based (User-provided) Template-free (Solver-guided)
Contract Granularity Coarse-grained (Safe/Unsafe labels) Fine-grained (Arithmetic/Cache leaks) Fine-grained (Instruction-centric)
Soundness Sound w.r.t. RTL specs Misses leaks if template is limited Boundedly sound w.r.t. tests

Methodology

malcos uses a Counterexample-Guided Inductive Synthesis (CEGIS) loop that alternates between two key phases: a Relational Leakage Testing Phase (the Checker) and a Contract Refinement Phase (the Refiner).

   +-------------------------------------------------------+
   |                                                       |
   v                                                       |
+------------+  (Programs, Initial States)  +------------+ |
|  Checker   |----------------------------->| Black-Box  | |
| (Revizor/  |<-----------------------------|  Hardware  | |
|  Scam-V)   |      (Hardware Traces)       +------------+ |
+------------+                                             |
   |                                                       |
   | (Counterexamples & Positive Examples)                 |
   v                                                       |
+------------+                                             |
|  Refiner   |---------------------------------------------+
| (Rosette)  | (Generates New Leakage Clauses)
+------------+
   |
   | (No New Leaks Found)
   v
+-----------------------+
| Contract Minimization | ===> Precise Instruction-Centric Contract
+-----------------------+

Step 1: Relational Leakage Testing (Checker)

malcos runs test programs on the target CPU to identify discrepancies between the current candidate contract (cand) and actual hardware execution:

  • Counterexamples (cexs): A pair of initial states (σ1,σ2)(\sigma_1, \sigma_2) for program pp that yield identical leakage traces under the current contract cand, but produce distinguishable hardware traces on the CPU. This signals an unmodeled leak.
  • Positive Examples (pexs): A pair of initial states (σ3,σ4)(\sigma_3, \sigma_4) that produce identical traces on both the contract and the hardware. These are critical to preventing the synthesizer from over-approximating the leak (e.g., assuming an entire instruction is unsafe when only a specific operand value of 0 leaks).

For x86, malcos integrates with Revizor [45], a black-box relational fuzzer. For ARM, it uses Scam-V [42], which leverages symbolic execution to validate contracts.

Step 2: Contract Refinement (Refiner)

The Refiner translates the newly discovered counterexamples and positive examples into a syntax-driven synthesis task using the Rosette [52] solver-aided language.

The synthesizer solves for a new leakage clause cli:=ex IF prcl_i := ex \text{ IF } pr (where exex is the expression of the leaked data and prpr is the activation predicate) under the following constraints:

  1. Instruction-Centric Scope (Hard Constraint):

cl_i = (? \text{ IF } \text{REG}[PC] = ? \wedge ?)

2.LeakCapture(HardConstraint):2. **Leak Capture (Hard Constraint)**:

\bigvee_{(p, \sigma, \sigma') \in cexs} CTR(cl_i, p, \sigma) \neq CTR(cl_i, p, \sigma')

3.PrecisionMaximization(SoftConstraint):3. **Precision Maximization (Soft Constraint)**:

\max \left( |{(p, \sigma, \sigma') \in cexs \mid CTR(cl_i, p, \sigma) \neq CTR(cl_i, p, \sigma')}| + |{(p, \sigma, \sigma') \in pexs \mid CTR(cl_i, p, \sigma) = CTR(cl_i, p, \sigma')}| \right)

Once a PC-specific clause is synthesized, `malcos` generalizes it across the ISA by replacing the specific Program Counter value with a meta-predicate matching the corresponding instruction type (opcode, operand types, and access modes). ### Step 3: Minimization & Post-Processing After the CEGIS loop terminates, `malcos` minimizes the accumulated contract by sorting clauses by precision and iteratively pruning redundant clauses. As Section 4.5 describes, any clause that does not uniquely contribute to distinguishing the collected counterexamples is permanently removed. --- ## Key Results ### 1. Synthetic Validation Against Ground-Truth Models `malcos` was evaluated against five simulated contract models representing known hardware leaks: Constant-Time (`ct`), Tag Index (`TagIdx`), Register File Compression (`RFC`), Multiplication Simplification (`mul`), and Silent Store (`SilStore`). The impact of the minimization phase on contract precision is shown below (reproducing data from Tables 1 and 2 in Section 6): | Contract Model | `malcos-x86` Precision (With Minimization) | `malcos-x86` Precision (Without Minimization) | `malcos-arm` Precision (With Minimization) | `malcos-arm` Precision (Without Minimization) | |---|---|---|---|---| | **`ct`** | 1.0 (100%) | 0.70 (70%) | 1.0 (100%) | 0.51 (51%) | | **`TagIdx`** | 0.79 (79%) | 0.14 (14%) | 1.0 (100%) | 0.50 (50%) | | **`RFC`** | 1.0 (100%) | 0.30 (30%) | 1.0 (100%) | 0.50 (50%) | | **`mul`** | 1.0 (100%) | 0.20 (20%) | 1.0 (100%) | 0.50 (50%) | | **`SilStore`** | 1.0 (100%) | 0.13 (13%) | 1.0 (100%) | 0.58 (58%) | *Note: Soundness was 100% (1.0) across all configurations, confirming that no observed leaks were missed.* ### 2. Comparison to Template-Based State-of-the-Art `malcos` was compared against template-based white-box synthesis tools (`LeaSyn` \[60\], `RTL2\muPath` \[32\], and `VeloCT` \[20\]) on complex synthetic targets. The results demonstrate the penalty of rigid template restrictions (extracted from Table 4, Section 6): | Synthesis Target | `malcos-x86` Precision | `LeaSyn` Precision | `RTL2\muPath` Precision | `VeloCT` Precision | |---|---|---|---|---| | **`Ibex-small`** | 1.0 (100%) | 1.0 (100%) | 0.99 (99%) | 0.99 (99%) | | **`Ibex-mult-div`** | 1.0 (100%) | 1.0 (100%) | 0.68 (68%) | 0.68 (68%) | | **`Ibex-optimizations`**| **0.89 (89%)** | 0.57 (57%) | 0.37 (37%) | 0.32 (32%) | | **`Ibex-slice`** | **0.73 (73%)** | 0.41 (41%) | 0.36 (36%) | 0.18 (18%) | On the highly complex `Ibex-slice` model, template-based tools fall as low as 18% precision due to over-approximating leaks, whereas `malcos-x86` maintains a precision of 73% by dynamically generating fine-grained clauses. ### 3. Real Hardware Results (Section 6.5) `malcos` successfully synthesized leakage contracts directly from commercial CPUs: - **Intel (Skylake, Raptor Lake, Arrow Lake, Lunar Lake)**: Extracted precise clauses representing data-cache leaks (exposing load/store addresses), control-flow leaks (exposing PC on jump instructions), and division-by-zero timing discrepancies (exposing the dividend value when the divisor is zero). - **ARM (Cortex-A72, Cortex-A76)**: Synthesized exact clauses showing cache tag and index leakage (bits 6–12) for memory instructions, alongside multi-register load/store pair operations (`LDP`, `STP`). --- ## Limitations & Open Questions While `malcos` is a significant step forward, several limitations persist: 1. **Bounded Soundness**: The contract is only guaranteed to be sound with respect to the capabilities of the underlying Checker (Revizor or Scam-V). If the relational fuzzer fails to generate a test case that triggers a specific hardware state, `malcos` will not capture the resulting leak (leading to a false negative). 2. **Stateful Microarchitectural Leaks**: `malcos` synthesizes *instruction-centric* contracts. It cannot model complex, stateful microarchitectural leaks that span multiple instructions, such as speculative execution bypasses, computation reuse buffers, or operand packing. 3. **Privileged Space Exclusion**: Relational testing tools do not currently support privileged instructions. Consequently, leaks originating from OS-level operations (e.g., page table walks, kernel-space context switching) are outside the scope of the synthesized contracts. --- ## What Practitioners Should Do If you are a security researcher, compiler engineer, or cryptographer trying to enforce constant-time execution on modern hardware, implement the following steps: 1. **Stop Relying on Naive Constant-Time Checkers**: Standard tools that check only control-flow and memory accesses (e.g., traditional static analysis) miss hardware-specific data-dependent optimizations. Integrate relational fuzzers like **Revizor** (for x86) into your hardware validation pipelines to detect hardware-dependent leaks dynamically. 2. **Leverage the Synthesized Clauses to Write Assertions**: Use the fine-grained clauses produced by `malcos` to write static assertions within cryptographic libraries. For instance, if `malcos` synthesizes `cldiv := OP_VAL(1) IF OPCODE = div and OP_VAL(0) = 0`, ensure that your compiler inserts sanitization barriers to guarantee divisor operands are never close to zero when processing secret data. 3. **Configure Compiler Mitigations**: For commercial deployments on Intel, enable compiler flags that disable or bypass optimizations known to leak data (e.g., speculative store bypass control, often mitigable via compiler-inserted serialization instructions like `LFENCE` or system-level configuration such as the `ssbd` patch). --- ## The Takeaway `malcos` demonstrates that extracting precise, mathematically formal microarchitectural leakage models from black-box commercial CPUs is highly practical. By replacing hand-crafted templates with inductive synthesis via Rosette, this work removes the need for proprietary RTL designs and enables developers to systematically discover how modern, highly optimized CPUs leak cryptographic keys. --- ## Den's Take Claims of "100% soundness" warrant skepticism, and `malcos` carries the standard academic caveat: this soundness is strictly "relative to its test suites." If fuzzing or test generation misses a subtle execution state, the synthesized leakage contract will still have blind spots. The most notable contribution is the practical utility of bypassing white-box RTL requirements. Reaching up to 100% precision on commercial black-box CPUs like Intel Raptor Lake and ARM Cortex-A76—while prior white-box, template-based approaches plummeted to as low as 18% precision on complex profiles—is a substantial advance. For teams hardening cryptographic libraries or enclave runtimes, relying on undocumented hardware assumptions is a recipe for disaster. This automated, template-free approach to contract generation mirrors the philosophy of automated microarchitectural security verification, where automated synthesis is a scalable way to bypass the bottleneck of manually writing security rules and validation tests. Commoditizing black-box contract synthesis would let the field stop treating CPU microarchitecture as an opaque, trust-on-faith black box. This is exactly the kind of rigorous, tooling-first research the hardware security space needs.

Share

Comments

Page views are tracked via Google Analytics for content improvement.