TrojanSpec-Bench: Adversarial Specification Elicitation in AI-Assisted Formal Verification
Mohammad Zeeshan · Team ParityAI
Submitted to The Secure Program Synthesis Hackathon. Sprint projects are early-stage work by participants, not Apart Research publications.
TrojanSpec-Bench is the first benchmark to treat the natural-language-to-specification elicitor in AI-assisted formal verification as a Dolev-Yao adversary. We release 1,024 verifier-admitted trojan triples across Dafny, Lean 4, and Verus, spanning four attack patterns anchored in real disclosed libcrux bugs. Our SpecGuard detector decomposes a coarse LLM faithfulness judgment into four atomic Yes/No criteria and flags when at least two fail. It lifts F1 from 0.871 to 0.967 over the consensus baseline, holds 1.000 recall, and flags only 3 of 100 honest Lean Mathlib lemmas. Against the ICSE 2026 MutDafny baseline on Dafny it reaches F1 0.992 versus 0.530.

Reviews
Aligning natural language with formal specifications is a challenging yet crucial task. This work safeguards the specification generation process using multiple validation criteria. Leveraging this feedback to iteratively refine specifications represents a promising direction for future work. Although our approach effectively filters out trivial specifications, its overall soundness still relies on the underlying model's reasoning capabilities. However, in the context of specifications, soundness is generally a more critical concern than completeness, as completeness can be relatively easily achieved by combining multiple sound specifications.
Finding "trojans" in specs is an emerging and serious concern for AI generated specs. The hackathon led to a dataset which is likely valuable beyond this competition. Some thoughts about what next: (a) the architecture is quite simple (four one-shot critics), that's fine if the benchmarking is the main aim because we need to know what works; but what about more advanced architectures? (b) is there chance to target the actual libcrux bugs?
Cite this project
@misc{zeeshan2026trojanspecbench,
title = {{TrojanSpec-Bench: Adversarial Specification Elicitation in AI-Assisted Formal Verification}},
author = {Mohammad Zeeshan},
year = {2026},
month = may,
note = {Submitted to The Secure Program Synthesis Hackathon, an Apart Research Sprint},
howpublished = {\url{https://apartresearch.com/sprints/projects/trojanspecbench-adversarial-specification-elicitation-in-aiassisted-formal-verification-bv46}},
url = {https://apartresearch.com/sprints/projects/trojanspecbench-adversarial-specification-elicitation-in-aiassisted-formal-verification-bv46}
}More from The Secure Program Synthesis Hackathon
- View project: Vibe-Coding Specs: Eliciting, Editing, and Verifying Specifications for AI Coding Agents
Vibe-Coding Specs: Eliciting, Editing, and Verifying Specifications for AI Coding Agents
Lida Safety
Specifications for real systems do not exist as one-shot artifacts: the user's intent emerges as they discover edge cases, rewrite drafts, and react to failing tests. We present an iterative pipeline that takes this …
- View project: AgentSpecGap
AgentSpecGap
solo-team
This prototype extracts rules from system prompts, tool descriptions, and runtime config. Rules are classified into one of interface validation, authorization check, workflow ordering validation, runtime validation, …
- View project: SpecGap Arena
SpecGap Arena
Obligation Cartographers
SpecGap Arena is a benchmark and framework that exposes how incomplete specifications let plausible but incorrect code pass public tests. It synthesizes missing semantic obligations (security boundaries, invariants, …