Is Pentesting With Claude Allowed? Defensive vs. Malicious Use

Blog / AI concepts

Is Pentesting With Claude Allowed? Defensive vs. Malicious Use

Using Claude for penetration testing is not a violation in itself. Anthropic's usage policy targets malicious use, such as attacking systems you have no authorization to touch or building malware meant to cause damage. For defense, testing, and research within a scope that you or your client have explicitly authorized, the policy is far more lenient, though Claude may still decline specific kinds of requests. The official Anthropic usage policy is the authoritative text; what follows is a way to reason about it as you read.

One-line test: do you have authorization?

Start with one question: is the target yours, or has someone given you written permission to test it?

The security industry already agrees on this. Penetration tests and red-team engagements are defined by an "authorized scope." Scanning or breaking into systems without authorization can be illegal in most jurisdictions, whether or not AI is involved. Anthropic's policy draws roughly the same line (check the official page for exact wording):

  • Defensive work: analyzing samples, writing detection rules, auditing your own code, incident postmortems, CTFs and lab exercises. This is generally normal use.
  • Authorized testing: penetration tests with a defined scope and engagement. Discussing methods and approach is usually fine.
  • Malicious use: intrusion against unauthorized targets, mass attacks, data theft, ransomware-style programs, and scaled fraud tooling. This is what the policy opposes.

The edges between these three are blurry. A "proof-of-concept exploit," for example, can show up in vulnerability research or be used to attack someone. Whether a request like that is accepted depends on context, and there is no fixed allowlist.

Why does the same question sometimes get answered and sometimes refused?

Claude can't see your authorization paperwork. It can only infer intent from the conversation. Some common cases:

SituationLikely outcome (informal experience, not an official commitment)
Explaining why a class of vulnerability occurs and how to fix itUsually fine
Practicing in a lab or your own test environmentUsually fine; describing the environment helps
A specific third-party domain or IP, with no mention of authorizationLikely refused or questioned
Asking for a deployable malicious program or AV-evading sampleVery likely refused
Stating an intent to attack a person or organizationRefused, and may draw attention at the account level

A refusal doesn't mean something is wrong with your account. In most cases only that one answer is restricted. To understand the difference between a refusal and an account being affected, see What Claude's policy violation warning means and whether it affects your account and What to do when Claude refuses to answer.

How to state your authorization the right way

"Providing context" means describing your situation truthfully, not inventing a script. An honest, specific description helps both sides:

  1. State your role and purpose, for example: "I'm doing a security assessment of my own company's internal system."
  2. State the scope, for example: "This only involves a test machine I set up myself," or "a test environment within the client's authorized scope."
  3. Break the problem down to the parts you actually need, such as "what's wrong with this code's input validation and how do I fix it," rather than asking for a full attack chain up front.
  4. If real targets are involved, confirm you hold written authorization before asking an AI about them.

Conversely, making up an identity or repeatedly rewording a request to probe where refusals begin may get you no answer, and it can count against you if the account is ever reviewed. The official policy also doesn't promise that declaring authorization will always get a request through.

A checklist before you start security research

  • Is the target my own asset, or do I have written authorization?
  • Are the test and production environments separate? Could anything affect third parties?
  • Do I want understanding, detection, and remediation, or a finished product that can be used directly to attack?
  • If I find a vulnerability, is there a disclosure channel (the vendor's security advisory email or vulnerability disclosure program)?
  • Have I read the current version of the usage policy? Terms get updated, so go by the official page.

If you do this kind of work regularly, it's also worth understanding the difference between consumer and commercial terms. See How to read Claude's terms of service: consumer vs. commercial terms. For a fuller plain-language walkthrough of the policy, see Claude's usage policy in plain language: which uses count as violations.

What if something goes wrong with your account?

Only the legitimate route applies here. If you get a violation notice or your account is restricted, first compare it against the policy to work out which category it falls under, then appeal through official support channels and describe your real use case. Don't use a new account to get around restrictions, and don't rely on any "ban-proof" tricks; those practices themselves violate the terms. For the common reasons accounts get banned and how Anthropic handles them, see Why Claude accounts get suspended: what the official terms say.

Also, if you only suspect that the Claude service itself is unstable and that's why answers look off, check cdnping's Claude status page and the Anthropic API status first to rule out server-side problems.

If you're new to Claude Code and want to build security tools

Writing scan scripts, log analysis tools, and detection rules is a very common use of Claude Code. If you'd like a monthly subscription paid in RMB without having to arrange an overseas credit card, you can look at AGI Plan. It is a monthly-subscription gateway that aggregates models from multiple providers. You pay in RMB, no overseas credit card is needed, and one subscription lets you switch between several capability groups. Tools such as Claude Code and Codex only need a changed endpoint address. Some models are marked "overseas only"; see the AGI Plan models page for specifics. The site states that it is not an officially authorized channel, so you still need to follow each model provider's usage policy. AGI Plan is a commercial partner of cdnping; for getting-started steps, see the AGI Plan startup page.

Next steps

  1. Open Anthropic's official usage policy, find the cybersecurity section, and read the current version.
  2. Check what you do day to day against the checklist above, and sort it into defense, authorized testing, or malicious use.
  3. When you ask, state your role, scope, and purpose, and ask only for the part you actually need.
  4. If you see an account notice, go through the official appeal process rather than trying to work around it.

Related articles

Keep reading