Skip to main content

PromptFuzz

Adversarial security testing for LLM applications.

Find prompt injection, jailbreak, and data extraction vulnerabilities before attackers do.

PyPI version Python 3.10+ License: AGPL-3.0 Tests


You ship an LLM-powered product. You add a system prompt. You think it's secure. It isn't. PromptFuzz finds out before your users do.

PromptFuzz fires 165+ real adversarial attack prompts — jailbreaks, prompt injections, data extraction attempts, goal hijacking, and edge cases — at your application and generates a professional vulnerability report in seconds.


Install

pip install promptfuzz

Optional extras:

pip install "promptfuzz[openai]"     # if your target uses OpenAI
pip install "promptfuzz[anthropic]"  # if your target uses Anthropic

Quick start

Wizard UI

Just run promptfuzz with no arguments:

$ promptfuzz

  PromptFuzz v0.1.0 — LLM Security Testing

  ? What is your target?
    > HTTP/HTTPS endpoint (URL)
      Python function (module:function)

  ? Enter target URL: http://localhost:8000/chat

  ? Select attack categories:
   ◉ data_extraction  — System prompt leaking, credential extraction
   ◉ injection        — Prompt override, delimiter attacks
   ◉ jailbreak        — Persona switches, DAN, roleplay bypasses
   ○ edge_cases       — Unicode, long inputs, encoding attacks
   ○ goal_hijacking   — Purpose redirection attacks

  ? Output format:
    > Terminal + HTML report  (report.html)

  ? Minimum severity to report:
    > low  (show everything)

  ─────────────────────────────────────────
  Target   : http://localhost:8000/chat
  Attacks  : 110  (data_extraction + injection + jailbreak)
  Output   : Terminal + report.html
  Severity : low+
  ─────────────────────────────────────────
  Press ENTER to start scan (Ctrl+C to cancel)

2. promptfuzz test — quickest way to run from the terminal

# Test any URL directly — no flags needed
promptfuzz test https://api.mychatbot.com/chat

# Save an HTML report
promptfuzz test https://api.mychatbot.com/chat --output report.html

# Test a local Python function
promptfuzz test myapp:chat_handler --categories jailbreak injection

# CI mode — exit code 1 if any high/critical vulnerability found
promptfuzz test https://api.mychatbot.com/chat --fail-on high

Sample terminal output:

Results

3. promptfuzz scan — full power CLI with config file support

promptfuzz scan --target http://localhost:8000/chat --output report.html
promptfuzz scan --config promptfuzz.yaml --fail-on high

3. Python API

from promptfuzz import Fuzzer

def my_chatbot(message: str) -> str:
    # your LLM call here
    return response

fuzzer = Fuzzer(
    target=my_chatbot,
    context="customer support chatbot",
    categories=["jailbreak", "injection", "data_extraction"],
)
result = fuzzer.run()
result.report()           # rich terminal output
result.save("report.html")  # HTML report

Testing a FastAPI endpoint

URL/Endpoint

PromptFuzz works with any HTTP endpoint that accepts POST requests. No code changes needed.

# your_app.py
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class ChatRequest(BaseModel):
    message: str

@app.post("/chat")
async def chat(req: ChatRequest):
    reply = your_llm_call(req.message)
    return {"response": reply}
# Start your app
uvicorn your_app:app

# Test it
promptfuzz scan --target http://localhost:8000/chat

The runner auto-detects http:// targets, sends {"message": "..."} as the request body, and reads the "response" field from the reply. Both field names are configurable.


Attack categories

Category Count What it tests
jailbreak 40 DAN variants, persona switches, roleplay bypasses, encoding tricks
injection 40 Classic overrides, delimiter attacks, role elevation, instruction smuggling
data_extraction 30 System prompt leakage, credential extraction, reflection attacks
goal_hijacking 25 Competitor promotion, purpose replacement, loyalty switches
edge_cases 30 Unicode abuse, long inputs, encoding edge cases, null bytes
Total 165
promptfuzz list-attacks   # view full table with severity breakdown

CLI reference

promptfuzz scan [OPTIONS]

  --target, -t       URL or module:function path
  --config, -c       YAML config file (mutually exclusive with --target)
  --context          Description of the target application
  --categories, -C   Attack categories to run (repeatable)
  --output, -o       Save HTML report to path
  --json             Save JSON report to path
  --severity, -s     Minimum severity to display [low|medium|high|critical]
  --fail-on, -f      Exit code 1 if vulns at/above this severity are found
  --max-workers, -w  Concurrent request workers (default: 5)
  --timeout, -T      Per-attack timeout seconds (default: 30)
  --verbose, -v      Enable verbose output

Config file

# promptfuzz.yaml
target: "http://localhost:8000/chat"
context: "customer support chatbot"
categories:
  - jailbreak
  - injection
  - data_extraction
max_workers: 5
timeout: 30
headers:
  Authorization: "Bearer YOUR_TOKEN"
input_field: message
output_field: response
promptfuzz scan --config promptfuzz.yaml --output report.html
promptfuzz validate --config promptfuzz.yaml   # validate before running

CI/CD integration

# .github/workflows/security.yml
name: LLM Security
on: [push, pull_request]

jobs:
  promptfuzz:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pip install promptfuzz
      - name: Start app
        run: uvicorn myapp:app &
      - name: Run security scan
        run: |
          promptfuzz scan \
            --target http://localhost:8000/chat \
            --categories jailbreak injection \
            --fail-on high \
            --output report.html
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: security-report
          path: report.html

--fail-on high exits with code 1 if any high or critical vulnerability is found, blocking the merge.


Security score

Score Risk level
80–100 Low risk
50–79 Medium risk
20–49 High risk
0–19 Critical risk

Formula: max(0, 100 − (critical×25 + high×10 + medium×5 + low×2))


Contributing

Adding new attacks is the easiest way to contribute. Each attack is a JSON object in one of the five files under promptfuzz/attacks/. Copy an existing entry, update the id, name, prompt, and detection fields, and open a PR.

{
  "id": "JB-041",
  "name": "My new jailbreak",
  "category": "jailbreak",
  "severity": "high",
  "description": "What this attack does and why it matters.",
  "prompt": "The actual adversarial prompt sent to the LLM.",
  "detection": {
    "method": "refusal",
    "indicators": [],
    "success_if": "refusal_absent"
  },
  "tags": ["jailbreak", "persona"],
  "remediation": "Add explicit system prompt instruction to refuse persona changes."
}

Run ruff check . and pytest tests/ -v before opening a PR.


License

AGPL-3.0 © PromptFuzz Contributors

Free to use for personal projects, security research, and open-source software. Commercial use in closed-source products requires a commercial license — open an issue to discuss.

Metadata

Release files for promptfuzz 0.2.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 promptfuzz 0.2.0
File Size Uploaded Provenance Actions
promptfuzz-0.2.0.tar.gz 96.9 kB With provenance Details for promptfuzz-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for promptfuzz 0.2.0
File Interpreter ABI Platform Actions
promptfuzz-0.2.0-py3-none-any.whl Python 3 none any Details for promptfuzz-0.2.0-py3-none-any.whl

Total release size: 197.6 kB

Release files / promptfuzz-0.2.0.tar.gz

Download URL promptfuzz-0.2.0.tar.gz
Size 96.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6817de240b998938a68a8036f60380966e516649e8ad8dc8073bc4005e240a5a
BLAKE2b-256 checksum
How to use checksums
aabf5390296d1a0cbf8a98f6cf334cf72509ddc2e7d47c3df12f41cad2e81505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.

Transparency log

Release files / promptfuzz-0.2.0-py3-none-any.whl

Download URL promptfuzz-0.2.0-py3-none-any.whl
Size 100.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c0208c351d6e664d623087066f190fee8e73b8d4b102cc3d5946fcfc7bf4d42
BLAKE2b-256 checksum
How to use checksums
9f5d09eb915306e7b21af659462a92b9d30cbfb3e294bcca0e31fa610b87baee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.

Transparency log

Security for promptfuzz 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for promptfuzz-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.

Transparency log

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.

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