arXiv:2609.05335cs.CRSep 2026

Manuscript Offprint

arXiv:2609.05335

The History Is the Detector: Executing CVE Patch History, End-to-End

Qiushi Wu, Kevin Eykholt, Youngja Park, Xiaokui Shu, Dhilung Kirat, Douglas Lee Schales, Ian Molloy

Abstract

Public vulnerability databases collect rich information about known software flaws, including their weakness types, affected components, and related patches. Additionally, fixing commits provide the exact code changes that removed these flaws. While these records capture why the original code was unsafe, they are documented mainly for human inspection rather than automated reuse. Consequently, the same unsafe conditions may still exist elsewhere in code with no known advisory, leaving much of this detection knowledge unused.

We present BUGSTONE-E2E, a framework that automatically transforms vulnerability history into executable detection rules and validates their findings. First, BUGSTONE-E2E mines reusable rules from verified fixing commits, capturing scan anchors, fix semantics, and CVE provenance and organize them by CWE and language. Second, detection follows a funnel-shaped pipeline; early stages process a large pool of candidates using lightweight analysis, while later stages apply increasingly capable and expensive models to a shrinking set of targets. Specifically, BUGSTONE-E2E first enumerates call sites matching rule anchors using Tree-sitter, then removes benign sites using lightweight heuristics without LLM calls. Next, LLM-based agents inspect the remaining candidates guided by the rule. Following this inspection, the system retriages surviving candidates and builds runtime verifications, and finally generates scope-checked patches that are validated via two-sided differential tests. Using 19,325 high-severity CVEs from 2022 to 2026, BUGSTONE-E2E identifies 2,710 fixing commits and constructs 1,033 detection rules across 56 CWE families, packaged into 172 skills. When applied across 14 programs, it produced runtime evidence for 644 findings. These results demonstrate that CVE history can be turned into an executable workflow, transforming past vulnerabilities to reproducible detection and repair.

1 Introduction

Modern vulnerability response leaves a detailed public record. Specifically, a CVE entry describes the affected behavior and severity, a CWE label identifies the underlying weakness class, and a fixing commit usually shows the code-level changes that mitigated the risk [17, 50]. For a human reviewer, these records explain what went wrong. However, they are of little use to automated scanners because the lessons embedded in a patch do not translate into detectors capable of searching the next codebase.

The missed opportunity. Many vulnerability patterns recur across projects and languages. For example, a command-injection fix may reveal that attacker-controlled data reaches a shell sink without proper quoting. Although API names and code structure may differ, the underlying security condition often remains the same. Prior work detects recurring vulnerabilities using known vulnerable code or patch-enhanced signatures [35, 82], while recent systems combine LLMs with retrieved vulnerability knowledge or program-analysis context [18, 38, 44]. VulGenie further extracts API security rules from Java security patches [14]. However, what remains missing is a general pipeline that transforms CVE fixes across various weakness classes and languages into reusable, executable rules, applies them at scale, and validates and repairs the findings they produce.

Key challenges. Turning these public vulnerability records into executable detectors raises three primary challenges. First, CVE records and patches vary widely in content, making it difficult to extract the precise components that can be reused for detection. The relevant security fixes may be buried in unrelated edits, poorly described, or tied to project-specific logic. A mining tool must therefore identify what made the original code unsafe and generalize that condition into anchors that can match the same flaw elsewhere. Second, this knowledge must be represented as an executable rule with sufficient context to distinguish vulnerable patterns from benign cases. For instance, a simple match on system, pickle. loads, or memcpy is too broad, whereas an overly specific signature risks missing the same vulnerability hidden behind a different wrapper or code structure. Third, these rules must scale efficiently to handle large codebases without incurring expensive analysis on every candidate. Static analyzers such as CodeQL and Semgrep scale well once suitable queries or rules exist [28, 62], but creating and maintaining such rules still requires manual efforts.

From detection to verified remediation. Solving the three challenges above remains insufficient for end-to-end vulnerability analysis. While a rule violation or plausible taint path identifies a potential vulnerability, it does not prove that the behavior is reachable or exploitable at runtime. A complete workflow therefore requires dynamic validation that produces concrete runtime evidence. Furthermore, it must support remediation by generating a feasible patch from the vulnerability evidence and program context, and then verifying that the patch removes the demonstrated behavior.

Our approach. BUGSTONE-E2E addresses this gap through a staged pipeline spanning four core phases (Phase A-D) that transitions seamlessly from reusable vulnerability knowledge to automated detection, runtime validation, and verified remediation. The system first mines known vulnerabilities from the cvelistv5 dataset, verifies their fixing commits, and synthesizes reusable rules containing scan_apis, buggy and fixed code patterns, a verification contract, and related source CVEs. The rules are grouped by CWE and language into modular bug detection skills.

For a target project, Phase A first indexes the codebase with Tree-sitter [69] and enumerates all call sites match rule anchors without using an LLM. Phase A then removes clearly benign candidates via deterministic checks. The remaining candidates are analyzed independently in Phase B, where an LLM-based agent uses the rule-specific verification contract to inspect taint flows, callers, guards, and sanitizers, finally returning a structured verdict accompanied by concrete code evidence. This funnel reduces the number of candidates before applying more expensive analysis and allows Phase B to run in parallel with cheaper models.

However, static evidence alone is insufficient for full vulnerability confirmation. After Phase B filters out most candidates, Phase C re-triages the small set of survivors and attempts to reproduce each one in an isolated, concrete execution environment. A finding gains definite runtime validation only when an expected runtime marker—such as a sanitizer report, crash, or controlled-sink signal—is observed, and only the subset with a working live proof-of-concept (PoC) is rated as CONFIRMED_EXPLOITABLE, separating non-exploitable flaws from those that could not be tested.

Finally, Phase D generates a minimal, scope-checked patch and verifies it against the runtime evidence produced in Phase C. The exploit must fail on the patched program. It then reverts the patch and confirms that the exploit succeeds again, preventing a broken build or environment from being accepted as a fix. Exploit- and test-based validation is increasingly used in recent literature to evaluate vulnerability repair and patch correctness [9, 26, 75]. However, unlike these existing settings, BUGSTONE-E2E begins with newly discovered findings that have no predefined PoC or validation environment. It must therefore construct the runtime evidence by itself and independently verify each critical artifact before accepting a patch.

Evidence. In this work, BUGSTONE-E2E surveys 19,325 high-severity CVEs from 2022 to 2026, enriches 5,902 unique open-source CVEs, and verifies 2,710 fixing commits. From these commits, it constructs 1,033 rules across 56 CWE families, packaged into 172 production bug detection skills. Across scans of 14 real-world projects, Phase B reports 2,933 deduplicated findings. Finally, Phase C successfully obtains runtime evidence for 644 of these findings, including AddressSanitizer (ASan [63]) violations and crashes.

This paper makes the following contributions:

• Vulnerability Rule Mining from CVE history: We design a general pipeline that surveys high-severity CVEs, verifies fixing commits, extracts each patch's vulnerable sink and fix semantics, and rejects cases that do not generalize.

• Cost-ordered Detection Rule Execution: Our CWE and language-specific rules carry scan anchors, buggy and fixed patterns, a verification contract, and source-CVE provenance, all packaged into modular deployable skills. This architecture leverages deterministic indexing and lightweight filters to absorb scale, allowing LLM-based agents to apply expensive semantic judgment only where a rule points.

• Oracle-driven End-to-End Workflow: Our system executes a batched re-triage and an environment-first exploit stage that separates “not exploitable” from “could not be tested”, and judges patches using a two-sided differential testing under a machine-checked output contract. We report empirical evidence for every pipeline phase and state what each result does not establish.

• Deterministic Decomposition for Scalability: In BUGSTONE-E2E, anchor enumeration and the application of a frozen filter are deterministic. Thus, we can split a very large candidate pool into bounded, independent batches grouped by rule and source file. Since the batches share no mutable execution state, the expensive LLM-based agentic stage can parallelize freely—even though candidates within a single batch are not statistically independent—resulting in high scalability.

References (83)