OSV Reproducer
A Python package for reproducing OSS-Fuzz bugs listed by OSV (Open Source Vulnerabilities) as vulnerabilities.
Description
OSV Reproducer is a tool that helps security researchers and developers reproduce vulnerabilities reported in the OSV database. It provides a simple CLI that takes an OSV-ID, fetches the vulnerability data, and reproduces the bug in a containerized environment.
The tool automates the following workflow:
- Fetch OSV record by ID
- Extract metadata (project name, vulnerable commit, fixed commit, etc.)
- Retrieve OSS-Fuzz artifacts (test case, issue report)
- Prepare the versioned environment (clone repository at specific commit)
- Build and run the vulnerable version with the test case
- Verify if the test case crashes the program and matches the issue report
- Build and run the fixed version with the test case
- Verify if the fix addresses the vulnerability
Installation
pip install osv-reproducer
Usage
OSV Reproducer provides two main commands:
reproduce: Reproduces a vulnerability by building the vulnerable version and running it with the test caseverify: Verifies if a fix addresses a vulnerability by building the fixed version and running it with the test case
Basic Usage
# Reproduce a vulnerability
osv-reproducer -oid OSV-2023-XXXX reproduce
# Verify a fix
osv-reproducer -oid OSV-2023-XXXX verify
Options
# Required arguments
-oid, --osv_id Identifier of the vulnerability in the OSV database (e.g., OSV-2023-XXXX)
# Optional arguments
-v, --version Show version information
-vb, --verbose Enable verbose output
-o, --output-dir Directory to store output artifacts (default: ./osv-results)
--build-extra-args Additional build arguments to pass to the fuzzer container as environment variables
Format: 'KEY1:VALUE1|KEY2:VALUE2'
Examples
# Reproduce a vulnerability with verbose output and custom output directory
osv-reproducer -vb -o ~/path/to/results/OSV-2023-1276 -oid OSV-2023-1276 reproduce
# Verify a fix with verbose output and custom output directory
osv-reproducer -vb -o ~/path/to/results/OSV-2023-1276_fix -oid OSV-2023-1276 verify
# Reproduce with additional build arguments
osv-reproducer -vb -o ~/path/to/results/OSV-2021-1361 -oid OSV-2021-1361 --build-extra-args "CFLAGS:-Werror,-Wunused-but-set-variable|CXXFLAGS:-Werror,-Wunused-but-set-variable" reproduce
Workflow
graph TD
A[Input: OSV-ID] --> B[Fetch OSV Record]
B --> C[Extract Metadata]
C --> D[Retrieve OSS-Fuzz Artifacts]
D --> E[Prepare Versioned Environment]
subgraph Reproduction Mode
E --> F[Build Vulnerable Version]
F --> G[Run Test Case]
G --> H[Verify Crash]
end
subgraph Verification Mode
E --> I[Build Fixed Version]
I --> J[Run Test Case]
J --> K[Verify No Crash]
end
Architecture
OSV Reproducer is built using the Cement framework and follows a modular architecture with handlers for different functionalities:
- BuildHandler: Builds Docker images and runs containers for fuzzing projects
- DockerHandler: Provides core Docker functionality
- GCSHandler: Interacts with Google Cloud Storage to retrieve project snapshots
- GithubHandler: Interacts with GitHub repositories to retrieve commits
- OSSFuzzHandler: Interacts with OSS-Fuzz to retrieve issue reports and test cases
- OSVHandler: Interacts with the OSV API to retrieve vulnerability records
- ProjectHandler: Manages project information and initialization
- RunnerHandler: Reproduces crashes and verifies them
This modular approach allows for flexibility in how core behaviors are implemented or swapped out, even at runtime or by user command-line options.
Requirements
- Python 3.8+
- Docker
- Internet connection (to access OSV database, GitHub, and Google Cloud Storage)
License
Apache License 2.0
Metadata
Release files for osv-reproducer 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| osv_reproducer-0.0.9.tar.gz | 52.5 kB | Without provenance | Details for osv_reproducer-0.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| osv_reproducer-0.0.9-py3-none-any.whl | Python 3 | none | any | Details for osv_reproducer-0.0.9-py3-none-any.whl |
Total release size: 112.8 kB
Release files / osv_reproducer-0.0.9.tar.gz
| Download URL | osv_reproducer-0.0.9.tar.gz |
|---|---|
| Size | 52.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a1217feb984aa0087aabbf981fc71bad15842d31f70167a25fac16bf32eeab96
|
|
BLAKE2b-256 checksum How to use checksums |
89cf0099f65b74276e2923a9f2553a46c05801db75e7c3103264c4317b9baee0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.7
|
Release files / osv_reproducer-0.0.9-py3-none-any.whl
| Download URL | osv_reproducer-0.0.9-py3-none-any.whl |
|---|---|
| Size | 60.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3a8daa0bc1322079aae8652e54260bc79719dc8407fcb4d8de8f4d6a8146b66
|
|
BLAKE2b-256 checksum How to use checksums |
552af61db532c97eefe890a8db621b64d98cdbfe953e9ac1068cf607bdbcbdcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.7
|
Security for osv-reproducer 0.0.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.