CDCL(Crypto) SAT solvers for cryptanalysis

Saeed Nejati, Vijay Ganesh

TL;DR

CDCL(Crypto) is a new framework that moves away from using SAT solvers as "black boxes" for breaking encryption. By injecting domain-specific cryptographic knowledge directly into the solver's internal logic via programmatic callbacks, the authors achieved significant speedups and improved scalability in attacking hash functions like SHA-256.

What Problem Does This Paper Address?

Modern cryptanalysis often relies on Boolean Satisfiability (SAT) solvers. The standard "blackbox" approach involves translating a cryptographic problem (like finding a hash collision) into a massive formula of logic gates (CNF) and letting a general-purpose solver find a solution.

However, this approach has two major flaws:

  1. Semantic Loss: When you translate high-level math (like addition or rotation) into raw logic gates, the solver loses track of the "big picture" properties, such as commutativity.
  2. Explosive Size: To ensure the solver can actually "reason" effectively, the resulting CNF files become gargantuan, often becoming too large for even the best solvers to handle efficiently.

The authors ask: Can we create a solver that "understands" cryptography while it searches for a solution?

Methods

The authors introduce CDCL(Crypto), a framework inspired by the CDCL(T) paradigm used in Satisfiability Modulo Theories (SMT) solvers. Instead of just feeding the solver a static file, they use a Programmatic SAT architecture. This allows the solver to "call back" to specialized C++ code during the search process.

Key components include:

  • Programmatic Propagation: While the solver is assigning values to variables, the custom crypto-code monitors the process. If it sees an implication that the raw logic gates missed (e.g., "if these inputs are X, the output must be Y"), it injects a "reason clause" to steer the solver in the right direction.
  • Programmatic Conflict Analysis: If the solver makes a set of assignments that are mathematically impossible according to the rules of the cryptographic primitive (like SHA-256), the custom code identifies this conflict immediately and forces the solver to backtrack, preventing it from wasting time on "spurious" solutions.
  • Implementation: The framework was built on top of MapleSAT, a high-performance solver. They specifically disabled certain preprocessing steps (like variable elimination) to ensure the custom code could always map internal Boolean variables back to high-level cryptographic bits.

Datasets

The paper evaluates the framework using two primary "benchmarks" in cryptanalysis:

  1. Algebraic Fault Attack (AFA): Targeting SHA-1 and SHA-256. This involves simulating hardware faults to leak secret information.
  2. Differential Cryptanalysis: Specifically focused on finding collisions in round-reduced versions of SHA-256 (up to 25 rounds).

Key Insights and Ideas

  • The "Lazy" vs. "Eager" Trade-off: Standard SAT encoding is "eager" (put everything in the formula upfront). CDCL(Crypto) is "lazy"—it keeps the initial formula small and only adds complex logic (via callbacks) when the solver actually needs it during the search.
  • Directional Consistency: One of the biggest hurdles in SAT-based crypto is ensuring that information flows correctly from inputs to outputs. Programmatic propagation ensures "directional consistency" without needing a massive, complex CNF encoding.
  • Domain Knowledge as a Shortcut: By checking partial assignments against the actual hash function logic, the solver can reject invalid paths thousands of steps earlier than a standard blackbox solver would.

Key Results

The results demonstrate that "teaching" the solver about cryptography pays off:

  • Efficiency in Attacks: In Algebraic Fault Attacks on SHA-256, the framework recovered secret bits using only 48 faults, a significant improvement over previous methods.
  • Speedups: For finding collisions in 25-round SHA-256, CDCL(Crypto) was approximately 2.3x faster than the standard MapleSAT solver using the same encoding.
  • Scalability: The framework successfully solved instances with 25 rounds that the baseline solver struggled to complete within a 24-hour time limit.

Limitations and Future Work

  • Manual Implementation: Currently, the "cryptographic reasoning" must be manually coded in C++ for each specific primitive (e.g., one set of rules for SHA-256, another for AES).
  • Clause Management: Adding too many "reason clauses" during the search can eventually clutter the solver's memory. While the authors used MapleSAT’s built-in deletion strategies to manage this, it remains a delicate balance.
  • Future Directions: The authors suggest automating the generation of these programmatic components and applying the framework to a wider variety of symmetric encryption schemes and block ciphers.

Summary updated

BibTeX
@inproceedings{nejati2019cdcl,
  author = {Saeed Nejati and Vijay Ganesh},
  title = {{CDCL(Crypto) SAT solvers for cryptanalysis}},
  booktitle = {CASCON},
  year = {2019},
  url = {https://openreview.net/forum?id=WsuEVg3HDts},
}
Figure