web-perimeter-audit
Skill3 starsChanged 8 days agoMITView on GitHub
Use when auditing a live or staging web domain's perimeter before launch, or hardening nginx/Caddy/CDN edge config. Passive, non-destructive curl probes mapped to OWASP Top 10:2025 leads: exposed .git/.env/compose/lockfiles, CORS reflection, cache poisoning (X-Forwarded-Host), HSTS/CSP, cookie flags, stack-trace leaks, security.txt.
- Reads credentials
- Deletes or force-pushes
In this repository12 other files it gives its agents.
- adversarial-reviewSkill
- agent-workdirSkill
- airgapSkill
- db-migrationsSkill
- delegateSkill
- docker-packagingSkill
- handoffSkill
- impeccableSkill
- run-validationSkill
- security-huntSkill
- ship-auditSkill
- skill-critiqueSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 3 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Run non-destructive, deterministic perimeter checks against web apps, APIs and CDN edges.
- Distinctive: line 21
Never send destructive payloads, brute-force traffic, or unisolated cache-poisoning probes against shared production cache keys.
- Very specific: line 22
Before sending any X-Forwarded-Host or X-Forwarded-Scheme probe against a live target, first prove query-key isolation using fresh, …
- Very specific: line 25
If HIT followed by MISS is not confirmed within those bounded attempts, abort the live probe and run it only against an isolated staging …
- Very specific: line 26
Use a private mktemp -d working directory with trap cleanup for all captured headers and bodies.
- Distinctive: line 27
Verify real HTTP responses rather than trusting framework defaults.
- Very specific: line 28
Treat 403 Forbidden on directory roots (such as /.git/) as insufficient unless direct object paths (/.git/HEAD, /.git/config) also return …
- Very specific: line 29
Keep all checks local (curl and standard system tools).
- Very specific: line 41
Unkeyed header web cache poisoning: Only after proving query-key isolation (?__cb=${CB_A} reaches HIT within 3 bounded requests while …
- Very specific: line 132
Public lockfiles and registry config: Verify that dependency manifests return 404 or 403 in production so attackers cannot harvest the …
- Very specific: line 135
Check whether production JS bundles expose .js.map files containing original source and business logic.
- Very specific: line 142
Treat includeSubDomains and preload as deployment decisions, not defaults:
- Very specific: line 143
Add includeSubDomains only after confirming every subdomain under the registered domain serves valid HTTPS.
- Very specific: line 144
Keep preload submission a separate, explicit decision after reviewing the HSTS preload requirements.
- Very specific: line 146
Verify the CSP defines default-src, script-src, object-src 'none', base-uri 'self' and frame-ancestors.
- Very specific: line 152
Every Set-Cookie carrying an auth or session identifier must include HttpOnly and Secure.
- Very specific: line 154
Default to SameSite=Lax (or Strict) for first-party flows.
- Very specific: line 160
Vulnerability disclosure policy: Verify RFC 9116 compliance at /.well-known/security.txt: Contact: and a non-expired Expires: field.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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.
Files
Web perimeter audit (OWASP Top 10:2025 surface leads)
Run non-destructive, deterministic perimeter checks against web apps, APIs and CDN edges. Map observable edge findings to OWASP Top 10:2025 categories as perimeter leads, and verify fixes with reproducible checks before shipping.
What perimeter probing cannot prove
Response headers, CDN cache behavior and disclosure files only show the publicly observable edge. Passing this checklist does not establish OWASP Top 10:2025 compliance. Report these as unverified by perimeter probing unless backed by separate code review and authenticated testing:
- Authorization and object-level access control (A01:2025): BOLA/IDOR, tenant isolation and privilege escalation need authenticated multi-role integration tests (OWASP Authorization Cheat Sheet).
- Authentication and session lifecycle (A07:2025): MFA enforcement, credential stuffing defenses, token rotation and server-side session revocation cannot be proven from
Set-Cookieflags alone (OWASP Authentication Cheat Sheet). - Injection and business logic (A05 / A06:2025): SQL/NoSQL/command injection, SSRF and race conditions need source analysis (SAST) and targeted DAST (OWASP Injection Prevention Cheat Sheet). Use
security-huntfor the code side. - Internal security logging and alerting (A09:2025): audit trail completeness, tamper resistance and alerting must be verified inside the telemetry pipeline (OWASP Logging Cheat Sheet).
Safety contract
- Never send destructive payloads, brute-force traffic, or unisolated cache-poisoning probes against shared production cache keys.
- Before sending any
X-Forwarded-HostorX-Forwarded-Schemeprobe against a live target, first prove query-key isolation using fresh, validated hex cache-busters (set -euo pipefail,CB_A=$(openssl rand -hex 8),CB_B=$(openssl rand -hex 8)):- Fail closed before sending any request if
CB_AorCB_Bis empty, equal, or does not match^[0-9a-f]{16}$. - Send a clean request with
?__cb=${CB_A}(--connect-timeout 3 --max-time 5), repeat the identical request at most twice (max 3 requests total,--max-time 5each) to confirm a cacheHIT, then send one clean request with?__cb=${CB_B}(--max-time 5) and verify it is a cacheMISS. - If
HITfollowed byMISSis not confirmed within those bounded attempts, abort the live probe and run it only against an isolated staging environment.
- Fail closed before sending any request if
- Use a private
mktemp -dworking directory withtrapcleanup for all captured headers and bodies. Never write to predictable shared/tmpfilenames. - Verify real HTTP responses rather than trusting framework defaults. Reverse proxies and CDNs often strip or override upstream headers.
- Treat
403 Forbiddenon directory roots (such as/.git/) as insufficient unless direct object paths (/.git/HEAD,/.git/config) also return404/403. - Keep all checks local (
curland standard system tools). Only call external CLIs or remote scorecard APIs when the user explicitly opts in and approves sharing the target hostname.
Workflow
1. Exposed artifacts, CORS and cache isolation (A01 / A02:2025)
- Direct git object and config exposure (
git-dumpervector). Disabling directory indexing on/.git/does not prevent repository reconstruction if object paths stay readable. Probe each path with a bounded, file-specific signature (--connect-timeout 3 --max-time 5) without printing sensitive contents:/.git/HEAD: status200and the first line matches^ref: refs/or a 40-char hex SHA (^[0-9a-f]{40}$)./.git/config: status200and the body contains[core]or a[remote "section header./docker-compose.yml(also/compose.yaml): status200and the body has a top-levelservices:block.- Environment config paths (such as
/.env): status200and lines match^[A-Z][A-Z0-9_]+=without<!DOCTYPEor<html. Report only a boolean detection signal; never echo secret values.
- CORS arbitrary origin reflection. Send
Origin: https://evil-probe.invalidwith--connect-timeout 3 --max-time 5. If the response reflectsAccess-Control-Allow-Origin: https://evil-probe.invalidtogether withAccess-Control-Allow-Credentials: true, record a HIGH-priority lead. Escalate to CRITICAL only after confirming the endpoint serves authenticated or non-public user data in a browser context. Public endpoints that return identical unauthenticated content regardless of cookies are a lower-severity misconfiguration. - Unkeyed header web cache poisoning. Only after proving query-key isolation (
?__cb=${CB_A}reachesHITwithin 3 bounded requests while?__cb=${CB_B}returnsMISS), or on an isolated staging host, run the bounded probe in a private temp dir:set -euo pipefail CB_A="$(openssl rand -hex 8)" CB_B="$(openssl rand -hex 8)" if [[ ! "${CB_A}" =~ ^[0-9a-f]{16}$ ]] || [[ ! "${CB_B}" =~ ^[0-9a-f]{16}$ ]] || [[ "${CB_A}" == "${CB_B}" ]]; then echo "Fail closed: invalid cache-buster entropy" >&2 exit 1 fi WORK_DIR="$(mktemp -d)" trap 'rm -rf "${WORK_DIR}"' EXIT TARGET_BASE="https://example.com/" # Step 1: prove query-key isolation (max 3 attempts for HIT on CB_A, then MISS on CB_B) CACHE_HIT=0 for attempt in 1 2 3; do curl -sS --connect-timeout 3 --max-time 5 -D "${WORK_DIR}/iso_a_headers.txt" -o /dev/null "${TARGET_BASE}?__cb=${CB_A}" if grep -Eiq '^(cf-cache-status:\s*HIT|x-cache:\s*Hit|age:\s*[1-9])' "${WORK_DIR}/iso_a_headers.txt"; then CACHE_HIT=1 break fi done curl -sS --connect-timeout 3 --max-time 5 -D "${WORK_DIR}/iso_b_headers.txt" -o /dev/null "${TARGET_BASE}?__cb=${CB_B}" if [[ "${CACHE_HIT}" -ne 1 ]] || ! grep -Eiq '^(cf-cache-status:[[:space:]]*MISS([[:space:]]|$)|x-cache:[[:space:]]*Miss([[:space:]]|$))' "${WORK_DIR}/iso_b_headers.txt" || grep -Eiq '^(cf-cache-status:[[:space:]]*HIT|x-cache:[[:space:]]*Hit|age:[[:space:]]*[1-9])' "${WORK_DIR}/iso_b_headers.txt"; then echo "Aborting live probe: query-key cache isolation not proven; use isolated staging." >&2 exit 1 fi # Step 2: isolated GET probe on a fresh cache-buster key CB_PROBE="$(openssl rand -hex 8)" [[ "${CB_PROBE}" =~ ^[0-9a-f]{16}$ && "${CB_PROBE}" != "${CB_A}" && "${CB_PROBE}" != "${CB_B}" ]] || exit 1 PROBE_URL="${TARGET_BASE}?__cb=${CB_PROBE}" curl -sS --connect-timeout 3 --max-time 5 \ -D "${WORK_DIR}/probe_headers.txt" -o "${WORK_DIR}/probe_body.txt" "${PROBE_URL}" \ -H "X-Forwarded-Host: cache-probe.invalid" \ -H "X-Forwarded-Scheme: nothttps" # Step 3: clean follow-up GET to the identical URL without probe headers curl -sS --connect-timeout 3 --max-time 5 \ -D "${WORK_DIR}/clean_headers.txt" -o "${WORK_DIR}/clean_body.txt" "${PROBE_URL}"- Flag MEDIUM (unkeyed input reflection) if
cache-probe.invalidappears inprobe_headers.txt(Location) orprobe_body.txton the first request alone. - Escalate to HIGH (confirmed web cache poisoning) only when the clean follow-up (
clean_headers.txt,clean_body.txt) is served from cache (CF-Cache-Status: HIT,X-Cache: Hit from cloudfront, orAge > 0) and replays the injectedcache-probe.invalidreflection or a poisoned4xx/5xxstatus. - Self-checking loopback fixture (positive replay vs negative control). Validate the detection logic locally without touching external networks:
python3 - << 'EOF' import http.server, threading, urllib.request STORE = {} class EdgeFixture(http.server.BaseHTTPRequestHandler): def log_message(self, *args): pass def do_GET(self): mode, _, query = self.path.partition("?") xfh = self.headers.get("X-Forwarded-Host", "clean.example") # /vulnerable caches by query only (unkeyed X-Forwarded-Host) # /safe includes X-Forwarded-Host in the cache key (negative control) key = (mode, query) if mode == "/vulnerable" else (mode, query, xfh) if key in STORE: body, hit = STORE[key], "HIT" else: body = f"<link href='https://{xfh}/app.js'>".encode() STORE[key], hit = body, "MISS" self.send_response(200) self.send_header("CF-Cache-Status", hit) self.end_headers() self.wfile.write(body) srv = http.server.HTTPServer(("127.0.0.1", 0), EdgeFixture) port = srv.server_port threading.Thread(target=srv.serve_forever, daemon=True).start() def check_path(path): url = f"http://127.0.0.1:{port}{path}?__cb=deadbeef01234567" req1 = urllib.request.Request(url, headers={"X-Forwarded-Host": "cache-probe.invalid"}) urllib.request.urlopen(req1, timeout=3).read() resp2 = urllib.request.urlopen(url, timeout=3) body2 = resp2.read().decode() hit2 = resp2.headers.get("CF-Cache-Status") return hit2 == "HIT" and "cache-probe.invalid" in body2 assert check_path("/vulnerable") is True, "Expected positive replay detection on /vulnerable" assert check_path("/safe") is False, "Expected negative control to stay clean on /safe" srv.shutdown() print("Staging fixture verified: positive replay detected and negative control clean.") EOF
- Flag MEDIUM (unkeyed input reflection) if
2. Supply chain and integrity (A03 / A08:2025)
- Public lockfiles and registry config. Verify that dependency manifests return
404or403in production so attackers cannot harvest the exact dependency tree:/package.json,/package-lock.json,/pnpm-lock.yaml,/yarn.lock, and on Python/Go stacks/requirements.txt,/poetry.lock,/uv.lock,/go.mod,/go.sum.- Probe
/.npmrcand/.yarnrc.ymlwith bounded, non-exfiltrating signatures (--connect-timeout 3 --max-time 5): status200and lines match^(registry|@[a-z0-9_-]+:registry|//[^:]+:_authToken|npmScopes:|npmRegistries:|npmAuthToken:|nodeLinker:)without<!DOCTYPEor<html. Report only the status code and a boolean; never print contents or token values.
- Probe
- Production source maps and SRI.
- Check whether production JS bundles expose
.js.mapfiles containing original source and business logic. - Require
integrity="sha384-..."andcrossorigin="anonymous"on third-party<script>tags loaded from external CDNs.
- Check whether production JS bundles expose
3. Transport and browser policy (A04 / A05:2025)
- HSTS and TLS posture.
- Plain
http://must redirect immediately (301/308) tohttps://, and HTTPS responses must includeStrict-Transport-Securitywith a sensiblemax-age(for examplemax-age=31536000). - Treat
includeSubDomainsandpreloadas deployment decisions, not defaults:- Add
includeSubDomainsonly after confirming every subdomain under the registered domain serves valid HTTPS. Otherwise browsers refuse connections to HTTP-only internal or legacy subdomains. - Keep
preloadsubmission a separate, explicit decision after reviewing the HSTS preload requirements. Removal from browser preload lists takes months to propagate.
- Add
- Plain
- Content-Security-Policy.
- Verify the CSP defines
default-src,script-src,object-src 'none',base-uri 'self'andframe-ancestors. - Flag
script-src 'unsafe-eval'independently whenever present. Nonces ('nonce-...') and hashes ('sha256-...') only neutralize'unsafe-inline'; they do not disableeval()or string-to-code execution. - Flag
script-src 'unsafe-inline'unless accompanied by'strict-dynamic'or per-response nonces/hashes (and nounsafe-inlinefallback in modern browsers).
- Verify the CSP defines
4. Session cookies (A07:2025)
- Every
Set-Cookiecarrying an auth or session identifier must includeHttpOnlyandSecure. - Evaluate
SameSiteand lifetime against the app's architecture:- Default to
SameSite=Lax(orStrict) for first-party flows. Only allowSameSite=None; Securewhen cross-site embedding or federation is intended and explicit anti-CSRF tokens or Fetch Metadata (Sec-Fetch-Site) checks are enforced. - Ephemeral browser-session cookies may omit
Max-AgeandExpiresso they clear on browser close. Persistent cookies must set a boundedMax-AgeorExpiresthat fits the session risk.
- Default to
5. Error surface and disclosure policy (A09 / A10:2025)
- Fail-closed errors (no stack trace leaks). Request a non-existent route (
/api/__probe_404_<random>) with--connect-timeout 3 --max-time 5and verify a clean, minimal JSON or HTML error with no stack traces (java.sql.SQLException,PrismaClientKnownRequestError,Traceback,at Object.<anonymous>,/var/task/,node_modules/). - Vulnerability disclosure policy. Verify RFC 9116 compliance at
/.well-known/security.txt:Contact:and a non-expiredExpires:field.
Remediation (nginx and Caddy)
Fix the cause first: serve a build output directory, not the repo checkout, so .git, .env, compose files and lockfiles never sit under the web root. The path blocks below are a backstop. Start the CSP as Content-Security-Policy-Report-Only if you are unsure what it will break, then switch to enforcing.
nginx:
server {
listen 80;
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
# ssl_certificate / ssl_certificate_key ...
# Add "; includeSubDomains" only after every subdomain serves HTTPS. "preload" is a separate decision.
add_header Strict-Transport-Security "max-age=31536000" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'" always;
# Dotfiles and VCS metadata (.git, .env, .npmrc, ...), keeping /.well-known/ public.
# Regex locations match in order, so keep these before other regex locations.
location ~ /\.(?!well-known/) {
return 404;
}
location ~ /(docker-compose\.ya?ml|compose\.ya?ml|package(-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|requirements\.txt|poetry\.lock|uv\.lock|go\.(mod|sum))$ {
return 404;
}
location / {
proxy_pass http://app:8000;
}
}add_header is inherited from the enclosing level only when the current level defines no add_header of its own. A location that adds any header must repeat the security headers.
Caddy (HTTP to HTTPS redirect is automatic; HSTS is not):
example.com {
header {
# Add "; includeSubDomains" only after every subdomain serves HTTPS.
Strict-Transport-Security "max-age=31536000"
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
Content-Security-Policy "default-src 'self'; script-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'"
}
# Any path segment starting with "." except /.well-known/
@dotfiles {
path */.*
not path /.well-known/*
}
respond @dotfiles 404
@manifests path */docker-compose.yml */docker-compose.yaml */compose.yaml */compose.yml */package.json */package-lock.json */pnpm-lock.yaml */yarn.lock */requirements.txt */poetry.lock */uv.lock */go.mod */go.sum
respond @manifests 404
reverse_proxy app:8000
}Cookie flags: set Secure, HttpOnly and SameSite in the app's session/cookie settings, not at the proxy. As a backstop, nginx 1.19.3+ can force them on proxied cookies with proxy_cookie_flags ~ secure httponly samesite=lax;.
Re-run the probes above after deploying and confirm the real responses changed.
Adapted from affaan-m/everything-claude-code (MIT) @3f14a10: web-perimeter-owasp-2025-audit.
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
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.

