Home
cd ../playbooks
Developer ToolsAdvanced

Shannon: Autonomous Pentesting for Your Own Apps

An operating guide for driving Keygraph's Shannon CLI: scope a white-box pentest against an app you own, run it, and turn the proven findings into fix tasks

15 minutes
By KeygraphSource
#security#pentesting#appsec#vulnerability-scanning#devsecops

Your team ships code every day. Your pentest happens once a year. Shannon closes that gap by reading your source, executing real exploits against your staging environment, and reporting only what it could prove. This playbook teaches Claude Code how to set it up, scope the run, and triage the report that comes back.

Who it's for: backend and full-stack engineers, appsec engineers, DevSecOps teams, security-conscious founders, engineers preparing for a security audit

Example

"Set up Shannon against my staging app and triage whatever it finds" → A scoped config with the login flow and out-of-scope paths, a completed run, and a ranked fix list that separates the nine proven exploits from the three unproven findings and collapses six IDOR reports into one missing ownership check

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Shannon Pentest Operator

Help me set up Shannon, scope a run against an application I own, drive the CLI, and turn the resulting report into fix tasks.

Shannon is an external tool. It is an autonomous white-box AI pentester by Keygraph that reads a repository, plans attacks, executes real exploits against the running application, and reports only findings it could prove. It is not a skill you can emulate. Everything below assumes Shannon is installed and running on my machine.

Repo: https://github.com/KeygraphHQ/shannon
License: AGPL-3.0

---

## Authorization Gate

Before running any Shannon command, confirm two things with me:

1. I own the target application and repository, or I hold explicit written authorization from the owner to test them.
2. The target is a sandbox, staging, or local development environment, not production.

If either answer is no, stop. Do not run the scan. Say why and offer to help me set up a disposable environment instead.

Shannon is not a passive scanner. Its exploitation agents can create users, modify or delete data, compromise test accounts, trigger unintended side effects from injection attacks, generate unexpected outbound traffic, and write exploit artifacts into the report. Treat the target's data as expendable.

Two more limits I need you to enforce:

- Do not point Shannon at untrusted or adversarial codebases. A tool that reads source can be influenced by malicious content in that source.
- Your job is operating Shannon and acting on its report. Do not write, extend, or improvise exploit payloads yourself, and do not test anything against a host I have not authorized.

---

## Prerequisites

Check these before the first run:

- **Docker.** Shannon runs the worker in a container and pulls the image from Docker Hub.
- **Node.js 18+.** Needed for the `npx` workflow.
- **AI provider credentials.** Anthropic is recommended. AWS Bedrock and Anthropic-compatible proxy endpoints are also supported.

Platform notes:

- **Windows:** WSL2 only. Native Windows and Git Bash are not supported. Install Docker Desktop and enable the WSL2 backend, then run Shannon inside WSL. Windows Defender may flag exploit code inside reports as a false positive; excluding the Shannon directory fixes it.
- **macOS:** Docker Desktop.
- **Linux:** native Docker. `sudo` may be needed depending on the Docker setup.

---

## Setup

Run the interactive credential wizard once:

```bash
npx @keygraph/shannon setup
```

It writes to `~/.shannon/config.toml`. Environment variables always take precedence over that file, so I can override a saved provider for a single session without editing anything:

```bash
export ANTHROPIC_API_KEY=your-api-key
```

Model tiers are configurable: `ANTHROPIC_SMALL_MODEL` (summarization), `ANTHROPIC_MEDIUM_MODEL` (security analysis), `ANTHROPIC_LARGE_MODEL` (deep reasoning). Only Claude models are officially supported. If I ask about routing through a smaller or non-Claude model, tell me it is unsupported and may not follow Shannon's tool-use constraints.

If I would rather use a Claude Code subscription than API credits, point me at the `shannon-v1` branch: generate a token with `claude setup-token`, run `npx @keygraph/shannon@1.9.0 setup`, and choose **OAuth Token**. That is the last release built on the Claude Agent SDK.

---

## Running a Scan

Basic run:

```bash
npx @keygraph/shannon start -u https://your-app.com -r /path/to/your-repo
```

Flags I will use:

| Flag | Purpose |
|------|---------|
| `-u` | Target URL of the running application |
| `-r` | Path to the source repository (mounted read-only in the worker) |
| `-c` | Path to a YAML configuration file |
| `-o` | Copy deliverables to a custom output directory after the run |
| `-w` | Workspace name (also how runs are resumed) |

Other commands:

```bash
npx @keygraph/shannon status              # is Shannon running
npx @keygraph/shannon logs <workspace>    # follow a run
npx @keygraph/shannon workspaces          # list all workspaces
npx @keygraph/shannon version
npx @keygraph/shannon stop
npx @keygraph/shannon stop --clean        # confirms first; -y or --yes skips
npx @keygraph/shannon uninstall           # confirms first; -y or --yes skips
```

Detailed monitoring is available in the Temporal Web UI at `http://localhost:8233`. Under WSL, find the WSL IP with `ip addr` and open `http://<wsl-ip>:8233` from the Windows browser.

**Testing a local app:** the container cannot reach the host's `localhost`. Use `host.docker.internal`:

```bash
npx @keygraph/shannon start -u http://host.docker.internal:3000 -r /path/to/repo
```

Custom hostnames from `/etc/hosts` are forwarded into the worker at scan start. Disable with `export SHANNON_FORWARD_HOSTS=false`.

**Budget expectations before I start:** a full run takes roughly 1 to 1.5 hours and incurs LLM API costs that scale with model pricing, application complexity, and concurrency. Tell me this up front rather than after the bill.

---

## Scoping the Run

Shannon runs without a config file, but a config is what makes the run useful. When I ask for help scoping, produce a YAML file based on the shipped example:

```bash
cp configs/example-config.yaml ./my-app-config.yaml
npx @keygraph/shannon start -u https://your-app.com -r /path/to/repo -c ./my-app-config.yaml
```

Fields worth filling in:

- **`description`** — the stack, the environment, and whether credentials in the repo are local-only. This is context for attack planning, so be specific about framework and data store.
- **`vuln_classes`** — limit which classes run end to end: `injection`, `xss`, `auth`, `authz`, `ssrf`. Narrowing cuts run time and cost.
- **`exploit: "false"`** — skip the exploitation phase. Use this for a first pass on an environment I am not yet ready to have mutated.
- **`rules_of_engagement`** — free-form text. Rate caps, no brute force, placeholder values instead of real data in deliverables.
- **`authentication`** — `login_type`, `login_url`, and `credentials` (`username`, `password`, `totp_secret`, and optional `email_login` for magic-link or email-OTP flows).
- **`login_flow`** — ordered steps referencing exact field labels, placeholders, and button text. Substitution placeholders: `$username`, `$password`, `$totp`, `$email_address`, `$email_password`, `$email_totp`.
- **`success_condition`** — how Shannon knows login worked, e.g. `type: url_contains` with `value: "/dashboard"`.
- **`rules.avoid` / `rules.focus`** — scope carve-outs and emphasis. Rule types: `url_path`, `subdomain`, `domain`, `method`, `header`, `parameter`, `code_path`. Use `avoid` for logout endpoints, destructive admin actions, and vendored code; `focus` for the API surface or whatever I actually shipped this week.
- **`report`** — `min_severity`, `min_confidence`, and free-form `guidance` for what the report agent should drop.
- **`pipeline`** — `max_concurrent_pipelines` accepts 1-5 and defaults to 5. On a subscription plan, set `retry_preset: subscription` and lower concurrency to 2, since subscription usage resets on a rolling 5-hour window and default retries can exhaust before it does.

To write `login_flow`, walk me through logging in once in a fresh private window and transcribe the steps in order, quoting labels and button text exactly as they appear.

---

## Watching a Run

The pipeline runs in phases: pre-reconnaissance over the source, reconnaissance against the live app, per-class vulnerability analysis, exploitation, then reporting. Each agent checkpoints its progress.

If a run dies, resume it by passing the same workspace name:

```bash
npx @keygraph/shannon start -u https://your-app.com -r /path/to/repo -w my-audit
```

The URL must match the one the workspace was created with. Shannon rejects mismatched URLs to prevent cross-target contamination. Completed agents are skipped on resume.

---

## Reading the Output

Workspaces live in `~/.shannon/workspaces/` (`npx` mode) or `./workspaces/` (source build), named `{hostname}_{sessionId}` unless I passed `-w`.

```text
workspaces/{hostname}_{sessionId}/
|-- Security-Assessment-Report.md   # the deliverable
`-- .shannon/                       # internals
    |-- deliverables/               # report source, per-phase analysis, queues
    |-- agents/                     # per-agent logs
    |-- prompts/                    # rendered prompts
    |-- scratchpad/                 # screenshots, scripts
    |-- session.json                # resume state
    `-- workflow.log
```

Read `Security-Assessment-Report.md` first. Go into `.shannon/agents/` only when a specific finding needs its trail reconstructed.

The report opens with an executive summary, a summary by vulnerability type, and reconnaissance notes, then breaks into per-class evidence sections. Findings carry class-prefixed IDs: `INJ-VULN-nn`, `XSS-VULN-nn`, `AUTH-VULN-nn`, `AUTHZ-VULN-nn`, `SSRF-VULN-nn`.

Each finding has a fixed shape: vulnerable location, overview, impact, severity, prerequisites, exploitation steps, proof of impact, and notes. Severity labels observed in Keygraph's published sample reports are Critical, High, and Medium.

**The distinction that matters most:** each class section separates *Successfully Exploited Vulnerabilities* from *Confirmed Vulnerabilities Without Successful Exploits*. Never flatten those two into one list when you summarize.

- **Successfully exploited** means an agent ran a proof of concept and the report shows the observed result. Treat these as real and schedule the fix.
- **Confirmed without successful exploit** means the weakness was observed but no working exploit was produced. Often a transport or configuration issue rather than a live compromise. Still worth fixing, but it does not carry the same evidence weight and should not be reported to stakeholders as a proven breach.

---

## Triage

When I hand you a report, do this:

1. **Read the whole report before ranking anything.** Duplicates across sections are common; the same root cause often surfaces as an auth finding and an injection finding.
2. **Group by root cause, not by finding ID.** Six IDOR findings across profiles, baskets, and feedback are usually one missing ownership check. One fix, one task.
3. **Verify each proven finding against the source.** The report names a file and line for most findings. Open it. Confirm the sink is what the report claims. Flag anything you cannot corroborate as unverified rather than dropping or accepting it silently.
4. **Rank by exploited-plus-impact, not severity label alone.** A proven Medium reachable without authentication usually outranks a Critical that requires an admin session.
5. **Write fix tasks, not a summary.** One task per root cause: the file and function to change, the fix approach, and the finding IDs it closes.
6. **Call out what Shannon proved versus what it inferred.** LLM-generated reports can contain weakly supported or incorrect details, so mark low-confidence items for human review instead of asserting them.
7. **Never paste exploitation steps into a ticket, chat, or commit message** unless I ask. Reference the finding ID and keep the payloads in the report file.

After a fix lands, verification means re-running the scan. Shannon Open Source has no targeted re-test that skips the rest of the pipeline, so budget the full run time again.

---

## What Shannon Does Not Cover

Set expectations honestly. Shannon Open Source targets five classes:

- Broken Authentication
- Broken Authorization
- Injection
- Cross-Site Scripting
- Server-Side Request Forgery

Because it only reports what it can exploit, it stays quiet about vulnerable dependencies, insecure configurations, secrets, IaC, containers, and broad policy findings. An empty report means Shannon could not prove anything in those five classes on that run, not that the application is secure. Say that plainly rather than letting me read a clean report as a clean bill of health.

Broader static coverage and finding-lifecycle management sit in Keygraph's commercial platform, not in this CLI.

---

## Source Build

If I want to modify the CLI or build the worker image locally:

```bash
git clone https://github.com/KeygraphHQ/shannon.git
cd shannon
cp .env.example .env        # add ANTHROPIC_API_KEY=...
pnpm install
pnpm build
./shannon start -u https://your-app.com -r /path/to/your-repo
```

Every `npx @keygraph/shannon <cmd>` has a `./shannon <cmd>` equivalent. Source-build mode resolves credentials from environment variables first, then `./.env`, and stores workspaces in `./workspaces/`. Rebuild the worker image with `./shannon build --no-cache`.
README.md

What This Does

Shannon is an autonomous white-box AI pentester by Keygraph. It reads your repository, maps attack paths against the running application, executes real exploits, and writes a Markdown report containing only findings it could prove with a working proof of concept.

This playbook is not a self-contained prompt skill. Most playbooks on this site are pure CLAUDE.md rule sets that work the moment you download them. This one is an operating guide for an external CLI. Shannon is a separate application you install and run yourself, and none of this does anything until you do. The template teaches Claude Code four things: how to get Shannon installed and credentialed, how to write a scoping config for your specific app, which CLI commands and flags to use, and how to read and triage the report that comes out.

The triage half is where most of the value sits. A Shannon run against a real application produces dozens of findings across five vulnerability classes, split between proven exploits and unproven observations, often with the same root cause appearing under three different IDs. The template gives Claude a procedure for collapsing that into a ranked fix list.


Before You Run This

Shannon executes real attacks. Two rules, stated plainly:

  1. Run it only against applications and repositories you own, or that you hold explicit written authorization to test. Unauthorized scanning is illegal.
  2. Do not run it against production. Exploitation agents can create users, modify or delete data, compromise test accounts, and generate unexpected outbound traffic. Use a sandbox, staging, or local environment with disposable data.

The template opens with an authorization gate that makes Claude confirm both before running any command. Keygraph also warns against pointing Shannon at untrusted or adversarial codebases, since a tool that reads source can be influenced by malicious content inside it.

This playbook covers operating the tool and acting on its report. It contains no exploit payloads or attack techniques.


Prerequisites

  • Docker — Shannon runs its worker in a container pulled from Docker Hub.
  • Node.js 18+ — for the npx workflow.
  • AI provider credentials — Anthropic recommended. AWS Bedrock and Anthropic-compatible proxy endpoints are supported. Only Claude models are officially supported.

Platform notes from the docs:

  • Windows: WSL2 only. Native Windows and Git Bash are not supported. Install Docker Desktop with the WSL2 backend and run Shannon inside WSL.
  • macOS: Docker Desktop.
  • Linux: native Docker, possibly with sudo.

Quick Start

Step 1: Install Shannon

npx @keygraph/shannon setup

The wizard collects your provider credentials and writes ~/.shannon/config.toml. Environment variables override it, so export ANTHROPIC_API_KEY=... wins for a single session.

Step 2: Create a Project Folder

mkdir -p ~/Projects/ShannonRuns

Step 3: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Projects/ShannonRuns/

Step 4: Start Working

cd ~/Projects/ShannonRuns
claude

Ask Claude to help you scope a config for your app, then kick off the run:

npx @keygraph/shannon start -u https://staging.your-app.com -r /path/to/your-repo -c ./my-app-config.yaml -w q1-audit

Testing a local app? The container cannot reach your host's localhost. Use http://host.docker.internal:3000.


The CLI

Flag Purpose
-u Target URL of the running application
-r Repository path, mounted read-only in the worker
-c YAML configuration file
-o Copy deliverables to a custom output directory
-w Workspace name, and how you resume a run
npx @keygraph/shannon status              # is Shannon running
npx @keygraph/shannon logs <workspace>    # follow a run
npx @keygraph/shannon workspaces          # list all workspaces
npx @keygraph/shannon stop
npx @keygraph/shannon stop --clean        # confirms first; -y skips

The Temporal Web UI at http://localhost:8233 gives per-agent detail during a run. If a run dies, pass the same -w name to resume; completed agents are skipped. The URL must match the one the workspace was created with.


Scoping the Run

Shannon runs without a config, but the config is what makes the run useful. The template walks Claude through building one:

  • description — stack, environment, and whether repo credentials are local-only. This feeds attack planning.
  • vuln_classes — restrict to any of injection, xss, auth, authz, ssrf. Narrowing cuts time and cost.
  • exploit: "false" — skip the exploitation phase entirely for a non-mutating first pass.
  • rules_of_engagement — free text. Rate caps, no brute force, placeholders instead of real data in deliverables.
  • authentication and login_flow — ordered steps quoting exact field labels and button text, with $username, $password, $totp, $email_address, $email_password, and $email_totp substituted at runtime. Magic-link and email-OTP flows are supported via optional mailbox credentials.
  • rules.avoid / rules.focus — carve-outs and emphasis by url_path, subdomain, domain, method, header, parameter, or code_path. Avoid logout and destructive admin routes; focus on your API surface.
  • reportmin_severity, min_confidence, and free-form guidance for what to drop.
  • pipelinemax_concurrent_pipelines takes 1-5 and defaults to 5. On a subscription plan, set retry_preset: subscription and drop concurrency to 2.

How to Read the Output

Workspaces land in ~/.shannon/workspaces/ (npx mode) or ./workspaces/ (source build).

workspaces/{hostname}_{sessionId}/
|-- Security-Assessment-Report.md   # the deliverable
`-- .shannon/                       # internals: agents, prompts, deliverables, logs

The report opens with an executive summary and a summary by vulnerability type, then splits into per-class evidence sections. Findings carry class-prefixed IDs (INJ-VULN-nn, XSS-VULN-nn, AUTH-VULN-nn, AUTHZ-VULN-nn, SSRF-VULN-nn) and a fixed shape: vulnerable location, overview, impact, severity, prerequisites, exploitation steps, proof of impact, notes.

The distinction that matters most is the split inside each class section:

Section What it means
Successfully Exploited Vulnerabilities An agent ran a proof of concept and the report shows the result. Real. Schedule the fix.
Confirmed Vulnerabilities Without Successful Exploits The weakness was observed but no working exploit was produced. Worth fixing, but not a proven breach.

The template tells Claude never to flatten those two lists into one when summarizing. Severity labels in Keygraph's published sample reports run Critical, High, and Medium.


Triage

The template's triage procedure, in short:

  1. Read the whole report before ranking anything.
  2. Group by root cause, not by finding ID. Six IDOR findings across profiles, baskets, and feedback are usually one missing ownership check.
  3. Verify each proven finding against the source file and line the report names. Flag anything you cannot corroborate as unverified.
  4. Rank by exploited-plus-impact, not the severity label alone. A proven Medium reachable without auth often outranks a Critical needing an admin session.
  5. Write fix tasks, not a summary: file, function, approach, and the finding IDs each task closes.
  6. Mark what Shannon proved versus what it inferred.
  7. Keep exploitation steps in the report file, out of tickets and commit messages.

Verification after a fix means re-running the whole scan. Shannon Open Source has no targeted re-test.


Tips

  • Start with exploit: "false" on an environment you are not ready to have mutated. You get the attack surface analysis without the state changes.
  • Narrow vuln_classes to the area you just shipped. A single-class run finishes far faster than all five.
  • Name every workspace with -w. Auto-named workspaces look like example-com_shannon-1771007534808, which is unhelpful three runs later.
  • Prefer a Claude Code subscription over API credits? The shannon-v1 branch is the last release built on the Claude Agent SDK and accepts an OAuth token from claude setup-token. Run npx @keygraph/shannon@1.9.0 setup and pick OAuth Token.
  • Windows Defender may flag exploit code inside reports as a false positive. Exclude the Shannon directory.
  • For maximum isolation, Keygraph suggests running Shannon inside a disposable virtual machine.

Limitations

Straight from Keygraph's own safety and coverage docs:

  • Five classes only. Broken Authentication, Broken Authorization, Injection, XSS, and SSRF. Vulnerable dependencies, insecure configurations, secrets, IaC, and containers are out of scope for the open-source CLI.
  • An empty report is not a clean bill of health. Proof-by-exploitation means Shannon stays silent about anything it cannot actively exploit.
  • Human review is required. LLM-generated reports can contain weakly supported or incorrect details.
  • Claude models only. Smaller, alternative, or proxied non-Claude models may be incomplete or unstable.
  • Time and cost. A full run takes roughly 1 to 1.5 hours and incurs LLM API costs that scale with model pricing, application complexity, and concurrency.
  • Prompt injection risk. Do not scan untrusted or adversarial codebases.
  • No targeted re-test. Verifying a fix means running the full pipeline again.
  • Not production, ever. Exploitation agents mutate application state by design.

Shannon Open Source is AGPL-3.0. Broader static analysis, finding management, and verified remediation live in Keygraph's commercial platform.

$Related Playbooks