๐Ÿ”ฅ Fixing Real Vulnerabilities in Production Code

PatchAgent

A Practical Program Repair Agent Mimicking Human Expertise

Zheng Yu, Ziyi Guo, Yuhang Wu, Jiahao Yu, Meng Xu, Dongliang Mu, Yan Chen, Xinyu Xing

USENIX Security 2025 ยท Northwestern University & University of Waterloo

Real-World Impact

Fixing critical vulnerabilities in popular open-source projects

assimp โญ 11.4k
3D model loading library - Fixed heap overflow & null dereference vulnerabilities
libssh2 โญ 1.4k
SSH2 client library - Fixed critical security vulnerability
PcapPlusPlus โญ 2.8k
Network packet parsing library - Fixed multiple heap overflow vulnerabilities
libredwg โญ 1.0k
AutoCAD DWG file library - Fixed use-after-free vulnerability
HDF5 โญ 0.6k
High-performance data format - Fixed heap overflow vulnerabilities
92.13%
Success Rate
178
Real-world Vulnerabilities
9
Bug Types Supported
30
Programs Tested

Abstract

Automated program repair (APR) techniques aim to triage and fix software bugs autonomously. Recent advancements in large language models (LLMs) have shown promising results when applied to APR, especially on patch generation. However, without effective fault localization and patch validation, APR tools specialized in patching alone cannot handle a more practical end-to-end setting.


We introduce PATCHAGENT, a novel LLM-based APR tool that seamlessly integrates fault localization, patch generation, and validation within a single autonomous agent. PATCHAGENT employs a language server, a patch verifier, and interaction optimization techniques to mimic human-like reasoning during vulnerability repair.

Key Features

How PatchAgent mimics human expertise

๐Ÿ”

Fault Localization

Uses Language Server Protocol for accurate code navigation and identifying buggy code snippets

๐Ÿ› ๏ธ

Patch Generation

Leverages LLMs to generate context-aware patches that fix vulnerabilities without breaking functionality

โœ…

Patch Validation

Automated verification ensures patches resolve issues without introducing new bugs

๐Ÿง 

Human-like Reasoning

Four optimization techniques to elevate LLM capabilities to expert-level performance

๐Ÿ”„

Iterative Refinement

Learns from failed attempts and improves patches through counterexample feedback

๐Ÿš€

Production Ready

Successfully deployed to fix vulnerabilities in popular open-source projects

Citation

To cite PatchAgent in your research

@article{PatchAgent,
  title     = {PatchAgent: A Practical Program Repair Agent Mimicking Human Expertise},
  author    = {Yu, Zheng and Guo, Ziyi and Wu, Yuhang and Yu, Jiahao and 
               Xu, Meng and Mu, Dongliang and Chen, Yan and Xing, Xinyu},
  booktitle = {34rd USENIX Security Symposium (USENIX Security 25)},
  year      = {2025}
}