TL;DR
Researchers have developed CacheS, a novel static analysis tool that uses a specialized "Secret-Augmented Symbolic" (SAS) domain to detect cache-based side channels in binary code. By precisely tracking program secrets while coarsely approximating public data, CacheS achieves the scalability needed to analyze real-world cryptosystems like OpenSSL, discovering 54 previously unknown information leaks.
What Problem Does This Paper Address?
Cache-based side channels are a persistent threat to cryptographic implementations. By observing patterns in how a program accesses the CPU cache, an attacker can infer sensitive information like private keys. For example, if a memory access address depends on a secret bit, an attacker might see different cache lines being loaded depending on that bit's value.
Detecting these leaks is notoriously difficult. Dynamic analysis (testing the program with specific inputs) often fails to provide full code coverage. Traditional static analysis, like symbolic execution, struggles to scale to large, complex libraries because it tries to model every possible program state in exhaustive detail, leading to "state explosion." The challenge is to find a method that is simultaneously precise, provides full coverage, and is scalable enough for production-grade software.
Methods
The authors propose a technique based on Abstract Interpretation, a framework for approximating program semantics. The core innovation is the Secret-Augmented Symbolic (SAS) domain.
Instead of tracking every variable's value precisely, SAS differentiates between "secrets" and "public" information:
- Fine-grained tracking for secrets: Program secrets (like key bits) are represented by unique symbols ($s_i$). The analysis tracks how these secrets propagate through computations with high precision.
- Coarse-grained tracking for public data: All non-secret, public information is lumped into a single symbol ($p$). This drastically reduces the number of states the analyzer needs to track, enabling it to scale to hundreds of thousands of instructions.
The tool, CacheS, follows a multi-step workflow:
- Reverse Engineering: It lifts x86 binary code into a platform-independent intermediate representation (REIL).
- Abstract Interpretation: It performs a context-sensitive, interprocedural analysis using the SAS domain to identify memory addresses that are "secret-dependent."
- Constraint Solving: For every secret-dependent access, it generates an SMT (Satisfiability Modulo Theories) formula. It then uses a solver (Z3) to check if different secret values can lead to accesses in different cache lines, based on a standard 64-byte cache line model.
To further optimize memory usage, CacheS uses a refined Program State Lookup Table that replaces complex logic formulas with more compact symbolic representations from the SAS domain.
Datasets
The researchers evaluated CacheS on several widely-used, real-world cryptographic libraries:
- Libgcrypt (versions 1.6.1 and 1.7.3)
- OpenSSL (versions 1.0.2f and 1.0.2k)
- mbedTLS (version 2.5.1)
These libraries were chosen because they are critical infrastructure for multi-purpose computers and embedded devices, and their modular exponentiation (RSA/ElGamal) and AES implementations are frequent targets for side-channel attacks.
Key Insights and Ideas
- Secret-Aware Abstraction: The "aha moment" is the realization that for side-channel detection, you don't need to know everything about the program's state. You only need to know how secrets affect memory addresses. By being "lazy" about public data, you gain massive scalability without sacrificing the precision needed to find leaks.
- Binary-Level Analysis is Essential: Analyzing binaries rather than source code allows for a "down-to-earth" modeling of cache behavior, as it captures the actual memory layout and instructions (like table lookups) that are often obscured at higher levels of abstraction.
- Symbolic Abstract Interpretation: Combining the formal rigor of abstract interpretation with the power of SMT solvers allows the tool to not just flag potential issues, but to provide concrete evidence (counter-examples) of how a leak occurs.
Key Results
- Discovery of New Leaks: CacheS identified 208 information leakage sites in total. Crucially, 54 of these were previously unknown to the research community, primarily in mbedTLS and newer versions of OpenSSL.
- High Scalability: The tool analyzed over 295,000 instructions across the test libraries in less than 0.5 CPU hours. Average peak memory usage was under 5 GB per case.
- High Precision: The analysis yielded only one false positive across all tests, demonstrating that the SAS domain's abstraction is highly effective.
- Real-World Impact: The authors reported their findings to library developers. OpenSSL developers confirmed the leaks and released patches to address them.
Limitations and Future Work
- "Soundy" Memory Model: To maintain speed, the current implementation uses a lightweight memory model that is not strictly sound (it may miss some edge-case aliases). The authors suggest exploring more rigorous memory models in the future.
- Implicit Information Flow: The current version focuses on explicit data flow. It does not yet handle "implicit" flows, such as when a secret value determines the number of times a loop runs, which can also leak information through timing.
- Alignment Modeling: The one false positive occurred because CacheS did not model a specific memory alignment countermeasure in OpenSSL. Future work could involve "lazy abstraction" to selectively increase precision for such public data when needed.
- Automatic Secret Identification: Currently, users must manually flag the location of secrets in the binary. Automating this process using techniques like cryptographic function identification is a promising next step.
Summary updated