Chat assistant versus agent harness
- Chat: paste tool output into Claude and ask what it means or what to try next. Useful for learning and for unusual responses. You run every command and remain the bottleneck.
- Agent harness: software calls Claude through the API with tool definitions, executes the tool calls Claude makes, and feeds the results back. Claude drives; the harness enforces safety and records everything.
- MCP: Claude clients that support the Model Context Protocol can call security tools exposed by an MCP server, a middle ground between the two.
What Claude is good at in a pentest
- Reading long, messy tool output and picking out the line that matters.
- Planning multi-step tests, such as creating a second account to check whether one user can reach another's data.
- Following a lead across steps: using a token found during recon in a later exploitation attempt.
- Writing clear findings and remediation advice from raw evidence.
- It is weaker where any model is weak: deciding real-world business impact, and knowing when a plausible-looking result is not actually a vulnerability, which is why independent verification matters.
Keeping cost under control
Agentic pentests send many requests with large contexts, so cost scales with run length and target size. Three habits help: prompt caching for repeated context such as tool definitions and recon results, a hard spend cap per run, and using deterministic playbooks for known procedures so the model is only consulted where judgement is needed. Run on a practice lab first to see what a typical run costs for your setup.
Data handling
With a cloud model, HTTP responses, endpoint names and sometimes credentials from your target are sent to the model provider as part of the prompt. Review Anthropic's commercial terms and your organisation's policy on sending security data to third parties. If that is not acceptable, run the same harness with a local model instead and accept some loss of capability.
Usage policy and refusals
Anthropic's usage policy restricts offensive cyber activity, with authorised security testing being the legitimate context. Keep written authorisation for your targets and frame objectives as the test they are. Even so, a model may occasionally decline a step; a good harness logs that and moves on rather than stalling the run.
Using Claude with Pentest-Swarm
Claude is a first-class provider in Pentest-Swarm, with prompt caching enabled by default for the recon and classifier agents. One key configures the whole swarm.
- Set the key:
export PENTESTSWARM_ORCHESTRATOR_API_KEY=sk-ant-.... - Run:
pentestswarm scan staging.example.com --scope staging.example.com --provider claude --swarm --budget 10. - Or pick Claude in the
pentestswarm runlauncher and set the spend cap there. - Use Claude from your editor:
pentestswarm mcp serve(beta) exposes Pentest-Swarm to MCP clients such as Claude-based tools. - The GitHub Action (beta) takes a Claude API key for scheduled CI runs.
Where it falls short
Using Claude means your target data goes to Anthropic, which some organisations cannot accept; use Ollama or LM Studio in that case. Pentest-Swarm with Claude still covers only web applications and APIs, and its concurrent swarm scheduler is alpha. Claude is not a pentester on its own: without a harness that enforces scope and verifies findings, its suggestions need careful human checking.
Questions
Can Claude do penetration testing?
As the reasoning model inside a harness that runs real tools, yes, for authorised targets. On its own in a chat window, it advises rather than tests.
Will Claude refuse pentesting tasks?
It may decline some requests, particularly without clear authorised-testing context. Anthropic's usage policy governs what is allowed.
How much does a Claude-driven pentest cost?
It depends on target size and run length. Use prompt caching and a hard per-run cap, and measure on a lab first.