CryptoBAPBinary analysis for cryptographic protocols

How it works

Architecture

CryptoBAP is an end-to-end toolchain. It lifts machine code to an intermediate representation, instruments it with leakage contracts, symbolically executes it to obtain event and observation traces, and translates those traces into Sapic+ for analysis with Tamarin, ProVerif and DeepSec.

Pipeline

Six stages, fully automated

Each stage has a defined input and output, so the chain can be inspected — or re-targeted — at any point.

  1. Reverse-engineer

    Ghidra

    The selected region of the target binary is disassembled and recovered as assembly code, including for closed-source executables.

  2. Transpile to BIR

    HolBA

    Assembly is lifted into BIR, a verified binary intermediate representation, giving a machine-checked semantics for the code under analysis.

  3. Instrument

    Scam-V

    The BIR program is instrumented with a leakage contract that makes the attacker’s observations explicit — constant-time, or Spectre-PHT-style speculation.

  4. Symbolically execute

    Crypto-aware engine

    The instrumented program is executed symbolically to collect event and observation traces, resolving indirect jumps and summarising bounded loops.

  5. Extract the model

    Sapic+

    Traces are simplified using live-variable analysis and translated into a Sapic+ process, a model of every execution path through the region.

  6. Verify

    Tamarin · ProVerif · DeepSec

    The resulting model is discharged to established protocol verifiers, covering both trace properties and observational equivalence.

Leakage contracts

Making the attacker’s view explicit

A leakage contract states exactly what an attacker observes while the program runs. Changing the contract changes the threat model without changing the binary or the protocol model.

Constant-time

Architectural

The attacker observes the sequence of control-flow decisions and the addresses of memory accesses. This captures classic cache and branch-timing channels: any secret-dependent branch or secret-derived address becomes visible.

Spectre-PHT

Speculative

The attacker additionally observes execution along mispredicted conditional branches. This captures speculative leakage, where the transient path touches data the architectural path never would.

Back ends

Three verifiers, two classes of property

Tamarin

Unbounded verification of trace properties, with support for stateful protocols and equational theories.

ProVerif

Automated analysis in the applied pi-calculus for secrecy, authentication and observational equivalence.

DeepSec

Decision of trace equivalence for a bounded number of sessions — the tool of choice for unlinkability and privacy.

Foundations

Composition across languages

Real protocol stacks are not written in a single language. CryptoBAP builds on a symbolic execution semantics that supports parallel composition of labelled transition systems over different atomic types. By treating the Dolev–Yao model itself as a symbolic abstraction, the approach removes the need to translate between bitstrings and Dolev–Yao terms at every language boundary.

  • Composition of symbolic labelled transition systems with deduction combiners
  • CSP-style parallel composition of concrete labelled transition systems
  • A refinement linking symbolic to concrete semantics
  • Framework instantiation for BIR and Sapic, with correctness proofs in HOL4

Evaluation

What the case studies showed

  1. 01

    An instruction-cache side channel in WhatsApp Desktop enabling social-graph inference.

  2. 02

    Unlinkability issues in the BAC e-passport protocol reproduced under microarchitectural observations.

  3. 03

    Forward secrecy verified, and a known clone attack on post-compromise security identified, from models extracted out of the binary.

  4. 04

    Security properties verified for WireGuard, TinySSH, RPC-enc, RPC, NSL, CSur, simple Hash and simple XOR.

The CCS 2023 platform targets ARMv8 and RISC-V machine code and verifies weak secrecy and authentication; the CCS 2026 work adds leakage contracts and side-channel analysis.