The attack surface kit: three Claude Code passes that shrink what a stranger can reach
The short version
On 20 Oct 2026 Anthropic's Frontier Red Team showed how they used Claude to shrink the attack surface of code. The attack surface is every part of your app a stranger can reach without an account. Claude ran over 25 open source projects, more than five million lines, and found a 21 year old setting conflict that switched off a certificate check, so a server meant for trusted clients accepted anyone. In OpenSSH, the login on most servers, the fix locked away roughly a fifth of the code a stranger could reach before signing in.
Hunting bugs one by one never ends, because fixing one tells you nothing about the ones left. Shrinking what a stranger can reach lowers the risk of every bug at once, including the ones you will never find. Anthropic built this into one Claude skill but has not released it yet. They say the method works without it, so here it is as three prompts you run in Claude Code.
| Number | What it means |
|---|---|
| 25 | open source projects Claude went through, over five million lines |
| 21 years | how long two settings had silently dropped a certificate check |
| 94 | setting combinations that silently turned off a security control |
| a fifth | of OpenSSH's pre login code removed from a stranger's reach, shipped in 10.6 |
Source: Anthropic, "Using Claude to reduce the attack surface of code", 20 Oct 2026 (read 21 Oct 2026)
Copy these prompts
Commit or branch first so every change is one easy revert. Run each prompt in a fresh Claude Code session: type /clear between passes and paste the previous pass's summary at the top, the way Anthropic's skill starts every pass clean.
1. Defaults: on by default, nothing uses it
Map every entry point in this repo: routes, API handlers, webhooks, scheduled jobs, admin pages, debug
endpoints and file parsers. For each one, tell me if it is reachable in the default configuration we ship,
and whether any feature we actually use needs it. List the ones that are on by default but unused, with the
file and line, and how you confirmed it is reachable (run it or trace it). Propose a gate for each: off by
default, behind login, or deleted, changing nothing for normal users. Run the tests before and after to
prove it. Do not change anything that alters a non default setting, list those for me instead.
End with a 5 line summary for the next pass.
2. Before login: everything a stranger can touch
List everything a visitor who is not signed in can reach or trigger: routes, middleware, file uploads,
parsers, emails sent, database writes, third party calls, logs written. For each one, say why it must run
before login. Flag anything that does real work (parses input, writes data, costs money, calls an outside
service) before the login check, confirm it with a request or a trace, and propose moving the check
earlier. End with a 5 line summary for the next pass.
3. Combos: two settings that switch a check off together
List every config option and environment variable that touches security: login, sessions, cookies, CORS,
CSRF, rate limits, allow and deny lists, TLS, feature flags, debug mode. Find pairs that look fine alone
but, set together, silently switch a check off or weaken it, or where the order or the naming decides which
one wins. For each pair, show the exact values that break it and prove it with a test. Propose rejecting
that combination when the app starts, with a clear error message.
What Anthropic actually did
The red team inventoried over 17,000 configuration options across the 25 projects, 3,842 of them security relevant, and Claude reported 493 issues. The skill runs three passes, each starting from an empty context with only a short summary of the pass before it:
- Default configuration. Code that is reachable in the build you ship even though no one turned it on on purpose.
- Early reachability. Code that runs before a hard gate such as authentication. In OpenSSH 10.4, about 4,500 lines of new post quantum signature code were reachable by an unauthenticated client in the default build, even when the admin had excluded that algorithm. That was about 16% of the server's pre login code. After two more rounds with the maintainers, the fix shipped in 10.6 and moved the check in front of the parser.
- Configuration interaction. Of 162 risky combinations accepted without an error or a warning, 94 silently turned a security control off. The 21 year one: a server set to accept only clients with a trusted certificate accepted a connection from anyone, with no warning and nothing in the docs.
Honest scale note from Anthropic: in the projects with a login gate, none of these issues was immediately exploitable on its own. They make the reachable area bigger than it needs to be, which is what makes the unknown bugs dangerous.
The skill is being worked into OSS Scanner, which is for open source maintainers who enrol their project. It is not something you can install for your own app today. That is why the prompts above exist.
Steal this for your app
- Debug, test and admin routes left on in production are the most common "on by default, nothing uses it" finding in an app built with an AI agent.
- Put the login check before parsing, not after. That is exactly what the OpenSSH fix did.
- Signup, password reset, invite links and webhooks all run before login. Keep each one doing as little as possible until it has checked who is asking.
- Fail loudly at startup on a bad combination of settings, like a dev flag left on in a public deploy, instead of accepting it silently.
- Watch for the pattern Anthropic found in four separate projects: a rule written with a hostname or a wildcard, compared against a bare IP address, never matches, so a deny list fails open.
- Every finding needs a file, a line and a proof (a request, a test or a trace). Anything that changes behaviour for real users is your call, not Claude's.
Run all three passes before you ship, and again after every big feature.
Run this on your codebase
Do a read only attack surface review of this repo in three passes and change nothing. Pass 1: list every
entry point that is reachable in the default configuration but used by no feature. Pass 2: list everything
a visitor who is not signed in can reach, and flag anything that does real work before the login check.
Pass 3: list security settings and environment variables, and find pairs that silently switch a check off
when set together. For every finding give the file, the line, how you confirmed it, and a one line fix.
End with the five findings that shrink what a stranger can reach the most, in order.