Offensive AI
Beginner
T1592 T1588.005

Introduction to Offensive AI

Offensive AI pairs large language models with traditional security tooling through the Model Context Protocol (MCP). Agents orchestrate multi-tool workflows, correlate findings and draft reports for human review.

Foundation Page

This is the starting point for the Offensive AI section. Every subsequent module builds on the concepts, tooling, and threat models introduced here.

What is Offensive AI?

Offensive AI applies LLMs to pentesting, vulnerability research, and security assessments. Unlike rigid rule-based scanners, AI agents can:

Technique What it does Tool/prompt Detection signal
Context-adapted testing Adjusts strategy from target architecture and responses MCP agent with scoped tool allowlist Scope validation log; out-of-scope blocks
Finding correlation Links nmap, nuclei, Burp, and script output into one narrative BBOT + LLM enrichment pipeline Audit log of every tool invocation
Tailored payloads Crafts exploits for specific versions and configurations Local LLM; review before execution Payload review gate; no blind execution
Reporting Executive summaries and remediation guidance PlexTrac / custom copilot draft Human review sign-off before delivery
Autonomous chaining Plans multi-step attack paths with human-in-the-loop approval Agent framework + approval gate Approval audit trail; kill switch armed
Engagement memory Improves follow-up tests via contextual memory and RAG Retrieval pipeline over prior findings Retrieval ACL; written authorization on file

The Model Context Protocol (MCP)

The Model Context Protocol (MCP) is the open standard connecting AI clients to security tools. The full protocol reference, threat model, and hardening guidance live in the MCP Security guide. In short, MCP gives LLMs a structured interface to invoke tools, read results, and trigger workflows without bespoke integrations.

Model Context Protocol (MCP) Flow

An AI client (Claude / Copilot / Cursor) reaches the MCP server over JSON-RPC; the server fans out to the tool registry, resource provider and prompt templates, and the registry exposes the security tools - nmap, nuclei, sqlmap, Burp Suite and custom scripts.

Scroll sideways to see the whole diagram

Key MCP Concepts

Tools

Functions the AI can invoke to perform actions: run nmap scans, execute sqlmap, generate nuclei templates, or call custom scripts.

Resources

Data sources the AI can read: scan results, configuration files, vulnerability databases, and engagement notes.

Prompts

Pre-defined templates for common security workflows: recon checklists, exploit chains, and report generation pipelines.

Sampling

Server-initiated requests for AI decision-making, where the server asks the model to classify a finding or choose a next action.

Example MCP configuration for Claude Desktop with a security toolkit and local Ollama bridge:

Save this as claude_desktop_config.json in ~/Library/Application Support/Claude/ (macOS) or %APPDATA%\Claude\ (Windows). Point security-toolkit at a real security MCP server you run locally, e.g. HexStrike AI (see /offensive-ai/02-hexstrike/) or secops-mcp.

claude_desktop_config.json
{
  "mcpServers": {
    "security-toolkit": {
      "command": "python3",
      "args": ["/opt/mcp-servers/security_server.py"],
      "env": {
        "NMAP_PATH": "/usr/bin/nmap",
        "NUCLEI_PATH": "/usr/bin/nuclei"
      }
    },
    "ollama-bridge": {
      "command": "python3",
      "args": ["/opt/mcp-servers/ollama_bridge.py"],
      "env": {
        "OLLAMA_HOST": "http://localhost:11434",
        "MODEL": "llama3.3:70b"
      }
    }
  }
}

Types of AI Security Tools

The tooling in this section falls into four groups, each with different strengths and integration patterns.

1. MCP Platforms

Full-stack platforms that expose security tools via MCP servers, letting any compatible AI client orchestrate complex engagements.

  • HexStrike AI: 150+ tools, 12+ specialized agents, full MCP server
  • MCP Reference Servers: official modelcontextprotocol/servers collection, extendable with security tools
  • secops-mcp: open-source all-in-one security testing toolbox behind a single MCP interface

2. AI Copilots

IDE and tool extensions that add AI-powered analysis, code generation, and vulnerability detection to existing workflows.

  • GitHub Copilot: code-aware security analysis within VS Code
  • ReconAIzer: Burp Suite extension for AI-assisted traffic analysis
  • Nuclei AI: automatic vulnerability template generation
  • BurpGPT: LLM-driven HTTP request and response analysis

3. Agent Frameworks

Autonomous and semi-autonomous systems that plan, execute, and iterate on multi-step security tasks.

  • LangChain Agents: composable tool-calling agents with memory and planning
  • CrewAI: multi-agent orchestration for complex engagements
  • AutoGen: Microsoft's multi-agent conversation framework
  • PentestGPT: interactive penetration testing assistant

4. Security LLMs

Language models fine-tuned or optimized for security tasks — vulnerability analysis, exploit generation, and threat intelligence.

  • Deep Hat (formerly WhiteRabbitNeo): locally run security-focused LLM for offensive research
  • HackerGPT: bug bounty and vulnerability research assistant
  • DeepSeek-R1: reasoning model with strong code/security capabilities
  • Llama 3.3 (70B): open-weight model suitable for local security tasks

Supported AI Clients

MCP-based security tools integrate with a growing ecosystem of AI clients. Choose based on your workflow: a desktop app for interactive sessions, an IDE for code-centric testing, or an API for pipeline automation.

Claude Desktop

Native MCP support and tool calling

VS Code Copilot

MCP agent mode, inline security analysis

Cursor

MCP integration with codebase-aware context

Windsurf

Cascade AI with MCP tool orchestration

Cline

VS Code extension with autonomous MCP agent

Roo Code

Multi-model MCP client with custom modes

AI Limitations

AI agents are powerful force-multipliers but not replacements for human expertise. Always verify AI-generated findings, review exploit code before execution, validate business logic flaws manually, and maintain proper oversight of autonomous agents. False positives and hallucinated CVEs remain common failure modes.

MITRE ATLAS Framework

ATLAS (Adversarial Threat Landscape for AI Systems) is MITRE's threat framework specifically designed for adversarial attacks on machine learning systems. While ATT&CK covers traditional infrastructure, ATLAS maps tactics and techniques for attacking, evading and exploiting AI/ML models. Both attacking an AI-integrated target and defending one draw on that mapping.

Offensive Relevance

ATLAS techniques you'll encounter when attacking AI-integrated targets:

  • AML.T0051: LLM Prompt Injection (direct and indirect)
  • AML.T0054: LLM Jailbreak (bypassing model guardrails)
  • AML.T0043: Craft Adversarial Data (evasion samples)
  • AML.T0020: Training Data Poisoning (training data manipulation)
  • AML.T0024: Exfiltration via AI Inference API (data leakage through outputs)

Defensive Mapping

Understanding ATLAS also helps you assess AI defenses in target environments:

  • Map ML model deployment surfaces during reconnaissance
  • Identify prompt injection vectors in AI-powered applications
  • Test robustness of AI-based WAFs and anomaly detectors
  • Evaluate data pipeline integrity for poisoning opportunities
  • Assess API rate limits and model access controls

Query the ATLAS matrix programmatically to map adversarial ML techniques:

atlas_navigator.py
# MITRE ATLAS Navigator — list adversarial ML techniques
# Prerequisites: pip install requests pyyaml
# Docs: https://atlas.mitre.org/
import requests, yaml

# Fetch the ATLAS data bundle (format v6)
BASE = "https://raw.githubusercontent.com/mitre-atlas/atlas-data/main/dist/"
# ATLAS-latest.yaml is a pointer file, not the data. Follow it: dist/ -> v6/ATLAS-latest.yaml -> ATLAS-<release>.yaml
pointer = requests.get(BASE + "ATLAS-latest.yaml").text.strip()
release = requests.get(BASE + pointer).text.strip()
data = yaml.safe_load(requests.get(BASE + pointer.rsplit("/", 1)[0] + "/" + release).text)

# Techniques live under the top-level "techniques" map (format v6)
techniques = data["techniques"]
for tid, tech in list(techniques.items())[:10]:
    print(f"  {tech.get('id', tid)}: {tech['name']}")

# --- Selected LLM/GenAI techniques (ids in the release fetched above) ---
# AML.T0051: LLM Prompt Injection
# AML.T0054: LLM Jailbreak
# AML.T0043: Craft Adversarial Data
# AML.T0020: Training Data Poisoning
# AML.T0015: Evade AI Model
# AML.T0024: Exfiltration via AI Inference API
# AML.T0044: Full AI Model Access

ATLAS vs ATT&CK

ATLAS complements ATT&CK rather than replacing it. When pentesting AI-integrated targets, use ATT&CK for infrastructure and network technique mapping, and ATLAS for ML model-specific attack vectors. Engagements against those targets usually need both.

Provider and Hardware Matrix

The examples in this section name specific model tags, but a tag is only usable if the machine underneath it can hold the model. Four deployment paths cover most work: local CPU, local GPU, a hosted API and CI/automation. They differ in what will run, what a task costs and what leaves the host. Choose the path first, then the tag.

Size the model from arithmetic, not from a recommended-hardware badge. Weight memory is roughly parameters × bytes per weight, and context is a separate, growing cost:

  • 16-bit weights are 2 bytes each, 8-bit is 1 byte, 4-bit is about half a byte, plus a few percent for the quantisation scales.
  • A 70B model at 4 bits per weight is roughly 35 GB of weights, so plan on roughly 40 GB of accelerator memory before context.
  • The KV cache scales with context length, layer count and concurrent requests, so a model that just fits at a 4K window will not fit at 64K.
  • On CPU, system RAM must hold the weights plus several GB of headroom for the OS, inference server and context. CPU inference is a fallback for testing prompt and tool wiring, not the engine for a full campaign. Decode is slow enough there that a multi-turn tool loop becomes a background job.
Four deployment paths for a security LLM (local CPU, local GPU, hosted API and CI/automation), compared on hardware floor, model size and quantisation, latency for a short agentic task, token and cost budget, what leaves the machine, and what fails.
Path Minimum realistic hardware Model size / quantisation Latency, short agentic task Token / cost budget Privacy: what leaves the machine Capability limits
Local CPU Any laptop or desktop; 16 GB RAM is a realistic floor for a 4-bit 8B model. 3B–8B at 4-bit, ≈1.5–4 GB of weights. Tens of minutes; CPU decode is the bottleneck, so measure tokens/sec. No per-token charge; wall-clock is the budget. Cap turns and context. The weights download, plus any telemetry you leave enabled on the inference server or tools. Tool-call and JSON schema adherence, long context, anything beyond a few steps.
Local GPU ≈24 GB VRAM for a 30B at 4-bit (≈15 GB of weights plus KV cache); roughly 40 GB to hold llama3.3:70b at 4-bit. Unified memory counts. 30B at 4-bit; 70B at 4-bit only if the memory exists. Seconds to a couple of minutes on 24 GB; slower per token at 70B. No per-token charge; VRAM, not spend, is the limit: one model, batch 1. On-host, as CPU. Pin model hashes and disable server telemetry. Concurrency, very long context, 30B reasoning over exploit chains.
Hosted API No accelerator and no local weights — a client plus egress. Provider-hosted, usually undisclosed; judge by behaviour, not a spec sheet. Seconds per turn; total = turns × per-turn latency. Per task = (input tokens × rate) + (output tokens × rate), summed over turns. Every turn resends the conversation, so input grows faster than linearly. Rates vary, so read the current rate card. Prompts, tool output, pasted results and evidence samples all leave the host; retention and training use are contractual. Air-gapped or NDA-scoped work, offline use, policy refusals.
CI / automation Ephemeral runner; hosted runners rarely have a GPU. Small 4-bit local model to test wiring; hosted model for reasoning. Set by pipeline timeout and rate limits, not the model. max_turns and max_tokens as hard stops; cost per run × runs per day. Logs, artifacts and provider request logs outlive the run; keys sit in runner env. Human payload approval, interactive pivoting, mid-run judgement.

Before committing, measure tokens per second for the exact tag you intend to pull, and the number of model turns a representative task consumes. Wall-clock ≈ (turns × output tokens per turn) ÷ tokens per second — the only figure worth trusting is the one you measured. The same task shape gives the hosted cost, and the number to check against the rate card is total billed tokens, not the price of a single call.

Capability is not safety

A smaller local model keeps the data on your host but will mis-follow multi-step instructions, drop tool-call schemas and invent steps. A hosted frontier model follows those instructions far more reliably but sends prompts, tool output and any pasted evidence to a third party. Neither is the secure default: match the path to what the engagement forbids leaving the network, and keep the human review gate on both.

Getting Started Checklist

Set up a local Ollama instance as your offline security LLM:

ollama-setup.sh
# Prerequisites: curl, Docker (optional)
# Install Ollama (macOS/Linux)
curl -fsSL https://ollama.com/install.sh | sh

# Pull a security-focused model
# Tags move fast — verify the current tag in the Ollama library first.
ollama pull llama3.3:70b
ollama pull deepseek-r1:32b

# Verify the model is running
ollama list
# NAME                  ID            SIZE    MODIFIED
# llama3.3:70b          a6b4c8df...   42.5 GB   2 minutes ago
# deepseek-r1:32b       f1e2d3c4...   20 GB     5 minutes ago

# Run an interactive security query
ollama run llama3.3:70b "Explain the OWASP Top 10 2025 changes"

# Start the Ollama API server (default: http://localhost:11434)
ollama serve

# Test API connectivity
curl http://localhost:11434/api/tags | jq '.models[].name'

Runs untrusted remote code

curl … | sh executes whatever the server returns, unreviewed, with your privileges. Fetch the script first (curl -fsSL https://ollama.com/install.sh -o install.sh), read it, then run it, or use a pinned package/container image. The same applies to any code sample here that pulls a live URL at runtime.

Minimal MCP-aware agent using the Python SDK:

mcp_agent_example.py
# Prerequisites: pip install langchain openai mcp
# Example: minimal MCP-aware agent using LangChain + MCP
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def run_security_agent():
    """Connect to an MCP security server and invoke a scan tool."""
    server_params = StdioServerParameters(
        command="python3",
        args=["/opt/mcp-servers/security_server.py"]
    )

    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # List available security tools
            tools = await session.list_tools()
            for tool in tools.tools:
                print(f"  Tool: {tool.name} — {tool.description}")

            # Call a reconnaissance tool
            result = await session.call_tool(
                "nmap_scan",
                arguments={"target": "192.168.1.0/24", "flags": "-sV --top-ports 100"}
            )
            print(result.content[0].text)

asyncio.run(run_security_agent())

Offensive AI Introduction Labs

Hands-on exercises to build your AI-assisted pentesting foundation.

AI Red Teaming TryHackMe easy
Prompt injection fundamentalsLLM jailbreak techniquesAI-assisted reconnaissanceEvaluating AI-generated exploits
HTB Academy: AI Red Teamer Path Hack The Box medium
ML model exploitationAI API abuseAdversarial input craftingAI-powered CTF problem solving