Skip to content

Jerrycyborg/ai-security-testing-playbook

AI Security Testing Playbook

License: MIT Contributions Welcome Security Policy

A practical, defensive playbook for testing and securing LLM-powered apps (chatbots, RAG systems, agentic tools, code assistants) in authorized environments.

This repository focuses on:

  • How to test AI systems for common security failures
  • What to log + measure
  • How to mitigate issues with practical patterns
  • Hands-on labs you can run locally

⚠️ Ethics & Scope: This repo is for security testing on systems you own or have explicit permission to test. See docs/scope-and-ethics.md.


Quick links


The Top 10 LLM App Security Risks (practical)

  1. Prompt injection (direct + indirect via docs)
  2. Tool abuse (unsafe actions, privilege misuse)
  3. Tool-output injection (model trusts tool output as instructions)
  4. RAG overexposure (retrieves sensitive docs / too-broad scope)
  5. RAG poisoning (malicious documents / source spoofing)
  6. Sensitive data leakage (system prompts, memory, logs)
  7. Authz gaps (model can access data the user shouldn’t)
  8. Insecure AI-generated code (weak crypto, injection, auth flaws)
  9. Unsafe defaults in production (no rate limits, no monitoring)
  10. Evaluation blind spots (no regression tests for security failures)

Use the checklists here to systematically test each category.


Reference architecture (where attacks happen)

            Untrusted Inputs
   (user, files, URLs, tool outputs)
                  |
                  v
            +-------------+
            |  LLM APP     |  <-- prompt assembly, policy, routing
            +-------------+
             |     |     |
             |     |     +--> RAG (retrieval + docs)
             |     +--------> Tools (APIs / actions)
             +--------------> Response (user)

Key idea: treat anything untrusted as data, and strictly control how it reaches prompts and tools.


What’s inside

Playbooks

Checklists

Patterns & Metrics

Labs (local)


Quickstart

  1. Read the guardrails:
  1. Run a lab locally:
  1. Use a checklist during reviews:

Optional: GitHub Pages docs (MkDocs)

This repo includes an MkDocs config so you can publish docs via GitHub Pages easily:

  • mkdocs.yml
  • docs/index.md

To build locally:

pip install -r docs-requirements.txt
mkdocs serve

Contributors

GitHub Role
@Jerrycyborg Creator & Maintainer

Contributing

PRs welcome. Please read:


License

MIT — see LICENSE.

Examples

About

An AI Security Testing Playbook with labs for prompt injection, RAG poisoning, and tool attacks

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages