This article was first published on Medium. The canonical URL is https://medium.com/@r3dtuxedo/authorized-security-testing-with-claude-code-and-codex-bfb7ccd49448.
Draw the fence first. Then let the agent work inside it.
TL;DR
- Coding agents now find real bugs. Calif says Codex found Java4Shell, a critical OpenJDK flaw, within an hour. If you run Java, patch first (box below). Then fence your own agent work properly.
- Agents refuse security work for a few boring reasons. A classifier read something alarming in the context (your prompt, a loaded skill, a file). The request sounded offensive when the task was defensive. Or a sandbox quietly blocked the network and it looked like a stall.
- The honest fix is context, not tricks. Write down whose system it is, what's in scope, what the output is, and when to stop. Put it in AGENTS.md (or CLAUDE.md) and ask for the concrete task. If the work really needs dual-use capability, apply for Anthropic's Cyber Verification Program or OpenAI's Daybreak instead of rewording.
- The paperwork protects you, and the sandbox protects everyone else. Scope it in writing, run the agent in a sandbox or container with a network allowlist, keep findings local when they're sensitive, check every finding by hand, and disclose responsibly. A free scope template is linked below.
On 17 November, the security firm Calif published Java4Shell, a critical memory-corruption bug in the Base64 decoder of OpenJDK's x86-64 HotSpot JVM. CISA urged organizations to patch it immediately. The part that matters for this article is how it was found. Calif says a researcher asked Codex to audit Netty and the JVM for highly reachable bugs, and that Codex found this one within an hour. Calif puts the total token cost at less than $200.
Hold that thought. It means a coding agent can now do serious vulnerability research on code you depend on, and it will do the same on yours. It also explains why the vendors fence this kind of work so carefully.
If you run Java, do this first. Update to the November OpenJDK release. OpenJDK's advisory of 17 November lists CVE-2026-114938 (a HotSpot compiler flaw, CVSS 3.1 score 8.1) as affecting JDK 17, 21, 25 and 27, and says the affected builds are 27.0.1.0.3, 25.0.5.0.3, 21.0.13.0.3, 17.0.21.0.3 and earlier. Calif rates it 9.2 under CVSS 4.0 and says it affects x86-64 machines with AVX-512 support. Calif's interim mitigations are the JVM flags -XX:-UseBASE64Intrinsics or -XX:UseAVX=2 (x86-64 only; on ARM the second flag stops the JVM from starting). CISA's alert also asks you to look for Java bundled inside other products and container images.
Back in October, two threads in r/ClaudeCode asked a smaller version of the same question from different sides.
In the first, the Claude chat app refused a scraping task that Claude Code then did without complaint. In the second, Claude refused to help read a crash dump. The poster had a reverse-engineering skill loaded at the time. One reply guessed the skill itself tripped the safety classifiers, and said a plain debugging prompt worked.
Both stories are about legitimate work hitting a wall. Neither poster was doing anything wrong. And both found that the wall moved when the context changed.
That's the subject of this follow-up. In part 1, I used a coding agent to find every PHP version across my repos and open patch PRs. That's the easy end of security work: reading your own code and config. This article is about the next step. You test your own systems on purpose, with an agent, and you do it in a way that you, the vendor's safety systems and a lawyer would all be comfortable with.
One rule runs through all of it: only test systems you own or have written permission to test. Everything below assumes that.
The goal isn't to get past the safety checks. It's to give them, and yourself, an honest picture of the work.
There's no single "safety switch". When a security task goes sideways, it's usually one of four things.
Four common reasons a security task stops. Only the first three are about the model.
1. A classifier read something in context. Anthropic's help article on model fallbacks says its classifiers check your request and also what the model reads: memory, connectors, search results and files. So "content you didn't type" can trigger a fallback. Its listed cyber triggers are exploit generation, binary-based vulnerability scanning and penetration testing. When one fires, Opus 5 and 5.5 fall back to Opus 4.8. The same article says secure coding and scanning source code for vulnerabilities still work. That explains the crash-dump thread. A loaded skill full of reverse-engineering language is context too.
2. The wording sounded offensive. Scale AI studied 2,390 real conversations from a collegiate cyber defense competition. Prompts with offensive-sounding terms were refused 2.72 times as often (30.5% against 11.2%). System hardening was refused 43.8% of the time, even though it is purely defensive. Log analysis was never refused. The paper doesn't name the models, so take the numbers as a pattern rather than a scorecard.
3. Just saying "I'm authorized" didn't help. In the same study, prompts that explicitly claimed authorization were refused more often, 21.8% against 11.6%. My reading: a bare claim costs nothing to type, so it carries no weight, and the phrasing often goes with riskier requests. What helps is detail about the actual task.
4. It wasn't a refusal at all. A sandboxed command that can't reach the network fails, and from the outside that can look like the agent getting stuck. Codex's sandbox starts with network access off. Claude Code's sandbox starts with an empty list of allowed domains. In Codex, GPT-6 Astra also runs safety monitoring that can a task. When something "stalls", read the last tool result before you assume the model said no.
The thread replies that suggested rewording around the filters, renaming skills or inventing a backstory are not advice I'll repeat. Apart from being dishonest, they don't make the work any safer, and both vendors say grants can be narrowed or withdrawn.
What does work is plain context. A legitimate request has things a malicious one usually lacks: an owner, a target list, a defensive output and a stop condition. Write those down once, where the agent reads them every session. AGENTS.md is the portable place, and Claude Code users can point CLAUDE.md at it:
## Security work in this repo
- Owner: Example GmbH. Written authorization "php-audit-2026-11", valid 2 to 13 Nov.
- In scope: this repo at tag v4.2, and the lab host lab.example.internal only.
- Out of scope: production, third-party services, anything not listed.
- Goal: find and fix vulnerabilities in our own code. Output: findings (file, line, impact, fix) and patches with tests.
- If a task needs anything outside this list, stop and ask. Don't work around a block.
Then ask for the concrete task, not the category. "Do a pentest" is vague and sounds offensive. "Review upload.php for path traversal and missing size checks, and write a failing test for each finding" is specific, defensive, and produces something you can check.
Three habits help more than any wording:
If the work genuinely needs more, such as malware analysis, exploit validation or authorized penetration testing, that's what the verification programs are for. Rewording until it goes through isn't.
If your work genuinely needs dual-use capability, apply for it. Don't reword your way to it.
Both vendors now run programs for verified security work. I checked the official pages again on 28 November 2026. Anthropic's page still carries its 6 October update date. OpenAI's Daybreak page had been updated two days earlier, and one change matters: its newest models sit behind Red. Names and tiers change often, so check again before you apply.
| Anthropic: Cyber Verification Program | OpenAI: Daybreak (Trusted Access for Cyber) | |
|---|---|---|
| Tiers | Defense, Red Team, Specialized | Blue, Red (plus standard access) |
| Individuals | Can apply, Defense tier only | Can apply, Blue tier only |
| What it changes | Adjusted safeguards on Mythos, Opus and Sonnet models, by tier | Blue: fewer refusals on some mainline models. Red: reduced refusals on the newest (Astra, GPT-6.2 Sol) plus cyber models such as GPT-5.6 Cyber |
| How to apply | Verification Portal → Programs → Cyber Verification Program | chatgpt.com/cyber (individuals); org form for teams |
| What you need | Identity verification, a description of your security work, an attestation to the tier's security controls | 18+, eligible paid plan, Advanced Account Security with a physical FIDO2 key, identity verification |
| After approval | Usage Policy still applies in full; grants can be narrowed or withdrawn | Off until enabled; in Codex CLI use /daybreak ordaybreak = true ; some refusals remain |
| Data | Individuals: traffic retained and monitored, no Zero Data Retention | Zero Data Retention not included |
| Scope | Your own code, products and infrastructure; customer work needs separate approval | Systems you own or are explicitly authorized to test; no customer-facing use |
Anthropic's Cyber Verification Program (CVP) was expanded on 6 October to three tiers. Its help page says general models can still be used by everyone for "secure code review, threat modeling, patching known issues, finding vulnerabilities in your own source code, and triaging security alerts". Work like malware analysis or exploit validation "may be interrupted". Independent researchers, maintainers and bug bounty hunters apply as individuals, and "Individuals can apply only for Defense Access." Red Team access, which adds authorized penetration testing, is for organizations. The page now lists review targets: two days for Defense Access and two weeks for Red Team Access, with a note that reviews are currently slower because of high demand. The models covered start at Claude Mythos 5.2, Mythos 5.1, Opus 5.5 and Sonnet 5.5.
One correction to a comment in the crash-dump thread: someone believed CVP requires open-source contributions or CVEs. The official page lists maintainers and researchers as examples of who can apply, but I found no CVE requirement. It asks for a description of your work and identity verification.
The security requirements page is worth reading before you apply. Every tier needs a security contact, incident reporting and personal (not shared) access. Defense needs MFA now and phishing-resistant MFA (a FIDO2 key, passkey or PIV) by 15 December 2026. For individuals, traffic is retained and monitored, with no Zero Data Retention.
How much does it change? Anthropic's own evaluation in the announcement says that without CVP every task was blocked at the first prompt. With Defense access, 46 of 50 tasks were still blocked. With Red Team access, none were blocked and 34 of 50 were completed. That's the vendor's own benchmark, but it shows that Defense isn't a free pass. It covers defensive work, as the name says.
OpenAI's Daybreak is the name OpenAI uses for its Trusted Access for Cyber program. Daybreak Blue gives reduced refusals on supported mainline models for "verified defensive work in authorized environments" and is "the recommended starting point". Daybreak Red adds cyber-specialized models (GPT-5.6 Cyber for all Red organizations, GPT-6 Cyber with separate approval) and is for approved business and enterprise organizations only. Individuals apply for Blue. One catch to know about. On OpenAI's current table, Blue gives reduced refusals on older mainline models such as GPT-5.5, GPT-5.6 Sol, GPT-6 Sol and GPT-6 Luna, but GPT-6.2 Astra and GPT-6.2 Sol get reduced refusals only with Red. With Blue alone you get standard safeguards on those two. The old GPT-5.5-Cyber is now for existing customers only, and its API preview model is due to be removed on 1 February 2027. The individual setup is strict: an eligible paid plan, Advanced Account Security, at least one physical FIDO2 key (a synced passkey doesn't count) and identity verification.
Two details catch people. First, "approval alone does not turn on reduced refusals." In Codex CLI 0.163.0 or later, type /daybreak in a session, or for headless runs:
codex exec -c daybreak=true "Review src/upload for path traversal; write failing tests for each finding"
Second, the refusal message tells you which case you're in: "Daybreak is currently off. If you're doing authorized security work, turn it on and try your request again." If you still see a cyber safety message with Daybreak on, OpenAI asks you to contact Support with the message, model, timestamp and request ID.
Neither program authorizes you to test anything. They change what the model will help with. Permission still comes from the system's owner.
OpenAI's recommended configuration for cyber work has a sentence I'd put on the wall: "Documentation alone doesn't enforce them." It lists what to document before the model starts: approved targets, excluded systems, approved tools, approved and prohibited actions, time window, data handling, disclosure, and stop conditions.
That list is also a good authorization letter. I turned it into a one-page template with three parts: the signed authorization, the AGENTS.md block, and a one-line-per-session run log:
https://gist.github.com/br4vesirrobin/41c1287d3c8d89b9acd844453d9b86e0
If you test your own side project, the owner is you, and the letter feels silly. Write it anyway. Half its value is making you decide what's out of scope before the agent finds something interesting at 1 a.m. For client work, the signature matters, and the template isn't legal advice.
The paperwork says what's allowed. The sandbox makes the rest hard to do by accident. I covered the general defaults in What Can Your Agent Actually Touch?. Here is the security-testing version.
The whole loop. The agent works in the middle three boxes. You own the first and the last.
Claude Code. The sandbox is off by default. Turn it on with /sandbox, or per run:
claude --settings '{"sandbox": {"enabled": true, "allowUnsandboxedCommands": false}}'
allowUnsandboxedCommands: false turns off the retry outside the sandbox. The /sandbox menu calls it Strict sandbox mode. Add failIfUnavailable: true so Claude Code refuses to start if the sandbox can't, instead of quietly running without it. Put only your lab host in network.allowedDomains. Know the edges too: built-in tools like Read and WebFetch follow permission rules, not the sandbox, and local MCP servers run with your full access. Anthropic's security docs recommend VMs or dev containers when you work with untrusted content.
Codex. The sandbox is on, with network off, by default. OpenAI's cyber configuration builds a dedicated permission profile on top of that. This is their example, trimmed:
approval_policy = "on-request"
approvals_reviewer = "auto_review"
default_permissions = "cyber-lab"
[features]
network_proxy = true
[permissions.cyber-lab]
extends = ":workspace"
[permissions.cyber-lab.filesystem.":workspace_roots"]
"**/.env*" = "deny"
"**/*.pem" = "deny"
[permissions.cyber-lab.network]
enabled = true
[permissions.cyber-lab.network.domains]
"lab.example.com" = "allow"
The important line is network_proxy = true. Per the docs, without it network.enabled = true "permits direct network access" and the lab allowlist doesn't restrict anything. The docs also say to avoid :danger-full-access and --yolo for this work, and to add a command rule so curl goes to review even when the target is allowed.
| Goal | Claude Code | Codex |
|---|---|---|
| Sandbox on | /sandbox orsandbox.enabled: true (off by default) |
On by default |
| No silent fallback | failIfUnavailable: true ,allowUnsandboxedCommands: false |
Don't use :danger-full-access or--yolo |
| Only the lab host | network.allowedDomains , optionallystrictAllowlist |
Permission profile domains plus network_proxy = true |
| Keep secrets out | sandbox.credentials deny or mask; no keys in env |
Deny **/.env* ,**/*.pem ; no keys in env |
| Outside the sandbox | Read/WebFetch tools, MCP servers, hooks | Web search, MCP servers, connectors, browser |
Both vendors say the same thing in different words: run risky work in a separate lab. A throwaway container or VM with only the target and the tools beats a well-configured agent on your daily laptop. Start fresh for each engagement, keep the logs outside it, and delete it when you're done.
Findings are sensitive. A list of unpatched bugs in a client's app is exactly what you don't want in someone else's logs. Note that CVP for individuals means traffic is retained and monitored, and Daybreak doesn't include Zero Data Retention. That's reasonable for the vendors. It might not be acceptable for your client.
For the parts of the work that don't need a frontier model, run an open-weight model locally. Ollama's FAQ says "we don't see your prompts or data when you run locally". It binds to 127.0.0.1:11434 by default. Both agents can use it: ollama launch claude or ollama launch codex, or codex --oss -m <model>.
Two cautions. First, Ollama also offers cloud models, and those run on Ollama's servers. In the MiniMax article I used a :cloud model on purpose. For private findings, do the opposite and turn the cloud off. Set OLLAMA_NO_CLOUD=1, or "disable_ollama_cloud": true in ~/.ollama/server.json, then restart and check the log for "Ollama cloud disabled: true". Claude Code's CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 also turns off its telemetry and error reporting.
Second, be careful which weights you run. ProjectDiscovery showed in October that a modified open model can carry a backdoor. Their poisoned 7B model, served to Codex CLI, sent a .env file out when it saw a trigger phrase, and they built it for under $50. Their advice: treat a model you didn't build "like a PR from a stranger". Use weights from the original publisher, not "uncensored" re-uploads. Run the model in the same sandbox, and keep the network away from the agent's command line. A local model with network access and your secrets in reach isn't private.
A local model with network access and your secrets in reach isn't private. It's just unaudited.
Local models are weaker. Use them for triage, summaries, log reading and first-pass review, and accept that they'll miss things. That's fine, because of the next step.
Agents produce confident findings. Some are wrong. In part 1, I called most public PHP2Shell proof-of-concepts junk. Agent findings can be junk in the same way: plausible, well-formatted and untested.
Treat every finding as a claim until you've checked it:
php -v lie, as part 1 showed.
If the bug is in your own system, fix it and move on. If it's in someone else's, even something you were allowed to test, disclosure is part of the job.
security.txt file (RFC 9116) or a published vulnerability disclosure policy, and follow it. ISO/IEC 29147 and 30111 describe the process from the vendor's side.
A real example of why the disclosure step matters. Calif's timeline for Java4Shell shows that the bug was not unknown. A user reported the crash on 9 June. A proof of concept and the root cause followed on 8 September, with a proposed fix the next day. That pull request was eventually closed without being merged. Calif's own Codex-found report, with a working exploit, went to Oracle on 24 October, and the patch shipped on 17 November. Calif's takeaway is that the bug "had already been reported, but it was patched only after we showed it could be exploited."
A crash report is easy to ignore. A demonstrated impact is not.
Two lessons for your own reports. State the impact and show how to check it, because "it crashes sometimes" gets ignored. And look for an existing public report before you file, as Calif did when it found the earlier issue.
A short legal note, because readers are in many countries. This isn't legal advice. The US Justice Department told prosecutors in 2022 not to charge good-faith security research under its computer-crime law. Portugal added a research exemption in late 2025, with strict conditions: report to the owner and the national cybersecurity centre (CNCS) right away, no denial of service or social engineering, and delete data within 10 days of the fix. In Germany, a 2024 draft to protect IT security research sits in the justice ministry's archive of earlier legislation. As far as I could find, no exemption to §202a StGB has been enacted. And in the EU, manufacturers have been reporting actively exploited vulnerabilities to ENISA since 11 September 2026 under the Cyber Resilience Act. In every case, written permission from the owner is what keeps you on the right side.
Print it, or paste it into the engagement folder.
None of this is about beating the safety checks. When you test your own systems, write down the scope, keep the agent inside a fence and check its work, the checks mostly stop being a problem. When they still get in the way of real defensive work, both vendors now have a way to apply for more.
If you haven't patched PHP2Shell yet, part 1 is still the place to start.