Claude Code refuses security and pentest work. What to do
When Claude Code stops on a penetration test or switches to an older model mid-task, it is working as Anthropic designed it. Here is why it happens, what Anthropic offers, and how to run the same agent on an uncensored model for authorized work.
- Anthropic says Opus 5 and Opus 5.5 may fall back to Opus 4.8 when its cyber classifiers flag higher-risk offensive security requests, naming exploit generation, binary-based vulnerability scanning and penetration testing.1
- Secure coding, source review for flaws and triage stay available on Claude.1
- Anthropic's Cyber Verification Program gives verified professionals fewer interruptions, in tiers for defensive work, authorized offensive testing and critical infrastructure red teaming.2
- Claude Code reads
ANTHROPIC_BASE_URL, and Ghost serves the Anthropic Messages format, so the same agent can run on an uncensored model in one terminal.4 - Ghost allows defensive and authorized security work. It prohibits malware built to attack systems and breaking into accounts or systems.6
When Claude Code refuses security or pentest work, it is because Anthropic's cyber classifiers flag requests like exploit generation, binary vulnerability scanning and penetration testing, then refuse them or fall back to an older model. You have two real options: apply to Anthropic's Cyber Verification Program, or point Claude Code at a server that runs an uncensored model, such as Ghost, for the authorized parts of the job. Neither option makes it acceptable to attack systems you do not own or have written permission to test.
Why Claude Code stops on security work
Security work is dual use. The same request that helps a tester validate a finding could help an attacker, and a classifier cannot see your engagement letter. Anthropic's help center explains the result: when its cyber classifiers flag a request as potentially higher-risk offensive work, Opus 5 or Opus 5.5 may hand the conversation to Opus 4.8, and in Claude Code the picker stays on that model for the rest of the session. Automatic switching is on by default, and you can turn it off under Config, MODEL & OUTPUT. Opus 4.8 has its own safeguards, so the fallback can refuse too.1
This is not new, and it is not about your account. In GitHub issue #3410, "Refusal to Resume Development of LLM Pentesting Tool", a user reported that Claude Code would not continue a tool it had helped build a week earlier for an authorized, client-commissioned test of a chatbot's image handling.3 Anthropic's own safeguards page acknowledges that allowed security work can still hit false positives while it refines the classifiers.2
What counts as legitimate, and what does not
Before choosing a fix, be clear about which side of the line your task sits on, because every provider draws one.
Legitimate work includes reviewing your own code for vulnerabilities, explaining how a published CVE works so you can patch it, writing detection rules, analyzing a sample you were handed for defense, building lab exercises and CTF practice, and running a penetration test inside a signed scope.
Not legitimate, on Ghost or anywhere else: building malware meant to attack systems, breaking into accounts or systems you have no authorization for, and fraud. Ghost's content policy prohibits these on every model, alongside violent harm and the other categories it lists.6 An uncensored model removes reflexive refusals. It does not remove the law, and it does not make an unauthorized test authorized.
Option one: stay on Claude and apply for verified access
If your organization already runs on Claude, the Cyber Verification Program is the first thing to try. Anthropic describes it as giving verified professionals stronger models with fewer interruptions from the cyber safeguards, split into tiers by the kind of work. Its guidance for blocked work: have your admin confirm access is assigned, check the work fits your tier, and reapply after seven days if denied. Work for customers needs its own application.2 Anthropic's help center notes that Opus 5.5 is not currently included in the program.1
Smaller fixes can help too. In the #3410 thread, a commenter suggested stating the project's authorized purpose in a CLAUDE.md file and framing tasks as defensive testing.3 That reduces some false positives, but it does not change what the classifiers block.
Option two: run Claude Code on an uncensored model
Claude Code reads where to send requests from environment variables. Anthropic's gateway docs describe ANTHROPIC_BASE_URL as the variable that points Claude Code at another server, and they also say plainly that Anthropic does not support routing Claude Code to non-Claude models through any gateway.4 So this route works, but Anthropic will not help you debug it.
Ghost serves the Anthropic Messages format at https://api.thesapientdirective.com, so no proxy is needed.5 Get a key on the API page, then in a fresh terminal:
export ANTHROPIC_BASE_URL=https://api.thesapientdirective.com
export ANTHROPIC_AUTH_TOKEN=YOUR_GHOST_KEY
export ANTHROPIC_MODEL=cyberheabsy
export ANTHROPIC_SMALL_FAST_MODEL=cyberheabsy
export ANTHROPIC_DEFAULT_OPUS_MODEL=cyberheabsy
export ANTHROPIC_DEFAULT_SONNET_MODEL=cyberheabsy
export ANTHROPIC_DEFAULT_HAIKU_MODEL=cyberheabsy
claude
Only that terminal is affected. Your normal Claude Code in any other window keeps using your Anthropic plan, so you can keep Claude for everyday work and open a Ghost terminal for the steps it refuses. We ran Claude Code against Ghost's production API end to end on November 30, 2026. The full walkthrough, with Windows commands, is in how to run uncensored models in Claude Code.
Testing your own systems with CyberHeabsy
CyberHeabsy is the model on Ghost meant for security testing of your own systems. It has a 256K context window and costs $2.25 per million input tokens and $6.75 per million output tokens. The CyberHeabsy page has the details.
Other models fit other parts of the job:
| Model | API id | Context | Input per 1M | Output per 1M | Use it for |
|---|---|---|---|---|---|
| CyberHeabsy | cyberheabsy | 256K | $2.25 | $6.75 | Testing your own systems |
| Ghost X2 | ghost-x2 | 256K | $0.20 | $0.80 | Everyday code and tooling, low cost |
| GLM 5.3 Uncensored | glm-5-3-uncensored | 1M | $3 | $5 | Large codebases and long logs |
| DeepSeek V4.1 Flash Uncensored | deepseek-v4-1-flash-uncensored | 256K | $0.60 | $2.25 | Reasoning-heavy debugging |
Messages to GLM 5.3 are screened before they are sent, and every reply on Ghost gets a child-safety check.6
Habits that keep authorized work clean
A model that does not refuse puts the judgment back on you, so run security work the way you would with a junior tester.
- Write the scope down. Put the authorized targets, dates and rules of engagement in the repo, and point the agent at them.
- Test against labs, your own staging systems or targets named in a signed engagement. Never aim an agent at a third party's system to see what happens.
- Keep a human approving commands. Claude Code asks before it runs shell commands by default. Leave that on during engagements.
- Keep findings and evidence out of public places, and read Ghost's privacy policy yourself before you send client data to any provider.
FAQ
Is Claude Code refusing because my account is flagged?
Usually not. Anthropic's classifiers act on the request, and the fallback to an older model is a documented default for flagged offensive security requests.
Does Anthropic allow pointing Claude Code at a non-Claude model?
Claude Code honors ANTHROPIC_BASE_URL, so it works. Anthropic's docs say it does not support routing Claude Code to non-Claude models, so support questions go to the provider you point it at.
Will Ghost help me write malware?
No. Ghost's content policy prohibits malware built to attack systems and breaking into accounts or systems on every model. It does allow defensive and authorized security work, and it will explain how attacks work so you can defend against them.
Which Ghost model should I use for a pentest?
CyberHeabsy is built for security testing of your own systems. Ghost X2 is the low-cost option for writing tooling, and GLM 5.3 Uncensored has a 1M token window for large codebases.
Sources
- Why Claude switched models in your conversation with Opus 5, Claude Help Center
- Real-time cyber safeguards, Claude Help Center
- Refusal to Resume Development of LLM Pentesting Tool, anthropics/claude-code issue #3410
- Claude Code docs: other LLM gateways
- Ghost API docs
- Ghost Content Policy
Authors
Ghost research. Written by the Ghost team at The Sapient Directive. Ghost prices and model details are checked against the live Models page; if they ever differ, that page is right.