Continuous Verification for Signal Messenger
The last few months have brought a series of landmark mathematical results powered by a combination of AI and formal verification tools like Lean. This naturally raises the question of whether similar methods could be used to formally verify real-world software, so that we can preemptively eliminate entire classes of bugs before they can be exploited.
However, software is not exactly the same as math. In active projects, the code and its specifications keep evolving, to address bugs or add features, and verifying a snapshot of the codebase is not enough. Any “theorem” we prove about the software must be rechecked after every code change, and revised when necessary.
At pereq, we are working on new ways of combining our expertise in software and security verification with emerging capabilities powered by AI agents, so that we can help developers produce maintainable, high-assurance critical software at speed and at scale. In particular, we are building a suite of developer tools that provide enduring value to our customers:
-
Tools that can find and fix high-impact bugs early in the development workflow, by distilling developer knowledge into formal, testable specifications.
-
Verification frameworks that can continuously verify a codebase against its specifications, with automated correctness and security proofs at each code change.
-
An end-to-end toolchain that maintains specifications, code, and proof artifacts as they evolve, giving developers a deeper and wider perspective on their software.
One of our favorite current projects in this realm is our ongoing work on Signal Messenger. This month at the ACM Conference on Computer and Communications Security in The Hague, Rolfe Schmidt from Signal presented our joint paper on integrating formal verification into the protocol design and development workflow at Signal. This work is a collaboration between Signal, pereq, and CE Labs. For full details, read our paper or look at the verified code:
- Paper: A Formal Analysis of Signal’s Sparse Post-Quantum Ratchet Protocol and its Implementation. Karthikeyan Bhargavan, Maxime Buyse, Graeme Connell, Franziskus Kiefer, and Rolfe Schmidt. ACM CCS 2026. (Open Access)
- Code: SPQR: The Sparse Post Quantum Ratchet.
Automatic analysis of fast-changing code
The Signal development team uses our tooling from design to deployment to find and eliminate correctness and security bugs in their post-quantum protocol code. In the rest of this post, we describe what is new in this case study and how it fits with our vision.
Rolfe and his colleagues at Signal used the ProVerif tool to help design a new post-quantum ratcheting protocol called the Sparse Post-Quantum Ratchet (SPQR) with strong security guarantees. But once they started implementing the protocol, they wanted to know whether the Rust code they were writing was still faithful to the protocol.
The Rust code for SPQR looks quite different from the formal model. It incorporates state machines, error handling, and message serializers and deserializers; calls a real cryptographic library (libcrux); and handles integration with the rest of the Signal codebase. These implementation details are abstracted away in the formal ProVerif model.

To address this gap, Signal uses our hax toolchain to formally analyze their code in two ways. The diagram shows the verification workflow. The SPQR crate is translated by hax to F* for verifying runtime safety (e.g., “the code does not panic”) and a few correctness properties (e.g., “the Galois field arithmetic is implemented correctly”). The same Rust code is also translated to ProVerif and verified against its expected security guarantees (e.g., “the protocol provides forward secrecy and post-compromise security”). F* and ProVerif run at every code change, rechecking the verified parts of SPQR against their safety and security specifications.
Since hax 0.5, the ProVerif backend used in SPQR is available to all hax users. We encourage you to try it on your own code and get in touch if you have any questions or feedback.
Developer-driven specifications and proofs
The central philosophy behind hax is that different tools are effective for different verification tasks. Symbolic analysis tools like ProVerif are great for automatically finding logical flaws and attacks on protocol designs, and hax makes it possible to extend this analysis to Rust code. General-purpose proof frameworks like F* and Lean can be used to structure large correctness and security proofs, but they typically require more help and expertise from human (or AI) agents and are not particularly well-suited to finding and explaining protocol attacks.
The developer decides what properties they want to prove and which tools they wish to use to verify their code. The annotations are embedded as pre- and post-conditions within the Rust code and serve as both verification goals and documentation for developers as they read or modify the codebase. At Signal, the developers author the security specification in ProVerif and the safety contracts in Rust, relying on continuous integration (CI) to ensure that these properties do not regress.
In an age where code is increasingly written by AI, the role of the developer is shifting towards writing specifications and reviewing code. Our collaboration with Signal shows one effective way for developers to drive and own the specifications, with safety contracts written in a familiar language (Rust) and embedded within the reviewed code.
Proof repair and maintenance with AI
What happens when a proof no longer verifies, either because of a new specification or a new feature or an unrelated code change? With hax, detecting the proof breakage is completely automatic: the new code is translated to F* and ProVerif and verified. In many cases, the error message from ProVerif or F* is enough for the developer to understand whether they introduced a coding or specification bug.
In other cases, the tool may need some additional annotation to adapt the proof. Traditionally, finding the right fix for a complex proof was painstaking work for experts, so large proof projects like seL4, CompCert, and HACL* were carefully structured to make proof engineering easier and more predictable.
However, in the past few months, improvements in AI coding agents have made much of our proof repair automatic. We now routinely use Claude Code to repair, improve, and audit both the ProVerif and F* proofs for SPQR, with little or no manual proof editing. Indeed, our most recent proof upgrade, for hax 0.5, was entirely driven by AI agents, although the specifications and generated proofs were carefully reviewed by both the Signal developers and us.
From fixing bugs to continuous verification
Formal specifications serve as useful documentation and test oracles for code, and continuous verification can systematically prevent regressions, but one of the first questions about any formal analysis is whether it found any bugs. The answer is yes: using hax and F*, the Signal developers found and fixed several potential panics in the SPQR code as it evolved.
We found no security bugs in the SPQR code itself, but using hax and ProVerif, we recently found and fixed a potential weakness in the way SPQR was composed with the classic Double Ratchet. Indeed, it is in the composition of different protocol components that security bugs often appear. By working closely with developers, we were able to understand the cross-protocol assumptions better and use them to make our specifications more precise. However, note that we have only verified a small part of the full Signal codebase. A good target for future work is to verify that Signal’s components, composed together, deliver the security guarantees they promise.
Code never stops evolving, and neither do its specifications. With tools like hax and our upcoming product perspec, we aim to make building, verifying, and maintaining mission-critical software practical for all our clients.
For more information on how our tools can help you: