TL;DR
This paper introduces a human-in-the-loop framework that uses Large Language Models (LLMs) to bridge the gap between natural-language protocol descriptions and formal security models. By introducing a structured, auditable Protocol Intermediate Representation (IR), the system allows users to verify and correct an LLM's semantic interpretation before generating complex formal code for tools like Tamarin.
What Problem Does This Paper Address?
Security protocols (like TLS or those used in blockchains) are notoriously difficult to design correctly. Even tiny flaws can lead to catastrophic breaches. Formal verification tools like Tamarin or ProVerif provide mathematical proofs of security, but they require expert-written formal models.
While LLMs are promising for "auto-formalization," they face a major hurdle: semantic faithfulness. An LLM might generate code that is syntactically perfect and compiles without error, yet completely misrepresents the intended protocol logic (e.g., swapping the order of a cryptographic check). For a non-expert, auditing thousands of lines of low-level formal code to find these subtle semantic errors is nearly impossible.
Methods
The authors propose a workflow centered on a Protocol IR that serves as a "semantic checkpoint."
- IR Extraction: An LLM parses a natural-language description into a structured IR. This IR explicitly captures high-level concepts: roles, fresh values (nonces), message structures, cryptographic checks, and security goals.
- Confidence-Guided Review: The system calculates a "confidence score" for each IR field based on three signals:
- Evidence: Does the source text directly support this claim?
- Consistency: Does this field contradict other parts of the model (e.g., using a value before it’s generated)?
- Semantic Impact: How much would an error here break the security proof?
- Interactive Interface: A UI highlights high-risk fields, guiding the user to audit the LLM's "draft" semantics rather than raw code.
- Model Synthesis & Repair: Once the user confirms the IR, the system automatically generates SAPIC+ code (a high-level language for Tamarin). If Tamarin finds syntactic errors, the system attempts an automated repair that preserves the user-approved semantics.
Datasets
The framework was evaluated on two main sets of data:
- Standard Benchmarks: 18 classic and modern security protocols, including NSPK, Naxos, EDHOC, KEMTLS, and SSH.
- Non-standard Cases: Three real-world security scenarios described via platform documentation rather than formal sequences: MCP session hijacking, GitHub Actions artifact provenance, and AWS external-ID delegation.
The authors tested the system using several LLMs, including DeepSeek V4 Pro, GPT-4o, GPT-5.5, and Llama-3.3-70b.
Key Insights and Ideas
- Syntax is solved, Semantics is the frontier: The authors found that modern LLMs are quite good at generating valid code syntax, but they frequently hallucinate protocol logic. The IR forces the LLM to "show its work" in a way humans can actually check.
- The "Modeling Contract": By reviewing the IR, the human and the AI establish a "contract" of what the protocol means. The subsequent code generation is then treated as a systematic translation of that contract.
- Prioritizing Human Attention: Not all fields deserve equal scrutiny. By calculating "Semantic Impact," the system ensures users spend their limited time checking critical items like compromise assumptions and cryptographic checks rather than descriptive labels.
Key Results
- GPT-5.5 Excellence: GPT-5.5 achieved near-perfect semantic accuracy on the IR cells and successfully verified 14 out of 18 benchmark protocols with virtually zero manual edits.
- Efficiency Gains: For complex protocols like KEMTLS, the IR allowed users to catch subtle errors—such as grouping multiple messages into a single unprotected "flight"—that would have been invisible in the final generated code.
- Expertise Reduction: The framework allows users who are not formal-methods experts to produce trustworthy models. Instead of writing Tamarin code, they act as "editors" for the LLM's semantic draft.
- Repair Capabilities: The system successfully distinguished between syntactic repairs (fixing code bugs) and semantic repairs (which require going back to the user), preventing the AI from "cheating" to make a proof pass by weakening the security model.
Limitations and Future Work
- Source Dependency: If the original natural-language description is ambiguous or missing critical details, the LLM (and the user) may still produce an incomplete model.
- Translator Trust: While the IR is auditable, the current IR-to-SAPIC+ translator is not itself formally proven. A bug in the translator could still introduce errors.
- Future Directions: The authors plan to add a "back-translation" step where the LLM compares the final generated model against the original description to flag any discrepancies or missing steps introduced during the coding phase.
Summary updated