arXiv:2611.09026cs.CRNov 2026

Manuscript Offprint

arXiv:2611.09026

Beyond a Single Commit: Anchor-Guided Reconstruction of Multi-Commit Patches

Jialiang Dong, Willy Susilo, Xu Gai, Liuhuo Wan, Chao Zhang, Elisa Bertino, Siqi Ma

Jialiang Dong*, Willy Susilo*, Xu Gai†, Liuhuo Wan*, Chao Zhang‡, Elisa Bertino§, and Siqi Ma*

  • University of Wollongong † University of International Relations ‡ Tsinghua University § Purdue University

Abstract—Vulnerability patch identification plays a critical role in software security by linking reported vulnerabilities and the corresponding fixes, enabling reliable vulnerability analysis, mitigation, and automated security tool development. As software systems evolve in complexity, vulnerability remediation has increasingly shifted from single-commit fixes to multi-commit fixing processes. Although many studies have been proposed to identify fixing commits associated with target vulnerabilities automatically, they often suffer from inaccurate semantic analysis or excessive workload for language models. These limitations reduce both the effectiveness and comprehensiveness of fixing commit identification.

To improve patch identification, we propose an effective and comprehensive patch identification framework, HARPOON, which not only enhances the accuracy of identifying individual fixing commits, but also investigates dependencies among commits to achieve comprehensive commit recognition for target vulnerabilities. Experimental results show that HARPOON significantly outperforms the state-of-the-art approaches. HARPOON successfully identified 895 vulnerability patches that were not previously maintained in public vulnerability databases. Among them, 663 are previously unrecorded fixes associated with 323 CRITICAL- or HIGH-severity vulnerabilities.

I. INTRODUCTION

With the widespread adoption and reuse of open-source software in modern software ecosystems, vulnerabilities in a single project can affect thousands or even millions of dependent applications. According to the 2025 OSSRA report [1], [2], 86% of commercial codebases contain open-source vulnerabilities, while 81% include HIGH- or CRITICAL-risk vulnerabilities. Due to the large volume of the report vulnerability, manually locating, verifying, and remediating all such vulnerabilities is often impractical for developers [3]. Hence, some vendors may employ vulnerability patch identification tools (e.g., Snyk [4]) to search for potential patch recommendations or rely on the patches maintained by the vulnerability repositories (e.g., NVD [5], Debian [6]) to support remediation. Consequently, patch retrieval has become a fundamental task for supporting effective and efficient real-world vulnerability remediation, requiring both high accuracy and comprehensive patch coverage.

As modern software systems become increasingly complex, such complexity has made vulnerability remediation an inherently iterative and ad-hoc process [7]. This causes accurately and comprehensively identifying vulnerability patches challenging because real-world vulnerability remediation often involves more than one fixing commit. To recognize

the fixing commits of a target vulnerability, existing works commonly utilize three types of approaches — semantic-based description analysis, large language model (LLM) reasoning, and hybrid analysis. Semantic-based description analysis [8]–[11] identifies fixing commits through semantic matching between vulnerability descriptions and code changes. However, real-world vulnerability descriptions and commit messages may be incomplete or inaccurate, which can mislead semantic analysis by insufficient vulnerability information and superficial semantic similarities. To enhance semantic understanding, LLM-based reasoning [12] has been proposed to leverage the reasoning capabilities of LLMs for analyzing commit messages and code changes. Nonetheless, when numerous commits are involved in vulnerability remediation, LLMs struggle to process them effectively, leading to accumulated reasoning errors in large projects with long commit histories. Although hybrid analysis [13] is also proposed by combining semantic analysis with LLM reasoning, it remains insufficient for overcoming the inherent limitations of semantic analysis and LLM reasoning.

To fill this gap, we propose an effective and comprehensive patch identification approach, HARPOON, to reconstruct the patch for remediating a target vulnerability. Given that a project repository may contain hundreds to millions of commits, and a single commit may involve multiple purposes (e.g., bug fixing, vulnerability remediation, or functionality changes [14]), directly analyzing all commits is inefficient and prone to noise. Therefore, HARPOON first performs anchor commit filtering to identify anchor fixing commits, namely, commits that are highly likely to be involved in remediating the target vulnerability. For vulnerability remediation, two distinct scenarios are often involved: 1) similar vulnerabilities may be distributed across different locations in a project, requiring similar remediation logic; 2) complex vulnerabilities may require multiple fixing commits to fully resolve the underlying security issue, HARPOON accordingly employs two strategies — coverage-completion and dependency reconstruction, to recover fixing commits that potentially contribute to the complete remediation process. Using the anchor fixing commits as the references, HARPOON then identifies candidate commits that share similar remediation patterns with the anchor commits or have direct/indirect dependency relationships with them. Finally, HARPOON performs an LLM-based refinement to understand the underlying intent of candidate commits and filter out those that exhibit different remediation intents despite sharing semantic similarities or dependency relationships with the anchor commits.

We built a real-world vulnerability-patch benchmark dataset comprising 1,207 vulnerabilities. Of these, 1,019 were remediated by a single fixing commit (denoted as single-commit patches), while 188 required multiple fixing commits over different time periods (denoted as multi-commit patches). We assessed the effectiveness and comprehensiveness of HARPOON in identifying patches by applying it to the vulnerability-patch benchmark and comparing its performance against four state-of-the-art approaches. The results show that HARPOON substantially outperforms state-of-the-art approaches for both single-commit and multi-commit patch identification, achieving an F1 of 93.02% and 75.08%, respectively, while the best state-of-the-art approach, Prospector, only achieves 90.85% and 55.21%, respectively. HARPOON also demonstrates strong efficiency, reducing the median processing time from 130 seconds achieved by the state-of-the-art approach to only 40 seconds. We further applied HARPOON to an in-the-wild dataset and identified 323 previously undocumented patches for CRITICAL- or HIGH-severity vulnerabilities, which were subsequently reported to CVE, Debian Security, and GHSA. Our evaluation shows that 44.58% of these vulnerabilities require multi-commit patches for complete remediation, indicating that the identification of a single fixing commit is insufficient for recovering the vulnerability remediation process. Among the identified multi-commit patches, nearly half (48%) are completed within one week, whereas 13% take longer than one month to complete.

References (38)