Finding logic bugs without general-purpose bug oracles
Overview
Logic bugs—software behaviors that violate implicit invariants rather than causing explicit crashes—are notoriously difficult to detect because they lack the universal "bug oracles" (such as memory sanitizers) used for memory safety issues. Anthropic has demonstrated that large language models (LLMs) can effectively bridge this tooling gap by reasoning about code intent and invariants. Their research shows that simple agentic workflows, such as autonomous code review, significantly outperform complex, specialized setups like LLM-driven fuzzing or symbolic execution.
Methodology: Benchmarking Logic Bug Discovery
To evaluate the effectiveness of LLMs in finding logic bugs, the researchers constructed a benchmark of 21 historical, patched logic bugs from open-source projects including SQLite, zstd, brotli, and image-png. The experiments were conducted in two primary settings:
- Blind Setting: The model received only the unpatched source code and had to infer the violated invariants autonomously.
- Informed Setting: The model was provided with the specific invariant violated by the bug, testing its ability to generate a proof-of-concept (PoC) input once the intent was known.
Each technique was tested three times, with models allowed to submit up to 1,000 potential inputs per run. Success was measured by whether the submitted input triggered a behavioral difference between the unpatched and patched versions of the code.
Comparison of Detection Techniques
The study compared four distinct methods for leveraging LLMs in bug discovery:
- Agentic Code Review: An LLM agent is given direct access to the codebase and the ability to execute test inputs. This approach proved to be the most effective, as it allows the model to reason about program behavior and form hypotheses without being constrained by fixed heuristics.
- Informal Correctness Proofs: The agent is tasked with writing a natural-language proof document detailing the code's invariants. Any claims that cannot be verified are converted into test inputs, effectively surfacing bugs.
- LLM-driven Symbolic Execution: An agent generates harnesses for a symbolic execution engine. This method proved less effective because it relies on the engine's fixed strategies and SMT solver heuristics, which often fail to capture the context required for logic bugs.
- LLM Oracles for Fuzzing: The agent generates assertions to guide a fuzzer. Similar to symbolic execution, this method is limited by the fuzzer's reachability and the predefined instrumentation, often failing to find bugs unless the LLM essentially performs the discovery during the setup phase.
Key Findings and 0-Day Discoveries
Simplicity consistently outperformed complexity. Agentic code review and informal correctness proofs achieved the highest rediscovery rates, while more rigid, tool-heavy approaches often failed to find bugs autonomously. Furthermore, newer models (Claude Mythos generation) showed a marked improvement in hypothesis generation compared to earlier versions, suggesting that autonomous bug discovery will continue to improve as model reasoning capabilities scale.
Beyond the benchmark, the researchers used these methods to discover several previously unknown 0-day vulnerabilities:
- Caliptra (CVE-2026-11835): A time-of-check-to-time-of-use (TOCTOU) bug in the silicon root of trust firmware update flow.
- macOS (CVE-2026-43783): A privilege escalation vulnerability in
DesktopServicesHelperthat allowed unprivileged users to take ownership of system files. - Rust Compiler: Multiple type safety issues, including a bug where the compiler accepted code that accessed invalid memory, potentially enabling type-confusion exploits.
- eBPF (CVE-2026-98041): A soundness bug in the Linux kernel verifier caused by incorrect handling of 32-bit vs. 64-bit pointer comparisons, allowing for local privilege escalation.
Implications for Security Teams
Security teams should shift their focus toward agentic workflows for logic bug detection. Because LLMs can reason about program semantics and developer intent, they provide a scalable alternative to manual code review for identifying non-memory-safety vulnerabilities. The researchers recommend that defenders prioritize applying agentic code review and informal correctness proofs to their codebases before investing in specialized, rule-based tooling.