agentleFS
everywan-deveverywan-dev/claude-code-engineering/skills/map-the-attack-surface/SKILL.md

map-the-attack-surface

Skill2 starsChanged 3 months agoApache-2.0View on GitHub

Use before exposing something, after inheriting a system you did not build, or when a security review says "looks fine". Finds who can reach what, the authorisation gaps scanners never report, and what not to put in the findings list.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 9 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before exposing anything to the internet, or widening who can reach it

    line 25
  2. Distinctive:

    After inheriting a system nobody can fully explain

    line 26
  3. Distinctive:

    When a scan came back clean and you want to know what it could not see

    line 27
  4. Distinctive:

    Before handling customer data, money or credentials

    line 28
  5. Distinctive:

    After any credential leak, to work out what it could reach

    line 29
  6. Distinctive:

    1. List the entrances: Every way in: public endpoints, admin interfaces, APIs, webhooks, file uploads, scheduled jobs that fetch from …

    line 33
  7. Distinctive:

    Write it as a sentence. Vagueness here is the finding: if nobody can state the rule, nobody is enforcing it.

    line 39
  8. Very specific:

    Quote the line that made you say it: Every finding carries file:line and the code itself.

    line 80
  9. Distinctive:

    If you cannot reach the vulnerable function from the code you can see, say so: *"not directly called — may still be reachable through …

    line 91
  10. Distinctive:

    "Test data is not real.": Check. Test environments are frequently refreshed from production, and often with weaker access controls.

    line 125

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Map the attack surface

Most security work in ordinary projects is not cryptography. It is answering one question honestly:

Who can reach what, and what stops them from reaching more?

The bugs that actually hurt are rarely exotic. They are an endpoint that checks you are logged in but not that the record is yours, a test environment sharing production credentials, an admin panel reachable from the internet because a proxy rule was broader than intended.

🔴 Automated scanners find injection. They do not find authorisation. A scanner cannot know that record 41 belongs to a different customer than record 42. That gap is where the expensive findings live, and it is found by asking, not by tooling.

When to use this

  • Before exposing anything to the internet, or widening who can reach it
  • After inheriting a system nobody can fully explain
  • When a scan came back clean and you want to know what it could not see
  • Before handling customer data, money or credentials
  • After any credential leak, to work out what it could reach

The procedure

1. List the entrances. Every way in: public endpoints, admin interfaces, APIs, webhooks, file uploads, scheduled jobs that fetch from outside, database ports, management planes, SSH. Include the ones you assume are internal — then check whether they are.

2. For each entrance, name what is on the other side and who is allowed. Write it as a sentence. Vagueness here is the finding: if nobody can state the rule, nobody is enforcing it.

3. Test authorisation with two accounts, not one. This is the step that finds the real bugs. Log in as tenant A, take an identifier belonging to tenant B, and ask for it. Do it for every object type that has an owner. A scanner will never do this for you.

QuestionWhat it finds
Can A read B's record by changing an id?Broken object-level authorisation
Can a normal user reach an admin action directly?Missing function-level checks
Does the list endpoint filter by owner, or the detail one only?The most common variant
Do the test and production systems share a credential?One breach becoming two
Does an error message differ for "not yours" and "does not exist"?Enumeration

4. Follow every credential to everything it opens. A key is not a secret, it is a set of permissions. Write down what each one can do, and whether it is shared between environments.

5. Ask what a compromise would let someone do, not whether it is likely. Likelihood is a guess; blast radius is a fact you can establish today.

6. Write down what you did not check. An attack-surface map that implies completeness is worse than a partial one that is honest about its edges.

Before you report it

Finding things is half the work. The other half is not crying wolf, because a report padded with maybes gets skimmed once and never opened again — and the real finding was on page three.

Score every finding, and keep the low ones to yourself.

ScoreWhat it meansWhat to do
9–10You read the code. You could write the exploit.Report it
8A known-exploitable pattern, path traced.Report it
5–7Plausible. You have not traced it end to end.Report only if asked for a wide sweep, marked tentative
Below 5A shape that looks suspicious.Keep it in your notes

Quote the line that made you say it. Every finding carries file:line and the code itself. A finding you cannot anchor to a specific line is a hunch, and half the time the field it complains about does not exist.

Prove it by reading, never by firing. Trace the path in the code: does the signature check exist anywhere in the middleware chain, can this URL actually reach an internal host, is the vulnerable function imported and called. Do not send the request, do not test the key against the live API. You are auditing a system, not attacking it — and a "harmless" probe is how audits become incidents.

If you cannot reach the vulnerable function from the code you can see, say so: "not directly called — may still be reachable through framework internals." That sentence is worth more than a confident guess in either direction.

These are not findings. Reporting them is how a security review loses its audience:

  • Denial of service, resource exhaustion, rate limits. Except uncapped spend on a metered third-party service — that is financial risk with a real number on it.
  • Missing hardening. A concrete reachable weakness is a finding; the absence of a best practice is a recommendation, and they do not belong in the same list.
  • Memory safety in a memory-safe language.
  • Input validation on fields with no security consequence.
  • Absence of audit logs. Logging secrets is a finding; not logging is not.
  • Weak randomness where the value is not a secret — a UI element id, a cache key.
  • Anything only reachable from test fixtures that nothing else imports.
  • Race conditions without a concrete path someone can walk.
  • Containers running as root in a local development compose file. In a production image, it is a finding.

Say what you did not look at. Same rule as the map itself. A findings list that implies completeness is the one that gets trusted for years after it stopped being true.

Anti-patterns

  • "It's behind a VPN." So is everyone who is already inside, including anything compromised.
  • "Nobody knows the URL." Obscurity is not a control. Certificate transparency logs, referrers, browser history and crawlers all know the URL.
  • "The scanner is clean." It tested for the classes it knows. Authorisation is not one of them.
  • "Test data is not real." Check. Test environments are frequently refreshed from production, and often with weaker access controls.
  • Threat-modelling the exotic attacker while an unauthenticated admin path sits open.

The incident

A security review of a multi-tenant panel came back clean on the automated axes: no injection, credentials handled correctly, dependencies current.

Asking the two-account question found that a customer could read another customer's records by changing an identifier in the URL. The list endpoint filtered correctly by owner; the detail endpoint did not check at all. Every automated tool had passed it, because from the outside the request looked exactly like a legitimate one — which is precisely what it was, except for who was making it.

The same review found the test environment authenticating to a third-party service with the same key as production. Individually a housekeeping note; combined with any weakness in the less-guarded environment, it is a path into the real one.

Related

  • keep-secrets-out-of-the-repository — where credentials leak from, and what to do the moment one does
  • route-work-to-the-right-model — anything on this page is level 3: three validations, one trying to break it
  • map-an-undocumented-system — you cannot secure what nobody can describe
  • review-code-you-did-not-write — authorisation checks are exactly what a plausible-looking diff omits

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.