[Paper Review] Extracting and Verifying Cryptographic Models from C Protocol Code by Symbolic Execution
This paper presents a fully automatic, computationally sound method to verify weak secrecy and authentication in C implementations of cryptographic protocols by extracting symbolic models via symbolic execution and verifying them with ProVerif. The approach requires no pre-existing protocol specification or manual annotations, enabling verification of low-level C code with pointers and dynamic memory, limited to single execution paths.
Consider the problem of verifying security properties of a cryptographic protocol coded in C. We propose an automatic solution that needs neither a pre-existing protocol description nor manual annotation of source code. First, symbolically execute the C program to obtain symbolic descriptions for the network messages sent by the protocol. Second, apply algebraic rewriting to obtain a process calculus description. Third, run an existing protocol analyser (ProVerif) to prove security properties or find attacks. We formalise our algorithm and appeal to existing results for ProVerif to establish computational soundness under suitable circumstances. We analyse only a single execution path, so our results are limited to protocols with no significant branching. The results in this paper provide the first computationally sound verification of weak secrecy and authentication for (single execution paths of) C code.
Motivation & Objective
- To close the gap between formal protocol verification and actual C implementations by enabling direct verification of C code without pre-existing specifications.
- To define computational security properties directly for C source code, ensuring formal soundness with respect to cryptographic models.
- To develop an automatic, scalable method that extracts high-level protocol models from C code with pointers and dynamic memory manipulation.
- To ensure the extracted models preserve security properties under computational soundness, enabling verification with existing tools like ProVerif.
- To support legacy and non-memory-safe C code by explicitly verifying memory safety during model extraction.
Proposed method
- Symbolically execute the C program using bitstring-valued symbolic variables to over-approximate memory states, enabling analysis of all possible execution paths.
- Translate the symbolic execution traces into an intermediate language abstracting away low-level memory operations and destructive updates.
- Apply algebraic rewriting to transform the extracted model into a process calculus representation compatible with ProVerif.
- Use computational soundness results from prior work to link symbolic verification in ProVerif to computational security definitions in the C program.
- Compile C code into a simple stack-based intermediate language (CVM) using CIL to simplify symbolic execution and ensure correctness of compilation.
- Restrict analysis to single execution paths to manage complexity, while still supporting dynamic memory allocation and pointer arithmetic.
Experimental results
Research questions
- RQ1Can we formally define security properties (e.g., weak secrecy and authentication) directly for C source code, without relying on a pre-existing protocol specification?
- RQ2How can we automatically extract a high-level protocol model from C code with pointers and dynamic memory, preserving security semantics?
- RQ3Is the symbolic execution-based model extraction sound with respect to computational security definitions?
- RQ4Can existing protocol verification tools like ProVerif be used to verify security properties of the extracted model with computational soundness?
- RQ5What are the limitations of the approach when applied to C code with complex control flow, and how can they be mitigated?
Key findings
- The method enables the first computationally sound verification of weak secrecy and authentication for single execution paths in C code, without requiring protocol specifications or manual annotations.
- The symbolic execution engine uses bitstring-valued symbolic variables, allowing analysis of messages of unknown or variable length, unlike prior tools that treat each byte separately.
- The model extraction process preserves security semantics, and the resulting model is simplified into a form that is directly verifiable by ProVerif.
- The approach supports C code with pointers and dynamic memory allocation, explicitly verifying memory safety during extraction.
- The method is limited to non-branching code paths, but this restriction is sufficient for many authentication protocols that are inherently non-branching.
- The framework provides actionable feedback upon verification failure by exposing symbolic execution traces with source code locations, aiding debugging.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.