Skip to main content

LLM Fuzz

AI-powered security testing framework for Python functions. Uses LLMs to analyze code, discover vulnerabilities, and generate targeted test cases.

Installation

From PyPI

pip install llm-fuzz

From Source

git clone https://github.com/yourusername/llm-fuzz.git
cd llm-fuzz
pip install -e .

Prerequisites

LLM Fuzz uses smolagents which supports multiple LLM providers through LiteLLM. You need to set up an API key for your chosen provider.

Supported LLM Providers

  • OpenAI (GPT-4, GPT-3.5, etc.)
  • Anthropic (Claude)
  • Google (Gemini)
  • Many others via LiteLLM

Setting Up API Keys

Before using llm-fuzz, export your API key:

# For OpenAI
export OPENAI_API_KEY="your-key-here"

# For Anthropic (Claude)
export ANTHROPIC_API_KEY="your-key-here"

# For Google (Gemini)
export GEMINI_API_KEY="your-key-here"

Quick Start

from llm_fuzz import llm_fuzz, FuzzConfig

# Your function to test
def divide(x, y):
    return x / y

# Wrapper for testing
def divide_wrapper(input_data):
    x = input_data.get("x", 1)
    y = input_data.get("y", 1)
    return divide(x, y)

# Configure and run fuzzer
config = FuzzConfig(
    model="gemini/gemini-2.5-flash",  # or "gpt-4", "claude-3-opus", etc.
    max_vulnerabilities=3,
    tests_per_vulnerability=2,
)

report = llm_fuzz(
    target_function=divide,
    test_function=divide_wrapper,
    config=config,
    fuzz_params=["x", "y"]
)

print(f"Tests: {report.passed_count}/{report.total_count} passed")
report.save_to_file("fuzz_report.json")

Configuration

FuzzConfig(
    model="gemini/gemini-2.5-flash",   # LLM model to use
    max_vulnerabilities=5,             # Number of vulnerabilities to discover
    tests_per_vulnerability=3,         # Test cases per vulnerability
    max_discovery_steps=15,            # Max steps for discovery
    temperature=0.1,                   # LLM temperature
    verbose=False                      # Enable verbose logging
)

Examples

See the examples/ directory:

Run the example:

export GEMINI_API_KEY="your-key"
python examples/simple_division.py

Testing

Run the test suite:

pytest

Metadata

Release files for llm-fuzz 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-fuzz 0.1.0
File Size Uploaded Provenance
llm_fuzz-0.1.0.tar.gz 14.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-fuzz 0.1.0
File Interpreter ABI Platform
llm_fuzz-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.4 kB

Release files / llm_fuzz-0.1.0.tar.gz

Download URL llm_fuzz-0.1.0.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
85cd88d4ecc97b73b6445e9b3d4a028ff118ca8d9a999bfd5a7bfaff574ab898
BLAKE2b-256 checksum
How to use checksums
0898c1b78ae2020428cf2a811d04d74ac3e6b7c543d9b04ef5b6e1f3da048d33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / llm_fuzz-0.1.0-py3-none-any.whl

Download URL llm_fuzz-0.1.0-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ddc81e129cd0fbd8f07b69646ebb072ceae3d2d0f2f2490b13802b5046db8b3
BLAKE2b-256 checksum
How to use checksums
cbb14a121106c58fcfeb9cf7aa2d5a077a94979cc47061996b43bea91e92337c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Security for llm-fuzz 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page