TL;DR
BUGSTONE-E2E is an automated framework that transforms public CVE patch histories into executable, reusable bug-detection rules called "skills." By combining fast, deterministic AST filtering with LLM-guided verification and dynamic runtime validation, it creates a highly scalable, end-to-end pipeline capable of discovering, confirming, and repairing recurring vulnerabilities across multiple programming languages.
What Problem Does This Paper Address?
When a software vulnerability is fixed, the public record (CVE databases and fixing commits) contains a wealth of information detailing exactly what went wrong and how it was mitigated. Unfortunately, this data is structured for human review rather than automated reuse. Because traditional scanners require manual rule-authoring, identical or highly similar vulnerability patterns continuously reappear across different projects and languages.
While Large Language Models (LLMs) offer deep semantic reasoning to catch these flaws, deploying them repository-wide is prohibitively expensive and prone to false positives. The challenge lies in building a scalable pipeline that can automatically extract generalized security conditions from past patches, apply them efficiently at scale, and independently verify the findings without blindly trusting an LLM's judgment.
Methods
BUGSTONE-E2E addresses these challenges using a layered, funnel-shaped architecture that balances computational cost with the burden of proof:
- CVE-to-Skill Pipeline: The system mines historical CVEs, enriches their metadata, and isolates the specific security-relevant changes from unrelated refactoring in fixing commits. It extracts "scan anchors" (vulnerable APIs) and generalizes the flaw into an executable rule, consolidating related rules into CWE-family "skills."
- Rule-Driven Detection (Funnel Phase A & B):
- Phase A: Uses Tree-sitter to quickly index the target codebase and enumerate all call sites matching the skill's anchors—completely build-free and without LLM calls.
- Phase A.1: Applies lightweight, deterministic heuristics to filter out obviously benign sites.
- Phase B: Decomposes the remaining candidates into small, independent batches. An LLM agent evaluates each candidate against the rule's specific verification contract, returning a structured verdict with code evidence.
- Validation & Remediation (Phase C & D):
- Phase C: Surviving candidates are moved to an isolated dynamic execution environment (VM or container). An agent attempts to trigger the bug to capture concrete runtime evidence (e.g., AddressSanitizer violations, crashes, or controlled-sink signals).
- Phase D: For exploit-confirmed bugs, the system generates a patch and subjects it to a two-sided differential test: the exploit must fail on the patched code, but succeed again once the patch is reverted (ensuring the patch didn't simply break the build environment).
Datasets
The authors evaluated BUGSTONE-E2E using a massive dataset of 19,325 high-severity CVEs spanning from 2022 to 2026. From this corpus, the system successfully resolved and verified 2,710 unique open-source fixing commits to build its rule repository.
To test detection capabilities, the framework was deployed across 14 real-world open-source projects of varying sizes and languages, including massive codebases like FreeBSD, PyTorch, OpenSSL, WordPress, and ImageMagick.
Key Insights and Ideas
- The Power of the Funnel: Throwing LLMs at an entire codebase is a resource sink. By filtering candidates early using deterministic AST parsing (Phase A), BUGSTONE-E2E eliminates over 60% of candidates before any model is invoked.
- Small Models Can Scale Big: Because the framework decomposes complex repository-wide scanning into narrow, candidate-level tasks, cheaper models (like
gpt-5-mini) can achieve comparable or superior vulnerability coverage to frontier models at a fraction of the cost. - Trust, but Differentially Verify: LLM static analysis claims are treated merely as hypotheses. True validation requires a runtime marker (Phase C), and patch verification requires proving both the failure of the exploit post-patch and its success post-revert (Phase D). This prevents environment-setup errors from masking as successful fixes.
Key Results
BUGSTONE-E2E successfully synthesized 1,033 production rules across 56 CWE families, packaged into 172 deployable skills.
When evaluated against 14 production targets, the framework yielded impressive real-world utility:
- 2,933 deduplicated static findings were flagged by the LLM agents.
- 644 findings achieved definitive runtime validation, successfully triggering crashes or sanitizer reports.
- In a controlled head-to-head comparison on a rolled-back snapshot of wolfSSL, BUGSTONE-E2E achieved 52% recall, significantly outperforming prominent agentic baselines like Codex (34%) and Anthropic's defending harness (23%).
Limitations and Future Work
While highly effective, BUGSTONE-E2E is strictly bounded by its local anchor design. It targets vulnerabilities tied to specific API misuses or local data flows; it cannot detect global protocol state flaws, complex race conditions, or architectural design errors that lack a clear code-level anchor.
Additionally, dynamic validation (Phase C) relies heavily on the system's ability to automatically spin up reproducible build environments, which can fail on highly complex or poorly documented third-party dependencies. The authors note that future iterations will focus on expanding interprocedural context tracking and refining the remediation engine to generate more comprehensive, regression-free patches suitable for direct upstream maintainer approval.
Summary updated