Skip to content

About

Genetic-algorithm fuzzer that evolves prompt-injection attacks across generations to discover LLM guardrail bypasses. Found 7 novel evasion techniques.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

⚒️ InjectionForge — Prompt Injection Fuzzer

A genetic algorithm that automatically discovers prompt injection attacks capable of evading LLM security filters.

Pairs with Prompt Firewall — Forge finds the holes, Firewall plugs them.

What It Does

Evolves prompt injection attacks across generations using:

  • LLM-powered mutation — generates novel variants via rephrasing, encoding, splitting, nesting, and language mixing
  • Rule-based fallback — works without an API key (leet-speak, zero-width chars, academic framing)
  • Fitness scoring — tests each attack against a target firewall, scoring bypass success + novelty + diversity
  • Genetic selection — keeps successful mutations, breeds them, discards weak ones

Architecture

Seed attacks (10 categories)
    │
    ▼
LLM Mutator ──► Variants ──► Test against Firewall
    ▲                              │
    │                              ▼
    └──── Keep best ◄────── Fitness scoring
          mutations              (bypass + novelty)

Quick Start

pip install -r requirements.txt

# Run against your Prompt Firewall (or any OpenAI-compatible endpoint)
python forge.py --demo

# With LLM-powered mutations (add your API key to .env first)
cp .env.example .env
# Edit MUTATOR_API_KEY=sk-your-key-here
python forge.py --generations 10 --population 20

Web Dashboard

uvicorn server:app --host 127.0.0.1 --port 8081

Dashboard

  • Launch new fuzzing runs from the UI
  • Browse discovered bypasses in the attack corpus
  • View run history with fitness trends

Demo Results

Running against Prompt Firewall (8 individuals, 3 generations, no LLM):

Metric Value
Bypasses found 7
Best fitness 86%
Total attacks 32
Top technique Zero-width space evasion
Top technique Leet-speak bypass
Top technique Academic framing

Real-World Use Case

Before deploying an LLM to production, point InjectionForge at your API endpoint:

  1. It generates hundreds of mutated attacks overnight
  2. Discovers which bypass techniques work against your specific defenses
  3. Produces a corpus of proven evasions
  4. You patch your firewall, re-run, verify fixes

Tech Stack

  • Python 3.14 — genetic algorithm core
  • OpenAI API (optional) — LLM-powered mutation engine
  • FastAPI + uvicorn — web dashboard
  • httpx — target testing

Built as Portfolio Project #5 — August 2026

About

Genetic-algorithm fuzzer that evolves prompt-injection attacks across generations to discover LLM guardrail bypasses. Found 7 novel evasion techniques.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages