Skip to content
lulitaxuPublic

About

Prompt injection scanner for LLM apps and AI chatbots — red team your own AI before someone else does. Stdlib-only Python, one-file HTML report, OWASP LLM Top 10.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arxject: Prompt Injection Scanner for LLM Apps and Chatbots

License: MIT Python 3.8+ Dependencies: none GitHub stars

Red-team your own LLM app before someone else does.

arxject fires a battery of 40 categorized prompt injection probes at a chat endpoint, grades every response automatically, and writes a one-file HTML report you can hand to a client or attach to a ticket. It is written in pure Python 3 standard library: no pip installs, no API keys, no accounts.

Indie developers ship chatbots and AI features every day with zero injection testing, because the established tools are heavy. arxject is the 10-minute version: clone it, point it at your endpoint, read the report.

Authorized use only. Test endpoints you own or have written permission to test. Probing other people's systems may be illegal. arxject deliberately has no mass-scanning, no target lists, and no evasion features.

Quickstart: reproduce the demo offline

The repo ships a fake chatbot (demo/vulnbot.py, no real LLM) that is deliberately vulnerable, so you can see a full report with zero setup:

# terminal 1: start the vulnerable demo bot
python demo/vulnbot.py

# terminal 2: scan it
python -m arxject --url http://127.0.0.1:8000/chat --out report.html

# open report.html in a browser

Verified results against the demo bot:

Demo bot mode Probes flagged VULNERABLE Verdict
vulnerable (default) 40 / 40 (100%) CRITICAL
hardened (--hardened) 0 / 40 (0%) LOW, all 40 PASS

A real sample report from the vulnerable run is in docs/sample-report.html.

How to test a chatbot for prompt injection

Point arxject at your own app's chat endpoint. Any JSON chat API works:

python -m arxject --url https://staging.example.com/api/chat \
  --header "Authorization: Bearer YOUR_TOKEN" \
  --body '{"messages": [{"role": "user", "content": "{{MSG}}"}]}' \
  --response-path choices.0.message.content \
  --out report.html

The pieces that adapt arxject to your API:

  • --body: a JSON template. The probe text replaces {{MSG}}.
  • --response-path: dotted path to the reply text inside the JSON response (for example choices.0.message.content). If omitted, arxject auto-detects common response shapes (reply, response, choices..., and more).
  • --header "Name: Value": repeatable, for API keys or session cookies.
  • --categories direct-injection,indirect-injection: run a subset.
  • --limit N, --timeout SECONDS, --method, --out: the rest.

Then read the report: every probe's exact prompt and the target's reply are kept in collapsible sections, so a VULNERABLE grade is always checkable by eye.

A lightweight garak and promptfoo alternative

garak, PyRIT, and promptfoo are excellent, deep frameworks. arxject is not a replacement for them and does not claim feature parity. The honest difference:

arxject garak / PyRIT / promptfoo
Dependencies zero (Python stdlib only) pip/npm installs, often heavy
API keys needed none usually, for models or judges
Offline demo included fake bot, reproduces in seconds bring your own target
Grading deterministic nonce matching often LLM-as-judge or large harnesses
Depth 40 curated probes, 5 categories hundreds of probes, many attack families
Report one self-contained HTML file dashboards, JSON, CI tooling

Use arxject for a fast first pass on your own app. Graduate to the bigger frameworks when you need depth.

Probe categories and OWASP mapping

Category What it tests OWASP LLM Top 10
direct-injection "Ignore your instructions" attacks sent straight at the model LLM01 Prompt Injection
system-prompt-extraction Attempts to make the target reveal its system prompt and secrets LLM07 System Prompt Leakage
role-override Persona swaps: DAN, developer mode, unrestricted characters LLM01 Prompt Injection
encoding-obfuscation Base64, hex, ROT13, reversed, spaced and smuggled instructions LLM01 Prompt Injection
indirect-injection Instructions hidden in documents, emails, code comments, JSON and fake transcripts the model is asked to process LLM01 Prompt Injection

How grading works

  1. Every probe carries a unique nonsense token (a nonce) that a model would only repeat if it followed the injected instruction.
  2. If the nonce comes back in the reply, the probe is graded VULNERABLE. Extraction probes are also graded on system-prompt leak markers.
  3. A clear refusal is a PASS. Anything else is UNCERTAIN and flagged for a human look. No LLM judge, no fuzzy scoring: grades are reproducible.

Roadmap

  • Response-path presets for popular chat APIs (OpenAI-shaped, Anthropic-shaped, Ollama)
  • CI-friendly exit codes (fail the build when VULNERABLE count rises)
  • More probe packs: multi-turn crescendo, tool-use and agent probes
  • JSON output alongside the HTML report

Contributing

Issues and probe submissions are welcome. New probes need a unique nonce or leak markers and a category from the table above. Keep the stdlib-only rule: if it needs a pip install, it does not belong in core.

License

MIT, copyright arafat arzu. See LICENSE.

About

Prompt injection scanner for LLM apps and AI chatbots — red team your own AI before someone else does. Stdlib-only Python, one-file HTML report, OWASP LLM Top 10.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages