Abstract
Verifying API implementations is notoriously difficult because they lack a single entry point and support nearly infinite calling permutations. This paper introduces an automated framework that extracts "realistic" usage patterns from existing client code using abstract interpretation, synthesizes verifiable program fragments, and utilizes a human-in-the-loop refinement process to identify deep security vulnerabilities like integer underflows.
1. Introduction
In formal verification, APIs present a unique challenge. Unlike standalone programs with a fixed main() function, an API is a collection of tools that can be invoked in any order. Testing every possible combination is mathematically impossible; even a small API with 10 functions and a 6-call sequence generates over 150,000 permutations. Manual test suites, while standard, are expensive to maintain and often fail to cover the complex edge cases where security bugs hide. The authors propose bridging the gap between "complete non-determinism" (testing everything) and "complete determinism" (testing only known sequences) by focusing on the "realism spectrum."
2. Methodology
The authors propose a multi-stage pipeline designed to automate the generation of high-quality test cases.
2.1 Information Extraction via Abstract Interpretation
The tool analyzes a sample of existing client code to understand intended API usage. It identifies call ordering—specifically prefixes, suffixes, and pairs—and constant usage. This is achieved through abstract interpretation using specific domains for "Allowed" (union) and "Required" (intersection) sets of API calls.
The extraction process also captures relational ordering between functions. By treating existing code as a "hint" rather than a strict template, the tool can synthesize new, valid sequences that developers may not have explicitly written.
2.2 Synthesis and Verification
The system generates thousands of C program fragments that are realistic based on the extracted model but utilize non-deterministic inputs to explore edge cases. These fragments are then processed by the C Bounded Model Checker (CBMC), which checks for common vulnerabilities such as buffer overflows and arithmetic underflows.
2.3 Human-Guided Refinement
To address potential false alarms or spurious counterexamples, the framework incorporates a user-in-the-loop approach inspired by Counterexample-Guided Abstraction Refinement (CEGAR). Domain experts can refine the underlying model, teaching it to ignore impossible paths and improving the accuracy of subsequent synthesis rounds.
3. Evaluation and Results
The primary evaluation target was Google’s Brotli, a 14,000-line C implementation of a lossless compression algorithm. Brotli was chosen for its complexity and a known high-profile vulnerability (CVE-2016-1968) that led to remote code execution.
3.1 Performance and Vulnerability Discovery
The system demonstrated remarkable speed on a standard virtual machine:
- Information Extraction: 0.4 seconds.
- Synthesis of 1,000 fragments: 6 seconds.
The tool successfully identified the critical integer underflow in Brotli (CVE-2016-1968). The violated assertion found by the tool corresponded exactly to the patch released by Google to fix the exploit.
4. Conclusion and Future Work
By focusing on "realistic" sequences, the authors demonstrate that verification time can be used more effectively to find genuine bugs. While the current tool depends on initial seed code and manual refinement, future work includes implementing more complex abstract domains (such as interval domains) and integrating these features into the open-source CProver suite.
Summary updated