@ericrisco/rsc 4.0.4 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/manifest.json +78 -84
- package/package.json +1 -1
- package/scripts/lib/default-skill-floor.js +5 -1
- package/scripts/lib/domains.js +1 -1
- package/scripts/lib/recommend.js +1 -1
- package/scripts/lib/retired-skills.js +4 -0
- package/scripts/skill-migration-brief.md +1 -1
- package/skills/accessibility/evals/README.md +1 -1
- package/skills/accessibility/evals/cases.yaml +1 -1
- package/skills/agent-safety/SKILL.md +2 -2
- package/skills/agent-safety/evals/README.md +1 -1
- package/skills/agent-safety/evals/cases.yaml +1 -1
- package/skills/analyze/evals/README.md +1 -1
- package/skills/analyze/evals/cases.yaml +2 -2
- package/skills/angular/SKILL.md +1 -1
- package/skills/api-connector-builder/SKILL.md +1 -1
- package/skills/api-design/SKILL.md +3 -3
- package/skills/api-design/evals/cases.yaml +1 -1
- package/skills/asdd/SKILL.md +3 -1
- package/skills/automation-strategy/SKILL.md +1 -1
- package/skills/automation-strategy/evals/README.md +1 -1
- package/skills/automation-strategy/evals/cases.yaml +2 -2
- package/skills/automation-strategy/references/orchestration-and-antipatterns.md +1 -1
- package/skills/aws-essentials/SKILL.md +3 -3
- package/skills/aws-essentials/evals/cases.yaml +2 -2
- package/skills/backups/SKILL.md +2 -2
- package/skills/backups/evals/cases.yaml +2 -2
- package/skills/bash-scripting/SKILL.md +1 -1
- package/skills/building-agents/SKILL.md +2 -2
- package/skills/building-agents/evals/cases.yaml +2 -2
- package/skills/chrome-extension/SKILL.md +1 -1
- package/skills/cloudflare/SKILL.md +1 -1
- package/skills/code-review/SKILL.md +2 -2
- package/skills/code-review/evals/cases.yaml +2 -2
- package/skills/compliance/SKILL.md +3 -3
- package/skills/compliance/evals/cases.yaml +1 -1
- package/skills/constitution/SKILL.md +2 -2
- package/skills/constitution/evals/README.md +2 -2
- package/skills/constitution/evals/cases.yaml +2 -2
- package/skills/constitution/references/constitution-template.md +1 -1
- package/skills/cpp/SKILL.md +2 -2
- package/skills/cpp/evals/README.md +1 -1
- package/skills/cpp/evals/cases.yaml +2 -2
- package/skills/csharp-dotnet/SKILL.md +3 -3
- package/skills/csharp-dotnet/evals/cases.yaml +1 -1
- package/skills/csharp-dotnet/references/aspnetcore.md +1 -1
- package/skills/data-policy/SKILL.md +2 -2
- package/skills/data-policy/evals/README.md +1 -1
- package/skills/data-policy/evals/cases.yaml +1 -1
- package/skills/debug/SKILL.md +1 -1
- package/skills/debug/evals/README.md +1 -1
- package/skills/decision-challenge/SKILL.md +2 -2
- package/skills/decision-challenge/evals/cases.yaml +1 -1
- package/skills/deployment/SKILL.md +2 -2
- package/skills/deployment/evals/README.md +1 -1
- package/skills/deployment/evals/cases.yaml +2 -2
- package/skills/django/SKILL.md +2 -2
- package/skills/django/evals/README.md +1 -1
- package/skills/django/evals/cases.yaml +1 -1
- package/skills/django/references/security.md +1 -1
- package/skills/docker/SKILL.md +3 -3
- package/skills/docker/evals/cases.yaml +1 -1
- package/skills/dynamodb/SKILL.md +2 -2
- package/skills/electron/SKILL.md +1 -1
- package/skills/electron/references/packaging-and-updates.md +1 -1
- package/skills/email-connector/SKILL.md +2 -2
- package/skills/email-deliverability/SKILL.md +1 -1
- package/skills/error-handling/SKILL.md +1 -1
- package/skills/expo/SKILL.md +2 -2
- package/skills/fastapi/SKILL.md +4 -4
- package/skills/fastapi/evals/README.md +2 -2
- package/skills/fastapi/evals/cases.yaml +2 -2
- package/skills/fastapi/references/security.md +2 -2
- package/skills/firebase/SKILL.md +1 -1
- package/skills/flutter/SKILL.md +1 -1
- package/skills/flutter/evals/cases.yaml +2 -2
- package/skills/fly-io/SKILL.md +1 -1
- package/skills/gamedev-multiplayer/SKILL.md +1 -1
- package/skills/gamedev-multiplayer/evals/README.md +1 -1
- package/skills/gamedev-multiplayer/evals/cases.yaml +2 -2
- package/skills/gamedev-shipping/SKILL.md +1 -1
- package/skills/gcp-essentials/SKILL.md +2 -2
- package/skills/gcp-essentials/evals/README.md +1 -1
- package/skills/gcp-essentials/evals/cases.yaml +2 -2
- package/skills/gdpr-privacy/SKILL.md +2 -2
- package/skills/gdpr-privacy/evals/cases.yaml +1 -1
- package/skills/github-actions/SKILL.md +2 -2
- package/skills/go/SKILL.md +4 -4
- package/skills/go/evals/README.md +1 -1
- package/skills/go/evals/cases.yaml +2 -2
- package/skills/google-workspace/SKILL.md +2 -2
- package/skills/hetzner/SKILL.md +1 -1
- package/skills/htmx/SKILL.md +4 -4
- package/skills/htmx/evals/cases.yaml +2 -2
- package/skills/implement/SKILL.md +2 -2
- package/skills/init/SKILL.md +2 -2
- package/skills/init/evals/cases.yaml +2 -2
- package/skills/init/references/discovery.md +1 -1
- package/skills/init/references/recommend-skills.md +5 -5
- package/skills/java/SKILL.md +3 -3
- package/skills/java/evals/README.md +1 -1
- package/skills/java/evals/cases.yaml +2 -2
- package/skills/laravel/SKILL.md +3 -3
- package/skills/laravel/evals/README.md +1 -1
- package/skills/laravel/evals/cases.yaml +1 -1
- package/skills/marketing/evals/README.md +1 -1
- package/skills/marketing/evals/cases.yaml +1 -1
- package/skills/mongodb/SKILL.md +2 -2
- package/skills/mongodb/evals/README.md +1 -1
- package/skills/mongodb/evals/cases.yaml +2 -2
- package/skills/nextjs/SKILL.md +3 -3
- package/skills/nextjs/evals/cases.yaml +2 -2
- package/skills/nextjs/references/security.md +2 -2
- package/skills/notion-connector/SKILL.md +3 -3
- package/skills/notion-connector/evals/README.md +1 -1
- package/skills/notion-connector/evals/cases.yaml +2 -2
- package/skills/php/SKILL.md +4 -4
- package/skills/php/evals/README.md +1 -1
- package/skills/php/evals/cases.yaml +1 -1
- package/skills/plan/evals/README.md +1 -1
- package/skills/postgresdb/SKILL.md +1 -1
- package/skills/postgresdb/evals/README.md +1 -1
- package/skills/postgresdb/evals/cases.yaml +2 -2
- package/skills/presentations/evals/README.md +1 -1
- package/skills/python/SKILL.md +3 -3
- package/skills/python/evals/README.md +1 -1
- package/skills/python/evals/cases.yaml +2 -2
- package/skills/rag/scripts/verify.sh +1 -1
- package/skills/review/SKILL.md +2 -2
- package/skills/review/evals/cases.yaml +3 -3
- package/skills/ruby/SKILL.md +1 -1
- package/skills/rust/SKILL.md +2 -2
- package/skills/rust/evals/README.md +1 -1
- package/skills/rust/evals/cases.yaml +2 -2
- package/skills/security-audit/SKILL.md +186 -0
- package/skills/security-audit/evals/cases.yaml +95 -0
- package/skills/security-audit/references/auditor-safety.md +69 -0
- package/skills/security-audit/references/classes/README.md +225 -0
- package/skills/security-audit/references/classes/ai-and-llm.md +247 -0
- package/skills/security-audit/references/classes/client-side.md +181 -0
- package/skills/security-audit/references/classes/cloud-and-deployment.md +167 -0
- package/skills/security-audit/references/classes/data-isolation.md +161 -0
- package/skills/security-audit/references/classes/desktop-mobile-ipc.md +167 -0
- package/skills/security-audit/references/classes/memory-and-binary.md +230 -0
- package/skills/security-audit/references/classes/protocols-and-messaging.md +151 -0
- package/skills/security-audit/references/classes/resource-exhaustion.md +141 -0
- package/skills/security-audit/references/classes/supply-chain.md +147 -0
- package/skills/security-audit/references/classes/web-and-auth.md +238 -0
- package/skills/security-audit/references/coverage-ledger.md +172 -0
- package/skills/security-audit/references/fixes-by-stack.md +972 -0
- package/skills/security-audit/references/fixing.md +200 -0
- package/skills/security-audit/references/hunting.md +146 -0
- package/skills/security-audit/references/isolated-execution.md +85 -0
- package/skills/security-audit/references/platforms.md +650 -0
- package/skills/security-audit/references/reconnaissance.md +73 -0
- package/skills/security-audit/references/resuming.md +55 -0
- package/skills/security-audit/references/scanners.md +347 -0
- package/skills/{secure-coding → security-audit}/references/secrets-and-supply-chain.md +78 -34
- package/skills/security-audit/references/secrets-discipline.md +173 -0
- package/skills/{secure-coding → security-audit}/references/threat-modeling.md +80 -32
- package/skills/security-audit/references/verification.md +118 -0
- package/skills/security-audit/schema/findings.schema.json +178 -0
- package/skills/security-audit/scripts/render-report.mjs +311 -0
- package/skills/security-audit/scripts/validate-findings.mjs +508 -0
- package/skills/skill-scout/scripts/verify.sh +1 -1
- package/skills/source-grounded-development/evals/cases.yaml +1 -1
- package/skills/specify/evals/README.md +1 -1
- package/skills/spring-boot/SKILL.md +3 -3
- package/skills/spring-boot/evals/README.md +1 -1
- package/skills/spring-boot/evals/cases.yaml +1 -1
- package/skills/spring-boot/references/security.md +1 -1
- package/skills/stripe/SKILL.md +2 -2
- package/skills/suggest/evals/cases.yaml +2 -2
- package/skills/supabase/SKILL.md +1 -1
- package/skills/tauri/SKILL.md +2 -2
- package/skills/testing-go/SKILL.md +1 -1
- package/skills/typescript/SKILL.md +2 -2
- package/skills/verify/SKILL.md +3 -3
- package/skills/verify/evals/README.md +2 -2
- package/skills/verify/evals/cases.yaml +2 -2
- package/skills/vue-nuxt/SKILL.md +2 -2
- package/skills/webhooks/SKILL.md +2 -2
- package/skills/wordpress/SKILL.md +2 -2
- package/skills/wordpress/evals/README.md +1 -1
- package/skills/wordpress/evals/cases.yaml +1 -1
- package/skills/worktrees/evals/README.md +1 -1
- package/targets/claude.js +23 -1
- package/targets/clone-bootstrap.mjs +1 -1
- package/targets/commands.js +1 -1
- package/skills/secure-coding/SKILL.md +0 -336
- package/skills/secure-coding/evals/README.md +0 -68
- package/skills/secure-coding/evals/cases.yaml +0 -55
- package/skills/secure-coding/references/authn-authz.md +0 -249
- package/skills/secure-coding/references/owasp-by-stack.md +0 -574
- package/skills/secure-coding/scripts/verify.sh +0 -208
- package/skills/security-scan/SKILL.md +0 -219
- package/skills/security-scan/evals/README.md +0 -14
- package/skills/security-scan/evals/cases.yaml +0 -50
- package/skills/security-scan/references/tools.md +0 -97
- package/skills/security-scan/references/triage.md +0 -92
- package/skills/security-scan/scripts/verify.sh +0 -108
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Attack classes
|
|
2
|
+
|
|
3
|
+
Load when: you are choosing what to hunt after reconnaissance, or you need the exact `class` id
|
|
4
|
+
for a finding in `findings.json`. Verdict rules (`confirmed`, `needs_validation`, rejected) live in
|
|
5
|
+
[`../verification.md`](../verification.md); this folder only says what to look for.
|
|
6
|
+
|
|
7
|
+
## How to use this folder
|
|
8
|
+
|
|
9
|
+
1. Read the target map from reconnaissance. Pick only the classes that fit the code you have. A
|
|
10
|
+
CLI with no network listener does not need CSRF; a static site does not need MCP identity.
|
|
11
|
+
2. Always run the core catalog below. Then load each domain file whose "load when" matches.
|
|
12
|
+
3. Split big targets by subsystem (auth, billing, import, agent tools) and run the chosen classes
|
|
13
|
+
per subsystem, not once for the whole repository.
|
|
14
|
+
4. Stay inside safe validation: read source, run bounded local fixtures with dummy data. Never
|
|
15
|
+
build payload chains, never test availability against a live service, never touch shared
|
|
16
|
+
environments.
|
|
17
|
+
5. Every finding carries one `class` id from this folder. If two ids fit, pick the one that names
|
|
18
|
+
the broken control (where the fix goes), and mention the other in the narrative.
|
|
19
|
+
|
|
20
|
+
## Domain files
|
|
21
|
+
|
|
22
|
+
| File | Load when |
|
|
23
|
+
|------|-----------|
|
|
24
|
+
| [`ai-and-llm.md`](ai-and-llm.md) | A model reads untrusted content or its output drives tools, memory, MCP calls, rendering or any decision with authority (chatbots, RAG, agents, prompt builders). |
|
|
25
|
+
| [`web-and-auth.md`](web-and-auth.md) | The target parses or caches HTTP, sits behind a proxy/CDN, or issues and checks identity: JWT, OAuth/OIDC, SAML, passkeys, MFA, cookie sessions and CSRF, recovery, account linking, API keys, mTLS. |
|
|
26
|
+
| [`client-side.md`](client-side.md) | Trust decisions or rendering happen in a browser: SPAs, extensions, webviews, service workers, browser storage, `postMessage`, CORS, WebSockets, DOM sinks. |
|
|
27
|
+
| [`supply-chain.md`](supply-chain.md) | The repo resolves dependencies, generates code, runs CI, builds, signs, promotes or ships updates, or loads plugins and extensions. |
|
|
28
|
+
| [`cloud-and-deployment.md`](cloud-and-deployment.md) | The repo defines IAM, infrastructure as code, containers, Kubernetes, mesh, serverless or edge functions, ingress, buckets, provider events or per-environment config. |
|
|
29
|
+
| [`memory-and-binary.md`](memory-and-binary.md) | Native or low-level code: C, C++, unsafe Rust, FFI, kernel modules, parsers and decoders, binary loaders, JITs, firmware, lock-free or concurrent runtimes. |
|
|
30
|
+
| [`protocols-and-messaging.md`](protocols-and-messaging.md) | gRPC, GraphQL transports, Protobuf/Thrift/Cap'n Proto, custom wire protocols, queues, brokers, pub/sub, webhooks, streaming RPC. |
|
|
31
|
+
| [`resource-exhaustion.md`](resource-exhaustion.md) | Untrusted work can burn shared CPU, memory, disk, connections, workers, queue depth, quotas or money the operator pays for. |
|
|
32
|
+
| [`data-isolation.md`](data-isolation.md) | Multi-tenant stores, shared caches or search indexes, object links, analytics, export and backup, migrations, deletion, retention, restore. |
|
|
33
|
+
| [`desktop-mobile-ipc.md`](desktop-mobile-ipc.md) | Native desktop or mobile apps and what they expose on the device: URL schemes and deep links, exported components, the bridge between a webview and native code, local daemons and privileged helpers, IPC over Unix sockets, D-Bus, XPC or Binder. |
|
|
34
|
+
|
|
35
|
+
Each domain file defines its own ids. The ids in this README are the core set; domain ids never
|
|
36
|
+
reuse a core id with a different meaning.
|
|
37
|
+
|
|
38
|
+
## Core catalog
|
|
39
|
+
|
|
40
|
+
The core catalog applies to almost every codebase. For each class: what breaks, where to look,
|
|
41
|
+
and the line between a finding and a note.
|
|
42
|
+
|
|
43
|
+
### Injection
|
|
44
|
+
|
|
45
|
+
| id | What it is |
|
|
46
|
+
|----|------------|
|
|
47
|
+
| `injection` | Untrusted data reaches an interpreter or dangerous sink without the encoding or parameterisation that sink needs. |
|
|
48
|
+
| `second-order-injection` | Data is stored safely, later read by other code and used in a context where it becomes dangerous. |
|
|
49
|
+
|
|
50
|
+
**Sinks by target type.**
|
|
51
|
+
|
|
52
|
+
- Web apps: SQL and ORM raw queries, HTML output, template engines, shell, file paths, HTTP
|
|
53
|
+
redirects, deserialisers.
|
|
54
|
+
- Libraries: any function that processes caller bytes without checks: buffer ops, parsers,
|
|
55
|
+
format strings.
|
|
56
|
+
- CLI tools: command lines built from strings, path handling, environment variable expansion.
|
|
57
|
+
- Services: query builders, message serialisation, log lines, LDAP and XPath filters.
|
|
58
|
+
- Browser code: DOM XSS, prototype pollution, `postMessage` trust; use the `client-side.md` ids.
|
|
59
|
+
|
|
60
|
+
**Where people stop too early.** Values are not the only carrier. Check field names, object keys,
|
|
61
|
+
header names and metadata. Check secondary systems the input lands in: logs, caches, search
|
|
62
|
+
indexes, analytics pipelines. For `second-order-injection`, look for a field name that becomes a
|
|
63
|
+
JSON path, a slug that becomes a file path, escaped text that later renders raw, or a stored
|
|
64
|
+
string that is later treated as a URL, a regular expression, a template or a policy rule.
|
|
65
|
+
|
|
66
|
+
**Grep starts.** `query(` with `+` or template literals, `raw(`, `exec(`, `system(`,
|
|
67
|
+
`subprocess` with `shell=True`, `child_process`, `eval(`, `Function(`, `vm.runInContext`,
|
|
68
|
+
dynamic `import()`, `render_template_string`, `| safe`, `dangerouslySetInnerHTML`,
|
|
69
|
+
`pickle.loads`, `yaml.load` without a safe loader, `ObjectInputStream`.
|
|
70
|
+
|
|
71
|
+
**Only a note.** A sink fed only by constants or by the caller's own trusted config; a value the
|
|
72
|
+
framework already escapes for that exact context.
|
|
73
|
+
|
|
74
|
+
### Access control
|
|
75
|
+
|
|
76
|
+
| id | What it is |
|
|
77
|
+
|----|------------|
|
|
78
|
+
| `broken-access-control` | A caller can read or change something outside its authority. |
|
|
79
|
+
| `authn-without-authz` | An endpoint checks that the caller is logged in, never that it may touch this resource. |
|
|
80
|
+
| `mass-assignment` | A request body field overrides what the permission model meant to fix (owner, role, tenant, price). |
|
|
81
|
+
| `inconsistent-access-paths` | The same resource or state change has several routes and at least one checks a weaker permission. |
|
|
82
|
+
| `bulk-operation-authz` | Batch, bulk, export or import paths skip the per-item check the single-item path applies. |
|
|
83
|
+
|
|
84
|
+
Do not stop at "a check exists". Confirm it is the right permission, on the right resource, through
|
|
85
|
+
the right mechanism. Enumerate every route to the same state change (REST, GraphQL, admin, jobs,
|
|
86
|
+
legacy versions) and compare their checks side by side. For complex models, hunt authentication
|
|
87
|
+
bypass and authorisation logic as separate passes.
|
|
88
|
+
|
|
89
|
+
**Grep starts.** Route tables and middleware lists, `@login_required` without a permission
|
|
90
|
+
decorator, `findById(req.params.id)` without an owner filter, `update(req.body)`,
|
|
91
|
+
`Object.assign(model, body)`, `**request.data`.
|
|
92
|
+
|
|
93
|
+
### Resource and file handling
|
|
94
|
+
|
|
95
|
+
| id | What it is |
|
|
96
|
+
|----|------------|
|
|
97
|
+
| `path-traversal` | Reads or writes escape the intended directory, through `..`, encoded sequences, absolute paths, symlinks or NUL bytes. |
|
|
98
|
+
| `ssrf` | The server fetches a URL the attacker controls, also reachable via redirect chains, DNS rebinding, or two URL parsers that disagree. Webhook, callback and notification URLs belong here. |
|
|
99
|
+
| `unsafe-deserialization` | Untrusted bytes go into a deserialiser that can build arbitrary objects or run code. |
|
|
100
|
+
| `archive-extraction` | Archive entries (zip slip, tar links) write outside the extraction root or overwrite files. |
|
|
101
|
+
| `temp-file-handling` | Predictable or shared temp paths let another local principal read, replace or pre-create the file. |
|
|
102
|
+
| `file-toctou` | A file is checked, then used, and the path can change between the two. |
|
|
103
|
+
| `memory-safety` | Buffer overflow, use-after-free, integer overflow in native code. Use the detailed ids in `memory-and-binary.md` when that file is loaded. |
|
|
104
|
+
|
|
105
|
+
**Where to look.** `open(`/`fs.readFile` with joined user input, `path.join` without a
|
|
106
|
+
`realpath` + prefix check afterwards, `send_file`, upload handlers, `ZipFile.extractall`,
|
|
107
|
+
`tar.extractall`, `requests.get(user_url)`, `fetch(url)` on the server, image and PDF renderers
|
|
108
|
+
that load remote resources, `mktemp`, `/tmp/` literals, `os.access` followed by `open`.
|
|
109
|
+
|
|
110
|
+
**Only a note.** Fetchers restricted to a fixed allowlist resolved after redirects; paths resolved
|
|
111
|
+
and prefix-checked after symlink resolution.
|
|
112
|
+
|
|
113
|
+
### Cryptography and secrets
|
|
114
|
+
|
|
115
|
+
| id | What it is |
|
|
116
|
+
|----|------------|
|
|
117
|
+
| `weak-randomness` | Tokens, keys, nonces or reset codes come from a non-cryptographic generator (`Math.random`, `random.random`, time seeds). |
|
|
118
|
+
| `hardcoded-secret` | A live credential sits in source, config, history, fixtures or images. |
|
|
119
|
+
| `secret-exposure` | A secret leaks into logs, error messages, URLs, client-visible responses or bundles. |
|
|
120
|
+
| `broken-crypto-construction` | Broken key derivation, missing or skipped HMAC verification, nonce or IV reuse, static IVs. |
|
|
121
|
+
| `crypto-primitive-misuse` | ECB mode, unauthenticated encryption, homemade schemes, wrong primitive for the job. |
|
|
122
|
+
| `timing-side-channel` | Secrets compared with early-exit equality (`==`, `strcmp`) instead of a constant-time compare. |
|
|
123
|
+
| `crypto-fail-open` | When a crypto call throws or a key is missing, the code continues without encryption or verification. |
|
|
124
|
+
|
|
125
|
+
**Only a note.** A "secret" that is a public identifier (publishable key, key id); a timing
|
|
126
|
+
difference on a value that is not secret.
|
|
127
|
+
|
|
128
|
+
### Business logic
|
|
129
|
+
|
|
130
|
+
Scanners do not find these. Walk each major workflow by hand.
|
|
131
|
+
|
|
132
|
+
| id | What it is |
|
|
133
|
+
|----|------------|
|
|
134
|
+
| `state-machine-violation` | Steps can be skipped, reversed, replayed after completion, or left half-done when a later step fails without rollback. |
|
|
135
|
+
| `business-race-condition` | Non-atomic check-then-act lets concurrent calls double-spend, double-approve or lose updates. |
|
|
136
|
+
| `numeric-manipulation` | Negative, zero, huge, fractional or string-typed quantities break totals, limits or balances. |
|
|
137
|
+
| `business-rule-bypass` | The check exists but enforces the wrong rule, or input to one operation reaches an effect another operation restricts. |
|
|
138
|
+
| `implicit-trust` | Data from storage, config, another component or a plugin is trusted because "it was validated on the way in", but a different writer exists. |
|
|
139
|
+
| `time-logic-flaw` | Expiry, scheduling, rate windows, clock skew, exact-boundary instants or timezone mismatches give wrong decisions. |
|
|
140
|
+
| `insecure-default` | Missing config, a flag turned off, a dependency down or a half-run migration leaves the system open instead of closed. |
|
|
141
|
+
|
|
142
|
+
**Where to look.** `status ==` checks without a transition table, balance or stock updates done
|
|
143
|
+
as read-then-write without a lock or conditional update, `parseInt`/`float` on amounts, `except:
|
|
144
|
+
pass` around a step that should abort the flow, `if not config.get(...)` that skips a check,
|
|
145
|
+
`datetime.now()` compared against stored values from another zone.
|
|
146
|
+
|
|
147
|
+
### Feature abuse and data leakage
|
|
148
|
+
|
|
149
|
+
Legitimate features used for something they were not meant for. Look at the design, not only the code.
|
|
150
|
+
|
|
151
|
+
| id | What it is |
|
|
152
|
+
|----|------------|
|
|
153
|
+
| `export-exfiltration` | A low-privilege user triggers an export, snapshot or backup that holds data above their level: other users, deleted or draft content, revisions meant to be pruned. |
|
|
154
|
+
| `import-injection` | Import or restore overwrites existing records, skips normal validation, or writes into collections the user cannot write through the UI. |
|
|
155
|
+
| `search-oracle` | Search, filters or sort order reveal the existence or value of hidden records, statuses, roles or fields. |
|
|
156
|
+
| `enumeration-side-channel` | Different errors, status codes, sizes or timings separate "does not exist" from "no access", or reset/invite/signup flows list accounts. |
|
|
157
|
+
| `preview-leakage` | Preview tokens unlock more than one item; drafts surface through search, RSS, sitemaps or list APIs; cache headers let a CDN serve private content publicly. |
|
|
158
|
+
|
|
159
|
+
Callback and webhook URLs fetched by the server use `ssrf`.
|
|
160
|
+
|
|
161
|
+
**Only a note.** Enumeration of identities that are already public (usernames shown on profiles).
|
|
162
|
+
|
|
163
|
+
### Chained vulnerabilities and trust boundaries
|
|
164
|
+
|
|
165
|
+
Two behaviours that are each fine can combine into a break when a later step relies on a stronger
|
|
166
|
+
guarantee than an earlier step gives.
|
|
167
|
+
|
|
168
|
+
| id | What it is |
|
|
169
|
+
|----|------------|
|
|
170
|
+
| `multi-step-chain` | Low-privilege reads, writes, calls and retained data connect into a later trust decision. Confirm each link; never assume a downstream effect. |
|
|
171
|
+
| `cross-component-trust-gap` | Component A validates and hands to B, but B assumes more than A guarantees: truncation, type coercion, normalisation, tenant scope, plugin access. |
|
|
172
|
+
| `capability-growth` | What an OAuth grant, API key, token, plugin, MCP server or AI agent may do grows once it is delegated, refreshed, cached, combined with something else, or its role changes. State the precise operation the widened principal should not be able to perform. |
|
|
173
|
+
| `ordering-window` | Setup, migration, soft delete, revoke-vs-cache expiry, check-vs-use or validate-vs-consume windows accept stale state. Confirm the stale state is actually accepted. |
|
|
174
|
+
| `rollback-restore-bypass` | Undelete, restore, revision rollback or cancel brings back an invalid state without re-applying current ownership, validation and authorisation. |
|
|
175
|
+
|
|
176
|
+
(`second-order-injection` above is the data-flow member of this family.)
|
|
177
|
+
|
|
178
|
+
### Wildcard
|
|
179
|
+
|
|
180
|
+
| id | What it is |
|
|
181
|
+
|----|------------|
|
|
182
|
+
| `wildcard` | A real boundary break that fits no other id. Same proof bar as every other class. |
|
|
183
|
+
|
|
184
|
+
Prompts for the wildcard pass: the strangest code in the repo and why it exists; half-built,
|
|
185
|
+
experimental or bolted-on features; API calls the frontend never makes; routes, params, headers
|
|
186
|
+
or flags missing from the docs; features that were never designed to meet (localisation + preview
|
|
187
|
+
+ cache, import + plugins + webhooks, OAuth + impersonation + API keys); reverted security fixes,
|
|
188
|
+
commented-out checks and removed secrets in git history; actions by a valid account that hurt
|
|
189
|
+
others, shared integrity, availability or the operator's bill; irreversible operations and
|
|
190
|
+
whether approval binds to the final principal, action and resource; environment assumptions
|
|
191
|
+
(local database, honest clock, trustworthy DNS, case-sensitive filesystem); edge cases the tests
|
|
192
|
+
skip. Read anything named `temp`, `hack` or `legacy`. If a comment claims something is safe,
|
|
193
|
+
verify the claim.
|
|
194
|
+
|
|
195
|
+
### Obvious exposures
|
|
196
|
+
|
|
197
|
+
A literal checklist. Every item gets a result, even "clean". A matching pattern is a lead, not a
|
|
198
|
+
finding: trace the impact first (is that cookie actually sensitive, does JS need to read it, is
|
|
199
|
+
that error field ever filled with private data).
|
|
200
|
+
|
|
201
|
+
| id | Check |
|
|
202
|
+
|----|-------|
|
|
203
|
+
| `hardcoded-secret` | Grep `password`, `secret`, `apikey`, `api_key`, `token`, `Bearer `, `-----BEGIN`, common default passwords. |
|
|
204
|
+
| `security-todo` | `TODO`/`FIXME`/`HACK`/`XXX` that mention auth, validation, permissions or "skip check". Report only when the gap is real in shipped code. |
|
|
205
|
+
| `debug-mode-exposure` | Debug or dev mode switchable in production by env var, query param or header. |
|
|
206
|
+
| `default-credentials` | Seed, demo, test or example accounts that still work in production. |
|
|
207
|
+
| `exposed-admin-endpoint` | Unprotected `/debug`, `/admin`, `/test`, `/status`, `/metrics`, `/env`, `/.env`, `/config`, actuator-style routes. Health checks that return only "ok" are notes. |
|
|
208
|
+
| `committed-secret-file` | `.env`, `.env.local`, `credentials.json`, `*.pem`, `*.key`, `id_rsa`, keystores in the repo or its history. |
|
|
209
|
+
| `gitignore-gap` | `.gitignore` misses secrets, uploads or local config that the code writes. Note unless a secret actually landed. |
|
|
210
|
+
| `vulnerable-dependency` | Unpinned ranges or lockfile versions with known CVEs. A finding only if the vulnerable path is reachable from the target. |
|
|
211
|
+
| `dynamic-code-execution` | `eval`, `exec`, `Function`, `vm.runInContext`, `child_process`, dynamic `import()` fed by non-constant input. |
|
|
212
|
+
| `credentialed-cors` | `Access-Control-Allow-Origin` reflected or `*` together with credentials. Details in `client-side.md`. |
|
|
213
|
+
| `cookie-scope-transport` | Session cookies missing `HttpOnly`, `Secure`, `SameSite` or with a broad `Domain`. Details in `web-and-auth.md`. |
|
|
214
|
+
| `open-redirect` | Params named `redirect`, `return`, `returnTo`, `next`, `url`, `goto`, `continue`, `callback` feeding a redirect without an allowlist. |
|
|
215
|
+
| `missing-tls` | Plain HTTP endpoints, TLS verification turned off (`verify=False`, `rejectUnauthorized: false`, `InsecureSkipVerify`). |
|
|
216
|
+
| `verbose-errors` | Production responses carrying stack traces, internal paths, SQL errors or config values. |
|
|
217
|
+
|
|
218
|
+
## Proof shape for every class
|
|
219
|
+
|
|
220
|
+
Before a candidate leaves the hunt, it must name: the attacker principal, the boundary it crosses,
|
|
221
|
+
the source and the sink (or the missing check), and the observed result from source reading or a
|
|
222
|
+
bounded local fixture. When a deployment, provider, identity or runtime fact cannot be seen
|
|
223
|
+
locally, the verdict is `needs_validation` and the finding states the missing fact plus the safe
|
|
224
|
+
check (owner-observed or local) that would settle it. The full rules are in
|
|
225
|
+
[`../verification.md`](../verification.md).
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# AI, LLM and agent classes
|
|
2
|
+
|
|
3
|
+
Load when: a language model takes part in anything with authority. Chatbots, assistants, RAG,
|
|
4
|
+
long-term agent memory, tool-calling loops, MCP servers or clients, code that builds prompts from
|
|
5
|
+
outside text, code that acts on model output. Verdict rules: [`../verification.md`](../verification.md).
|
|
6
|
+
|
|
7
|
+
The flow to follow is always the same: **untrusted text → model or memory → authority, capability
|
|
8
|
+
or sink**. The ordinary core classes still apply around the model (transport, access control,
|
|
9
|
+
queries, files, rendering). This file covers the delegation layer the model adds. On a large
|
|
10
|
+
target, split the hunt into retrieval, memory, tool dispatch, MCP and output.
|
|
11
|
+
|
|
12
|
+
## Ground rules
|
|
13
|
+
|
|
14
|
+
Put these in every prompt for a hunter working in this domain.
|
|
15
|
+
|
|
16
|
+
1. **Guardrail prompts are not a security boundary.** "Never reveal X", "only call tools the user
|
|
17
|
+
asked for", a moderation model, a classifier, a system prompt in capitals: none of these count
|
|
18
|
+
as a control. Only deterministic code counts: authorisation scoped to the resource, isolation,
|
|
19
|
+
binding of an approval to the exact action, credentials narrowed to the task. If the only thing
|
|
20
|
+
between attacker text and a harmful action is the model's obedience, the control is missing.
|
|
21
|
+
2. **Prompt injection by itself is not a finding.** The model being talked into saying something
|
|
22
|
+
odd is expected behaviour of the technology. It becomes a finding only when it crosses a
|
|
23
|
+
boundary in code:
|
|
24
|
+
- it reaches **another principal's context** (a victim's session, another tenant);
|
|
25
|
+
- it **triggers an action** with authority the attacker does not have, or one the victim did
|
|
26
|
+
not ask for;
|
|
27
|
+
- it **discloses data** the attacker cannot read directly (exfiltration through output, links,
|
|
28
|
+
image URLs, tool calls);
|
|
29
|
+
- it **drives a sink** the attacker cannot reach directly (shell, SQL, file, URL fetch, payment).
|
|
30
|
+
3. **Everything the model reads from outside is untrusted input.** Model output, retrieved
|
|
31
|
+
documents, memory entries, tool results, tool descriptions, MCP responses and sub-agent
|
|
32
|
+
results are attacker-reachable data. Point at the line of code that grants authority to that
|
|
33
|
+
data, trusts it, writes it to durable state or passes it to a sink.
|
|
34
|
+
4. **Name the actors.** Attacker; affected principal; effective execution identity (whose
|
|
35
|
+
credential the tool uses); resource; exact action; authority used; observable impact. A user
|
|
36
|
+
who deliberately asks the agent to use the user's own permissions is not a delegation bug just
|
|
37
|
+
because a model executed it.
|
|
38
|
+
5. **Authorisation and action binding are two different controls.** A request can pass
|
|
39
|
+
authorisation and still be a finding: when attacker-controlled content makes the agent act
|
|
40
|
+
under a victim's valid authority and the victim never intentionally requested or approved that
|
|
41
|
+
exact action.
|
|
42
|
+
|
|
43
|
+
## Context, retrieval and memory
|
|
44
|
+
|
|
45
|
+
### `indirect-prompt-injection`
|
|
46
|
+
|
|
47
|
+
**What it is.** Someone who can write content (a RAG document, a web page that gets indexed, a
|
|
48
|
+
file, an email, a ticket or issue body, a tool response, metadata like filenames or alt text)
|
|
49
|
+
gets that content into a **different principal's** model context, where a capability is live.
|
|
50
|
+
|
|
51
|
+
**Where to look.** Ingestion jobs and connectors; retrieval queries and their filters; the code
|
|
52
|
+
that splices retrieved chunks into the prompt; which tools are enabled in the session that
|
|
53
|
+
consumes them. Map, per source: who can write it, how retrieval scopes it, whose session reads it.
|
|
54
|
+
|
|
55
|
+
**How to prove.** Three separate checks: is the source isolated from the victim's context; does the
|
|
56
|
+
tool re-check authorisation on the resource; is the resulting action bound to what the consuming
|
|
57
|
+
principal actually intended. The finding is the missing deterministic control. Persuasive text on
|
|
58
|
+
its own proves nothing.
|
|
59
|
+
|
|
60
|
+
**Only a note.** The attacker injects into their own session and only gets their own authority.
|
|
61
|
+
|
|
62
|
+
### `context-bleed`
|
|
63
|
+
|
|
64
|
+
**What it is.** Chat history, embeddings, retrieval hits or prompt caches are keyed too broadly,
|
|
65
|
+
so one session, user or tenant sees another's context.
|
|
66
|
+
|
|
67
|
+
**Where to look.** Vector-store queries without a tenant or ACL filter in the query itself; cache
|
|
68
|
+
keys built from prompt text only; conversation stores keyed by a guessable or shared id; batch and
|
|
69
|
+
reindex paths. A `tenant_id` column on the record is not enforcement if some query, cache or batch
|
|
70
|
+
job leaves it out.
|
|
71
|
+
|
|
72
|
+
**How to prove.** Show a write by principal A and a read path for principal B that returns it, with
|
|
73
|
+
the missing filter or key component cited.
|
|
74
|
+
|
|
75
|
+
### `memory-poisoning`
|
|
76
|
+
|
|
77
|
+
**What it is.** Attacker content, or a model summary of attacker content, is written into
|
|
78
|
+
persistent memory and later shapes another task, another user or a more privileged session.
|
|
79
|
+
|
|
80
|
+
**Where to look.** Every create, update, merge and delete path into memory. Check: who may write;
|
|
81
|
+
what provenance and tenant scope is stored; whether a low-trust observation can become a durable
|
|
82
|
+
"fact" or "instruction"; whether retrieval keeps user preferences apart from tool policy;
|
|
83
|
+
auto-summarisation and "remember this" tools that the model can call on its own.
|
|
84
|
+
|
|
85
|
+
**How to prove.** Cite both ends: where the attacker writes, and where a different principal (or a privileged decision) later reads it back. A shared record with no reachable consumer is not enough.
|
|
86
|
+
|
|
87
|
+
**Only a note.** A user deliberately saves a memory and it only affects that same user's own
|
|
88
|
+
allowed requests.
|
|
89
|
+
|
|
90
|
+
### `prompt-provenance-confusion`
|
|
91
|
+
|
|
92
|
+
**What it is.** Prompt assembly lets untrusted text pass as a system message, an earlier turn, a
|
|
93
|
+
tool result, a policy or a memory record.
|
|
94
|
+
|
|
95
|
+
**Where to look.** String concatenation of roles; untyped history arrays; a `role` field the caller
|
|
96
|
+
can set; serialise-then-parse round trips that drop source labels; delimiters that user text can
|
|
97
|
+
close (`</tool_result>`, `### System`).
|
|
98
|
+
|
|
99
|
+
**How to prove.** Show that the forged label changes a deterministic trust decision in code (for
|
|
100
|
+
example, the dispatcher only allows a tool when the "system" turn mentions it) or unlocks a real
|
|
101
|
+
capability. A model that merely "believes" the fake label is rule 2.
|
|
102
|
+
|
|
103
|
+
## Tools and actions
|
|
104
|
+
|
|
105
|
+
### `tool-argument-injection`
|
|
106
|
+
|
|
107
|
+
**What it is.** Arguments produced by the model flow into SQL, shell, file paths, URL fetches or
|
|
108
|
+
privileged APIs with no validation in the handler.
|
|
109
|
+
|
|
110
|
+
**Where to look.** Treat the tool schema as an input parser. Follow each field from the decoded
|
|
111
|
+
call to its sink: `subprocess` with model strings, `open(args.path)`, `fetch(args.url)` (also
|
|
112
|
+
`ssrf`), raw query builders, `eval` on model code.
|
|
113
|
+
|
|
114
|
+
**How to prove.** Trace field to sink, show the missing handler-side check. A JSON schema or
|
|
115
|
+
structured output constrains shape only. It does not make a path safe, a URL internal-only, a
|
|
116
|
+
query parameterised or a caller authorised.
|
|
117
|
+
|
|
118
|
+
### `excessive-agency`
|
|
119
|
+
|
|
120
|
+
**What it is.** Confused deputy. The agent runs tools under a service account or broad
|
|
121
|
+
credential, and the handler never re-checks whether the **requesting** principal may do this
|
|
122
|
+
operation on this resource.
|
|
123
|
+
|
|
124
|
+
**Where to look.** Tool handlers that read a global client or admin token; handlers that take
|
|
125
|
+
`user_id` or `tenant_id` from tool arguments instead of the authenticated session; tools that
|
|
126
|
+
reach internal APIs the product UI never exposes.
|
|
127
|
+
|
|
128
|
+
**How to prove.** Show that the handler skips any check tying the requester to the resource, and that the normal product would refuse the attacker this same operation.
|
|
129
|
+
|
|
130
|
+
**Only a note.** A shared credential where every query is still scoped to the requesting user.
|
|
131
|
+
|
|
132
|
+
### `action-binding`
|
|
133
|
+
|
|
134
|
+
**What it is.** The approval or intent does not bind to what actually executes. Two shapes:
|
|
135
|
+
|
|
136
|
+
- The user approves one described action, and execution runs with changed arguments, another
|
|
137
|
+
resource, another principal, or on a later model turn.
|
|
138
|
+
- Text planted by the attacker makes the agent produce a side effect using the victim's legitimate permissions, and the victim never meant to ask for it or approve it. Passing a generic permission check does not clear this.
|
|
139
|
+
|
|
140
|
+
**Where to look.** Confirmation dialogs that show a model-written summary instead of the real
|
|
141
|
+
call; approvals stored as "yes" without the call object; approval tokens without expiry; batch
|
|
142
|
+
approvals; retries and resumed sessions that replay an approval. The approved object should pin:
|
|
143
|
+
normalised tool name, the full argument object, requester, target, amount, expiry, batch
|
|
144
|
+
membership. The strongest gate belongs at the point where the arguments can no longer change, ahead of each side effect.
|
|
145
|
+
|
|
146
|
+
**How to prove.** Establish the intentional request or the approved normalised object (if any).
|
|
147
|
+
Compare it field by field with the object the handler executes. Show, in a local fixture, an
|
|
148
|
+
unrequested action, a mutated or duplicate side effect, or an authority change. Stop there; do not
|
|
149
|
+
carry the test into a harmful execution.
|
|
150
|
+
|
|
151
|
+
### `tool-schema-mismatch`
|
|
152
|
+
|
|
153
|
+
**What it is.** Schema and dispatcher disagree: aliases, extra fields, duplicate keys, type
|
|
154
|
+
coercion, nested free-form objects, out-of-range values that the validator accepts and the
|
|
155
|
+
handler reads differently.
|
|
156
|
+
|
|
157
|
+
**Where to look.** Schema validation, canonicalisation, generated bindings, handler defaults.
|
|
158
|
+
Re-validate wherever a value becomes a resource selector or a security option.
|
|
159
|
+
|
|
160
|
+
**How to prove.** Diff the object the validator approved (after normalisation) against the one the handler consumes, and show a difference that matters for security.
|
|
161
|
+
|
|
162
|
+
### `unbounded-agent-loop`
|
|
163
|
+
|
|
164
|
+
**What it is.** A single bounded request can queue repeated spend, sends, mutations or external API
|
|
165
|
+
calls with no per-request budget, per-action authorisation, cancellation or idempotency key.
|
|
166
|
+
|
|
167
|
+
**Where to look.** Agent loops without max-steps or cost caps; tools that send email, post,
|
|
168
|
+
charge, or call paid APIs; retry wrappers around side-effecting tools.
|
|
169
|
+
|
|
170
|
+
**How to prove.** Show damage to other users, durable state, quotas or money the operator pays, by reading the budget logic in code and running a loop capped locally. Never exhaust a real service to prove it.
|
|
171
|
+
|
|
172
|
+
## MCP and sub-agents
|
|
173
|
+
|
|
174
|
+
### `delegation-trust-inheritance`
|
|
175
|
+
|
|
176
|
+
**What it is.** A sub-agent or MCP call receives the whole session, credentials, memory or tool set
|
|
177
|
+
instead of the least authority the task needs, or its result is trusted on the way back.
|
|
178
|
+
|
|
179
|
+
**Where to look.** The principal and tenant passed into each delegated call; whether capabilities
|
|
180
|
+
are narrowed; the audience of forwarded credentials; how returned results are labelled before
|
|
181
|
+
they re-enter the parent context (they are untrusted input, rule 3).
|
|
182
|
+
|
|
183
|
+
### `mcp-identity-confusion`
|
|
184
|
+
|
|
185
|
+
**What it is.** Calls or results are routed by names an attacker can influence (server name, tool
|
|
186
|
+
name, request id, resource URI, model-chosen alias) instead of by the authenticated connection
|
|
187
|
+
and the outstanding request.
|
|
188
|
+
|
|
189
|
+
**Where to look.** Tool registries keyed by bare tool name; two servers allowed to register the
|
|
190
|
+
same tool or resource name; reconnect logic that rebinds names; response handlers that match only
|
|
191
|
+
on request id across connections; namespacing that the model can pick.
|
|
192
|
+
|
|
193
|
+
**How to prove.** Verify authenticated connection, request correlation, tool namespace and the
|
|
194
|
+
credential each call actually uses. If it depends on external server identity or deployed routing,
|
|
195
|
+
the verdict is `needs_validation`.
|
|
196
|
+
|
|
197
|
+
### `mcp-metadata-as-policy`
|
|
198
|
+
|
|
199
|
+
**What it is.** Schemas, prompt templates, descriptions of tools, completion suggestions or resource metadata that an MCP peer sends are treated as policy or authorisation. Peer metadata can steer the model; it can
|
|
200
|
+
never grant a capability.
|
|
201
|
+
|
|
202
|
+
**Where to look.** Code that enables tools because the description says "safe" or "read-only";
|
|
203
|
+
annotations used as permission flags; schemas from the peer used without a local allowlist.
|
|
204
|
+
|
|
205
|
+
**How to prove.** Look for the controls that must win when the metadata says otherwise: a fixed local allowlist, a check of which server is actually speaking, and authorisation inside the handler. If none exists and a capability follows, it is a finding.
|
|
206
|
+
|
|
207
|
+
## Output and disclosure
|
|
208
|
+
|
|
209
|
+
### `insecure-model-output-rendering`
|
|
210
|
+
|
|
211
|
+
**What it is.** Model text lands in a sink that interprets it (HTML, Markdown, URL, template, command line) with no encoding or policy fitted to that sink. Includes exfiltration through auto-loaded Markdown images or
|
|
212
|
+
links that carry context data in the URL.
|
|
213
|
+
|
|
214
|
+
**Where to look.** `innerHTML`/`dangerouslySetInnerHTML` with model text; Markdown renderers with
|
|
215
|
+
raw HTML on; image auto-loading of model-chosen URLs; model text passed to a shell or `eval`. For
|
|
216
|
+
browser renderers, check CSP and sanitisation with the `client-side.md` classes.
|
|
217
|
+
|
|
218
|
+
**How to prove.** Source to sink in code. If the renderer lives outside the repository, the verdict
|
|
219
|
+
is `needs_validation`.
|
|
220
|
+
|
|
221
|
+
### `context-secret-extraction`
|
|
222
|
+
|
|
223
|
+
**What it is.** The prompt the code assembles includes secrets, records that belong to someone else, private code, or policy values that grant access on their own, and output the user can steer reveals them.
|
|
224
|
+
|
|
225
|
+
**Where to look.** Prompt assembly and the data fetched into it: API keys pasted into system
|
|
226
|
+
prompts, other users' records pulled by broad retrieval, internal URLs with tokens.
|
|
227
|
+
|
|
228
|
+
**Only a note.** Leaking the generic system prompt or describing behaviour, when nothing in it
|
|
229
|
+
crosses a data boundary.
|
|
230
|
+
|
|
231
|
+
## Moves that work across all of the above
|
|
232
|
+
|
|
233
|
+
- Make four lists before hunting: whose identity each tool runs as, which tools exist, which context and memory sources someone can write, and where output goes. A finding is a path from the first list to the authority in the second. - Begin with tools that change things and walk upstream: dispatcher, schema, confirmation step, model context, retrieval, ingestion. For durable memory, begin at each read and list every writer.
|
|
234
|
+
- Compare direct, queued, retried, resumed, batched and delegated paths to the same action.
|
|
235
|
+
|
|
236
|
+
## Proof checklist before reporting
|
|
237
|
+
|
|
238
|
+
1. Name the boundary and the outcome: who attacks, whose data or shared resource is hit, which identity executes, on what target, and which action or disclosure was neither authorised nor requested.
|
|
239
|
+
2. Confused deputy (`excessive-agency`): show the tool lacks requester-and-resource authorisation
|
|
240
|
+
and the attacker has no normal route to the same result. Action binding: show instead that planted content made the agent act with the victim's permissions on something the victim never deliberately asked for or approved.
|
|
241
|
+
3. Memory and retrieval: both the attacker's write and the later read by another principal or by a privileged decision.
|
|
242
|
+
4. Schema mismatch: diff what the validator approved, after normalisation, against what the handler really used.
|
|
243
|
+
5. MCP identity: verify connection, correlation, namespace and credential; otherwise
|
|
244
|
+
`needs_validation`.
|
|
245
|
+
6. `confirmed` needs a full source trace and a meaningful result. `needs_validation` names the one
|
|
246
|
+
unresolved fact (provider, deployment, model, renderer, identity) and the bounded check that
|
|
247
|
+
settles it. See [`../verification.md`](../verification.md).
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Client-side and browser classes
|
|
2
|
+
|
|
3
|
+
Load when: the browser makes trust decisions or renders content an attacker can shape. SPAs,
|
|
4
|
+
browser extensions, embedded webviews, service workers, offline-first apps, DOM rendering of
|
|
5
|
+
outside content, cross-window messaging, data kept in browser storage. Verdict rules:
|
|
6
|
+
[`../verification.md`](../verification.md).
|
|
7
|
+
|
|
8
|
+
Browser code has inputs the server never sees: the URL fragment, `window.name`, `postMessage`
|
|
9
|
+
payloads, content cached on an earlier visit. The native half of a webview bridge belongs in
|
|
10
|
+
`desktop-mobile-ipc.md`; CSRF, sessions and login callbacks on the server belong in
|
|
11
|
+
`web-and-auth.md`.
|
|
12
|
+
|
|
13
|
+
## Ground rules
|
|
14
|
+
|
|
15
|
+
- **Source plus sink.** A candidate needs an input the attacker controls and a sink that runs code
|
|
16
|
+
or leaks data. Name both and show the data flowing between them.
|
|
17
|
+
- **Someone else must be hurt.** The impact has to reach a victim's session, a different origin, or
|
|
18
|
+
storage other people share. Running script in your own page or reading your own data
|
|
19
|
+
(self-XSS) does not count.
|
|
20
|
+
- **Credit the browser's real defences** before rating impact: auto-escaping in the framework, the
|
|
21
|
+
same-origin policy, CSP, COOP and CORP, service-worker scope rules, the `noopener` default
|
|
22
|
+
modern browsers apply to new windows.
|
|
23
|
+
- **Storage outlives sessions.** Browser storage and caches are per origin and survive logout
|
|
24
|
+
unless code clears them. For every record, know its writer, its reader, and which account,
|
|
25
|
+
tenant or worker lifecycle wipes it.
|
|
26
|
+
- Validate in a local test origin with fake accounts. Never with real users, real origins or
|
|
27
|
+
shared services. Facts you cannot observe (renderer behaviour, extension permissions, headers in
|
|
28
|
+
production, browser version) make the verdict `needs_validation`.
|
|
29
|
+
|
|
30
|
+
## DOM and object state
|
|
31
|
+
|
|
32
|
+
### `dom-xss`
|
|
33
|
+
|
|
34
|
+
**Sources.** Any part of `location` (hash, search, pathname), `document.referrer`, `window.name`,
|
|
35
|
+
message payloads, values read back from storage, other document state an attacker influences.
|
|
36
|
+
|
|
37
|
+
**Sinks.** `innerHTML`, `outerHTML`, `insertAdjacentHTML`, `document.write`, `eval`, string
|
|
38
|
+
arguments to `setTimeout`/`setInterval`, `new Function`, `javascript:` URLs placed in `href`, `src`
|
|
39
|
+
or `location`, jQuery `.html()`, `.append(html)` and `$(userString)`, and the framework escape
|
|
40
|
+
hatches: `dangerouslySetInnerHTML`, `v-html`, `[innerHTML]`, `bypassSecurityTrust*`, `{@html}`.
|
|
41
|
+
|
|
42
|
+
**Not a finding.** Values the framework escapes correctly for where they land.
|
|
43
|
+
|
|
44
|
+
### `dom-clobbering`
|
|
45
|
+
|
|
46
|
+
**What it is.** Markup the attacker injects carries `id` or `name` attributes that override a
|
|
47
|
+
global, a form property, a config object or an initialisation flag the script trusts later
|
|
48
|
+
(`window.config`, a `document.getElementById` fallback, `form.action`).
|
|
49
|
+
|
|
50
|
+
**Proof needs two things.** A path for markup that keeps those attributes (sanitiser, Markdown,
|
|
51
|
+
rich-text editor), and code that reads the overridden value in a way that matters for security.
|
|
52
|
+
|
|
53
|
+
### `prototype-pollution`
|
|
54
|
+
|
|
55
|
+
**What it is.** A key the attacker picks (`__proto__`, `constructor.prototype`) reaches a recursive
|
|
56
|
+
writer such as a deep merge, `set(obj, path, value)` or a query-string parser that builds nested
|
|
57
|
+
objects, and modifies prototype state every object shares.
|
|
58
|
+
|
|
59
|
+
**Proof needs a gadget.** Show code that later reads the polluted property and, because of it,
|
|
60
|
+
changes an authorisation result, executes something, navigates somewhere or renders something. A
|
|
61
|
+
plain `JSON.parse`, a shallow copy, or pollution that nothing consumes is not a finding.
|
|
62
|
+
|
|
63
|
+
## Messaging and cross-origin network
|
|
64
|
+
|
|
65
|
+
### `postmessage-trust`
|
|
66
|
+
|
|
67
|
+
A `message` listener acts on `event.data` but does not compare `event.origin` with an exact list,
|
|
68
|
+
or, when several frames share one origin, does not check `event.source` either. On the sending
|
|
69
|
+
side, posting private data with target origin `*` hands it to whoever embeds the page. Grep
|
|
70
|
+
`addEventListener('message'`, `onmessage`, `postMessage(` with `'*'`. Checks built from
|
|
71
|
+
`includes`, `startsWith`, `endsWith`, `indexOf` or a regex without anchors do not count as origin
|
|
72
|
+
checks. Listeners that only adjust harmless UI are notes.
|
|
73
|
+
|
|
74
|
+
### `cross-site-websocket`
|
|
75
|
+
|
|
76
|
+
The WebSocket handshake accepts the victim's cookies from any origin without checking `Origin` or
|
|
77
|
+
requiring a token per channel, so a hostile page can drive the victim's socket. Read the upgrade
|
|
78
|
+
handler (`verifyClient`, socket auth middleware) and then the message handlers that read or change
|
|
79
|
+
data. Sockets authenticated by a token the hostile page cannot get are fine.
|
|
80
|
+
|
|
81
|
+
### `credentialed-cors`
|
|
82
|
+
|
|
83
|
+
The server echoes the request `Origin`, or matches it loosely, while also sending
|
|
84
|
+
`Access-Control-Allow-Credentials: true`, and the response holds private data or the request
|
|
85
|
+
changes state. Look for origin values copied from the request, regex allowlists, `null` accepted as
|
|
86
|
+
an origin. A literal `*` combined with credentials is rejected by browsers, so it is not a finding;
|
|
87
|
+
nor is public data served without credentials.
|
|
88
|
+
|
|
89
|
+
## Service workers and storage
|
|
90
|
+
|
|
91
|
+
### `service-worker-takeover`
|
|
92
|
+
|
|
93
|
+
Content an attacker influences becomes the registered worker script, or sits on a path that gets a
|
|
94
|
+
wide `Service-Worker-Allowed` scope, or changes what `importScripts` loads with no integrity check.
|
|
95
|
+
Check the argument to `navigator.serviceWorker.register(`, the final script URL, its MIME type,
|
|
96
|
+
origin and scope, and who controls each imported file. A same-origin worker with the scope it was
|
|
97
|
+
meant to have is not a defect.
|
|
98
|
+
|
|
99
|
+
### `service-worker-cache-confusion`
|
|
100
|
+
|
|
101
|
+
The worker stores personalised responses without keying them on account, tenant, auth state or
|
|
102
|
+
request mode, and replays them after logout or an account switch. Read the `fetch` handler's
|
|
103
|
+
routing, cache names and keys, navigation fallbacks, what is deleted at logout, and offline or
|
|
104
|
+
error branches that might return the previous user's page.
|
|
105
|
+
|
|
106
|
+
### `browser-storage-exposure`
|
|
107
|
+
|
|
108
|
+
Tokens, private API responses, drafts or cached permission decisions remain in browser storage (IndexedDB, `localStorage`, Cache Storage, `sessionStorage`, an extension's storage area) or in-memory app state, where another
|
|
109
|
+
account or a same-origin component with less trust can read them. A token sitting in storage is
|
|
110
|
+
not enough by itself: show a reader with less authority, or show the value still being used after
|
|
111
|
+
logout or revocation.
|
|
112
|
+
|
|
113
|
+
### `cross-context-confusion`
|
|
114
|
+
|
|
115
|
+
Identity or commands travel between tabs over `BroadcastChannel`, `storage` events, caches shared by the whole origin or shared workers with nothing tying them to the current session. Test account switching,
|
|
116
|
+
private versus normal windows, tenant changes, and an old tab overwriting newer auth state.
|
|
117
|
+
|
|
118
|
+
Proof for this group: show the write or cache entry the attacker controls arriving at a different
|
|
119
|
+
account, a different tenant, or a later authorisation decision.
|
|
120
|
+
|
|
121
|
+
## Cross-site leaks
|
|
122
|
+
|
|
123
|
+
### `xs-leak`
|
|
124
|
+
|
|
125
|
+
**What it is.** A hostile page learns something private about another origin while the browser
|
|
126
|
+
sends the victim's credentials along: through load or error events, number of frames, window
|
|
127
|
+
properties, redirects, timing, cache probing or response length.
|
|
128
|
+
|
|
129
|
+
**Proof.** One specific yes-or-no secret (does this private record exist, is this user an admin,
|
|
130
|
+
is this person signed in to that service), backed by source and by behaviour in a local browser.
|
|
131
|
+
Then say which header or rendering change would close it: `Cross-Origin-Opener-Policy`,
|
|
132
|
+
`Cross-Origin-Resource-Policy`, `SameSite`, checks on fetch-metadata headers.
|
|
133
|
+
|
|
134
|
+
**Not a finding.** Random timing noise, or learning whether a public resource exists.
|
|
135
|
+
|
|
136
|
+
### `window-opener-disclosure`
|
|
137
|
+
|
|
138
|
+
The parts of a cross-origin window that a page is allowed to see (its navigation outcome, frame
|
|
139
|
+
count, other permitted properties) give away private state, or a retained `opener` or named window
|
|
140
|
+
lets a hostile page steer a privileged navigation. Check COOP, framing rules, `noopener`, exact
|
|
141
|
+
origins, and whether what can be observed is actually secret.
|
|
142
|
+
|
|
143
|
+
## UI redress and navigation
|
|
144
|
+
|
|
145
|
+
### `clickjacking`
|
|
146
|
+
|
|
147
|
+
A page with a state-changing action can be loaded in a frame because `frame-ancestors`,
|
|
148
|
+
`X-Frame-Options` or an equivalent defence is missing or ineffective. Report it only when a
|
|
149
|
+
sensitive action can be completed inside the frame. On read-only pages the missing header is a
|
|
150
|
+
hardening note.
|
|
151
|
+
|
|
152
|
+
### `client-navigation-confusion`
|
|
153
|
+
|
|
154
|
+
Script reads a client-side value and navigates to it without restricting scheme or destination,
|
|
155
|
+
including `javascript:` and `data:` URLs (`location = params.get('next')`, `window.open(url)`,
|
|
156
|
+
router pushes with outside input). Reverse tabnabbing only counts when the code keeps
|
|
157
|
+
`window.opener` on purpose, opens windows without isolation, or targets a browser that does not
|
|
158
|
+
apply `noopener` by default.
|
|
159
|
+
|
|
160
|
+
## Moves that work across this file
|
|
161
|
+
|
|
162
|
+
- Begin at the sinks (DOM writes, navigation, worker registration, message handlers, storage reads)
|
|
163
|
+
and trace back to both browser-only and server-provided inputs. Note which browser policy should
|
|
164
|
+
have stopped each path.
|
|
165
|
+
- In a local origin with fake users, run through logout, account switch, worker update, offline
|
|
166
|
+
mode and stale tabs.
|
|
167
|
+
- For leaks, list only the yes-or-no questions you proved from source and local behaviour.
|
|
168
|
+
|
|
169
|
+
## Proof checklist
|
|
170
|
+
|
|
171
|
+
1. Input, sink, the browser policy in force, the origin or session affected, and the change or
|
|
172
|
+
leak observed.
|
|
173
|
+
2. Prototype pollution: the recursive write and a gadget that matters. Clobbering: the markup
|
|
174
|
+
survives sanitising and the overridden value is read.
|
|
175
|
+
3. Workers and storage: the record reaches a different account, tenant or later auth decision.
|
|
176
|
+
4. Messaging, CORS, sockets and leaks: the exact origin or source check, the private state or
|
|
177
|
+
action reached, and proof that CSP, COOP/CORP, cookie attributes and `SameSite` do not already
|
|
178
|
+
block the path.
|
|
179
|
+
5. `confirmed` needs the full client path and bounded local evidence. Otherwise
|
|
180
|
+
`needs_validation`, naming the production header, extension permission, browser version or
|
|
181
|
+
renderer behaviour someone must check. See [`../verification.md`](../verification.md).
|