Introduction
Automated Program Repair (APR) has traditionally focused on functional correctness—ensuring that for a given input, a program produces the expected output. However, modern security requirements often involve hyperproperties, which govern the relationship between multiple execution traces. For instance, non-interference requires that a program's public outputs remain identical regardless of changes to secret inputs. Traditional APR tools, which analyze single traces in isolation, are ill-equipped to handle these "global" requirements.
This paper introduces HyRep, a novel APR framework designed specifically for hyperproperties. By combining symbolic execution with an iterative syntax-guided synthesis (SyGuS) loop, HyRep automatically generates patches that fix security vulnerabilities, such as information leaks, while preserving the original program's intended functionality.
The Challenge: Hyperproperties and the Triviality Trap
Hyperproperties are fundamentally different from standard properties because they cannot be verified by looking at a single execution. To detect a violation of non-interference, one must compare at least two traces. This "slippery" nature poses a significant challenge for automated repair.
A naive repair tool might satisfy a security property by simply neutralizing the program's behavior—for example, by forcing a function to always return "Access Denied." While this satisfies the security constraint (no information is leaked if the output is constant), it renders the program useless. The core challenge in hyperproperty repair is finding a solution that satisfies the security requirement while remaining "transparent"—that is, staying as close as possible to the original program's logic.
The HyRep Framework
The authors propose a multi-stage pipeline to address these challenges:
1. Symbolic Execution (SE)
HyRep begins by exploring the program's paths symbolically. This process generates a mathematical summary of how inputs relate to outputs and observable behaviors across all possible execution paths.
2. Constraint Generation
The security requirements, expressed in HyperLTL (a temporal logic designed for hyperproperties), are translated into a Syntax-Guided Synthesis (SyGuS) problem. This formulation asks the solver to find a code expression that fits a specific grammar and satisfies the logical constraints derived from the symbolic execution.
3. Transparent Repair
To avoid trivial fixes, HyRep introduces the concept of transparency. This adds a constraint requiring that the repaired program only deviates from the original behavior when a violation of the hyperproperty is otherwise unavoidable.
4. Iterative Synthesis Loop
Finding a perfectly transparent repair in a single step is often computationally prohibitive. HyRep employs an iterative approach: it first finds an initial valid repair and then repeatedly queries the solver for "better" versions that preserve more of the original program's behavior. This "squeezes" the solver toward an optimal, non-trivial patch.
Experimental Evaluation
The authors evaluated HyRep across several benchmark families representing diverse security and logic challenges:
- EDAS & REVIEWS: Systems leaking sensitive paper acceptance data or reviewer identities.
- CSRF: Scenarios involving cross-site request forgery.
- LOG & ATM: Privacy leaks where credentials or balances are exposed via logs or error messages.
- k-Safety & Functional Benchmarks: Standard verification instances and basic repair tasks from datasets like
AngelixandGenProg.
Key Results and Insights
The evaluation demonstrated that HyRep is both effective and efficient:
- Effectiveness: HyRep successfully repaired all five benchmark families, frequently producing the same "intuitive" fixes a human developer would implement.
- Performance: Most repairs were generated in under 20 seconds. Even the complex "REVIEWS" benchmark, which required reasoning over numerous paths and multiple iterations, was resolved in approximately 151 seconds.
- Scalability: The tool scales well with patch complexity, synthesizing patches with up to 11 AST nodes within 90 seconds.
- Loop Handling: Although the tool utilizes finite unrolling for loops, the resulting repairs often generalized to the full, infinite-state versions of the programs.
Limitations and Future Directions
While HyRep represents a significant step forward, several challenges remain. The reliance on symbolic execution leads to "path explosion" in larger codebases, limiting the tool's current applicability to programs of moderate size. Additionally, the framework currently requires manual fault localization; automating the identification of the "broken" lines for hyperproperties is a primary goal for future work. Finally, the quality of the repair is inherently tied to the provided SyGuS grammar, necessitating a balance between expressivity and search-space size.
Conclusion
HyRep demonstrates that combining symbolic reasoning with iterative syntax-guided synthesis is a powerful approach for repairing complex security properties. By prioritizing transparency, the framework ensures that patches are not only secure but also preserve the functional utility of the original software.
Summary updated