Skip to content

Releases: cla7aye15I4nd/PatchAgent

v2.1.0

02 Dec 21:00
4d3b76b

Choose a tag to compare

What's Changed

  • Upgrade langchain dependencies to version 1.1.0 and refactor imports … by @cla7aye15I4nd in #9

Full Changelog: v2.0.2...v2.1.0

v2.0.2

25 Nov 21:18

Choose a tag to compare

Full Changelog: v2.0.1...v2.0.2

v2.0.1

25 Aug 16:37
ced48f6

Choose a tag to compare

Full Changelog: v2.0.0...v2.0.1

v2.0.0

26 Jun 21:22
544fc5f

Choose a tag to compare

What's Changed

Full Changelog: v1.1.0...v2.0.0

v1.1.0

30 Mar 17:47
fc96ee3

Choose a tag to compare

What's Changed

Full Changelog: v1.0.1...v1.1.0

v1.0.1

20 Mar 00:59
864a567

Choose a tag to compare

What's Changed

Full Changelog: v1.0.0...v1.0.1

v1.0.0

20 Mar 00:46
3e78da9

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: https://github.com/cla7aye15I4nd/PatchAgent/commits/v1.0.0

PatchAgent

Build Status
License
Python
Platform

Note

The original research repository is located at osf.io/8k2ac.
This repository is a production-focused fork dedicated to real-world bug fixing.

📋 Overview

PatchAgent is an LLM-based program repair agent that mimics human expertise to automatically generate patches for real-world bugs. It integrates:

  • Language Server Protocol: For accurate code navigation and analysis
  • Patch Verification: For ensuring correct and safe fixes
  • Interaction Optimization: To achieve human-like reasoning during vulnerability repair

🚀 Getting Started

Prerequisites

  • Python 3.12+
  • Docker (for OSS-Fuzz integration)
  • Git

Installation

# Pull the image
docker pull ghcr.io/cla7aye15i4nd/patchagent:latest

# Run the container
docker run -it --privileged ghcr.io/cla7aye15i4nd/patchagent:latest

Environment Configuration

Create a .env file based on the template:

cp .env.template .env
# Edit .env with your API keys and configuration

💻 Usage Example

PatchAgent can be used to repair real-world bugs. Here's a simple example to repair an OSS-Fuzz issue:

from patchagent.agent.generator import agent_generator
from patchagent.builder import OSSFuzzBuilder
from patchagent.task import PatchTask

# Initialize the task with a crash reproduction
patchtask = PatchTask(
    ["poc.bin"],                         # Proof of Concept file(s)
    "libpng_read_fuzzer",                # Name of the fuzz target
    OSSFuzzBuilder(
        "libpng",                        # Project name
        "/path/to/libpng",               # Source path
        "/path/to/oss-fuzz",             # OSS-Fuzz path
    ),
)

# Run the repair process
patchtask.repair(agent_generator(patchtask))

🛠️ Development Setup

For development, we recommend using the VS Code devcontainer:

  1. Install the VS Code Remote Development Extension
  2. Open the repository in VS Code
  3. When prompted, click "Reopen in Container"

This will set up a fully configured development environment with all the necessary tools.

🔧 Supported Languages and Sanitizers

Languages

  • C/C++
  • Java

Sanitizers

🏆 Fixed Vulnerabilities

Below is a sample of the vulnerabilities fixed by PatchAgent. More will be disclosed as responsible disclosure periods end.

Repository Stars Vulnerabilities
assimp 11.4k #5763, #5764, #5765
libssh2 1.4k #1508
hdf5 0.6k #5201, #5210
libredwg 1.0k #1061
Pcap++ 2.8k #1678, #1680

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

📞 Contact

For questions, bugs, or feature requests:

📚 Citation

To cite PatchAgent in scientific publications, please use:

@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}
}