@gpzhang2001/sharpkit-skills 0.2.1

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.
Files changed (84) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +12 -0
  3. package/THIRD_PARTY_NOTICES.md +48 -0
  4. package/lib/index.d.ts +2027 -0
  5. package/lib/index.d.ts.map +1 -0
  6. package/lib/index.js +70 -0
  7. package/lib/index.js.map +1 -0
  8. package/package.json +46 -0
  9. package/skills/analysis/counterevidence.md +185 -0
  10. package/skills/analysis/fix_verification.md +129 -0
  11. package/skills/analysis/severity_calibration.md +130 -0
  12. package/skills/analysis/source_aware_discovery.md +211 -0
  13. package/skills/cloud/aws.md +231 -0
  14. package/skills/cloud/azure.md +262 -0
  15. package/skills/cloud/gcp.md +194 -0
  16. package/skills/cloud/kubernetes.md +223 -0
  17. package/skills/coordination/root_agent.md +105 -0
  18. package/skills/coordination/source_aware_whitebox.md +47 -0
  19. package/skills/custom/api_spec_testing.md +61 -0
  20. package/skills/custom/dependency_cve_scanning.md +341 -0
  21. package/skills/custom/npx_confusion.md +233 -0
  22. package/skills/custom/source_aware_sast.md +192 -0
  23. package/skills/frameworks/django.md +214 -0
  24. package/skills/frameworks/fastapi.md +191 -0
  25. package/skills/frameworks/nestjs.md +225 -0
  26. package/skills/frameworks/nextjs.md +228 -0
  27. package/skills/protocols/graphql.md +276 -0
  28. package/skills/protocols/oauth.md +185 -0
  29. package/skills/reconnaissance/asset_discovery.md +150 -0
  30. package/skills/reconnaissance/infrastructure_lifecycle.md +226 -0
  31. package/skills/scan_modes/deep.md +164 -0
  32. package/skills/scan_modes/diff.md +86 -0
  33. package/skills/scan_modes/quick.md +68 -0
  34. package/skills/scan_modes/standard.md +99 -0
  35. package/skills/technologies/active_directory.md +233 -0
  36. package/skills/technologies/auth0.md +188 -0
  37. package/skills/technologies/electron_desktop_apps.md +181 -0
  38. package/skills/technologies/firebase.md +263 -0
  39. package/skills/technologies/grafana_prometheus.md +189 -0
  40. package/skills/technologies/llm_applications.md +257 -0
  41. package/skills/technologies/supabase.md +268 -0
  42. package/skills/tooling/agent_browser.md +551 -0
  43. package/skills/tooling/ffuf.md +72 -0
  44. package/skills/tooling/httpx.md +82 -0
  45. package/skills/tooling/hurl.md +99 -0
  46. package/skills/tooling/hypothesis.md +100 -0
  47. package/skills/tooling/katana.md +102 -0
  48. package/skills/tooling/naabu.md +68 -0
  49. package/skills/tooling/nmap.md +66 -0
  50. package/skills/tooling/nuclei.md +67 -0
  51. package/skills/tooling/python.md +109 -0
  52. package/skills/tooling/semgrep.md +72 -0
  53. package/skills/tooling/sqlmap.md +67 -0
  54. package/skills/tooling/subfinder.md +66 -0
  55. package/skills/vulnerabilities/agentic_system_security.md +207 -0
  56. package/skills/vulnerabilities/argument_injection.md +157 -0
  57. package/skills/vulnerabilities/authentication_jwt.md +166 -0
  58. package/skills/vulnerabilities/broken_function_level_authorization.md +154 -0
  59. package/skills/vulnerabilities/browser_security.md +192 -0
  60. package/skills/vulnerabilities/business_logic.md +178 -0
  61. package/skills/vulnerabilities/csrf.md +198 -0
  62. package/skills/vulnerabilities/header_injection.md +216 -0
  63. package/skills/vulnerabilities/http_request_smuggling.md +255 -0
  64. package/skills/vulnerabilities/idor.md +217 -0
  65. package/skills/vulnerabilities/information_disclosure.md +187 -0
  66. package/skills/vulnerabilities/insecure_deserialization.md +210 -0
  67. package/skills/vulnerabilities/insecure_file_uploads.md +194 -0
  68. package/skills/vulnerabilities/llm_prompt_injection.md +187 -0
  69. package/skills/vulnerabilities/mass_assignment.md +153 -0
  70. package/skills/vulnerabilities/nosql_injection.md +288 -0
  71. package/skills/vulnerabilities/open_redirect.md +165 -0
  72. package/skills/vulnerabilities/path_traversal_lfi_rfi.md +218 -0
  73. package/skills/vulnerabilities/prototype_pollution.md +142 -0
  74. package/skills/vulnerabilities/race_conditions.md +181 -0
  75. package/skills/vulnerabilities/rce.md +250 -0
  76. package/skills/vulnerabilities/semantic_confusion.md +189 -0
  77. package/skills/vulnerabilities/sql_injection.md +190 -0
  78. package/skills/vulnerabilities/ssrf.md +186 -0
  79. package/skills/vulnerabilities/ssti.md +270 -0
  80. package/skills/vulnerabilities/subdomain_takeover.md +167 -0
  81. package/skills/vulnerabilities/weak_password_detection.md +200 -0
  82. package/skills/vulnerabilities/xss.md +206 -0
  83. package/skills/vulnerabilities/xxe.md +223 -0
  84. package/src/index.ts +89 -0
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: python
3
+ description: Run Python through exec_command in the SDK sandbox. Use the image-baked caido_api module for Caido proxy automation from Python scripts.
4
+ ---
5
+
6
+ # Python In The Sandbox
7
+
8
+ Use `exec_command` for Python. There is no separate Python executor.
9
+
10
+ Prefer writing reusable scripts to a `.py` file and running them with
11
+ `python3 <name>.py`. For short one-off transformations, `python3 -c` or a
12
+ small here-document is fine.
13
+
14
+ The `shell` parameter on `exec_command` is for swapping POSIX shells
15
+ (`bash`/`zsh`/`sh`), not for picking interpreters. Put the interpreter
16
+ invocation in `cmd` instead: `cmd="python3 -c '...'"`, not
17
+ `shell=python3, cmd="..."`. The `shell=<interpreter>` shortcut breaks
18
+ in subtle ways — `python3` works only with `login=False` (because the
19
+ SDK adds `-l`/`-i`), and other interpreters (`node`, `ruby`, `perl`)
20
+ take `-e` not `-c` so they fail even with `login=False`.
21
+
22
+ ## Proxy Automation From Python
23
+
24
+ The sandbox image includes an installed `caido_api` module. Import it
25
+ explicitly when Python code needs Caido traffic or replay access:
26
+
27
+ ```python
28
+ from caido_api import (
29
+ list_requests,
30
+ list_sitemap,
31
+ repeat_request,
32
+ scope_rules,
33
+ view_request,
34
+ view_sitemap_entry,
35
+ )
36
+ ```
37
+
38
+ All helpers are async. Use them inside `asyncio.run(...)` or an async
39
+ function:
40
+
41
+ ```python
42
+ import asyncio
43
+
44
+ from caido_api import list_requests, view_request
45
+
46
+
47
+ async def main():
48
+ posts = await list_requests(
49
+ httpql_filter='req.method.eq:"POST" AND req.path.cont:"/api/"',
50
+ first=50,
51
+ )
52
+ candidates = []
53
+ for edge in posts.edges:
54
+ request_id = edge.node.request.id
55
+ body = await view_request(request_id, part="request")
56
+ raw = body.request.raw.decode("utf-8", errors="replace")
57
+ if "id=" in raw or "user=" in raw:
58
+ candidates.append(request_id)
59
+
60
+ print(f"{len(candidates)} candidates")
61
+ print(candidates[:10])
62
+
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ Available helpers:
68
+
69
+ - `list_requests(httpql_filter=, first=50, after=, sort_by=, sort_order=, scope_id=)` returns a cursor-paginated Caido SDK `Connection`.
70
+ - `view_request(request_id, part="request")` returns a Caido SDK request object with raw request/response bytes.
71
+ - `repeat_request(request_id, modifications={...})` replays a captured request after modifying `url`, `params`, `headers`, `body`, or `cookies`.
72
+ - `list_sitemap(scope_id=, parent_id=, depth="DIRECT", page=1)` walks Caido's request-tree view of the discovered surface. Omit `parent_id` for root domains; pass an entry id with `depth="DIRECT"` or `"ALL"` to drill in.
73
+ - `view_sitemap_entry(entry_id)` returns one entry plus its 30 most recent related requests.
74
+ - `scope_rules(action, allowlist=, denylist=, scope_id=, scope_name=)` manages Caido scopes.
75
+
76
+ For one-off arbitrary requests (e.g. probing a fresh endpoint, hitting an
77
+ external API), use `exec_command` with `curl` / `httpx` / `requests`. The
78
+ sandbox's `HTTP_PROXY` env routes all such traffic through Caido
79
+ automatically, so it shows up in `list_requests` and you can use
80
+ `repeat_request` to replay-and-modify any of it.
81
+
82
+ ## Workflow
83
+
84
+ For iterative exploit work, put code in a file:
85
+
86
+ ```text
87
+ 1. Create or edit a task-unique script (e.g. `poc_<task-id>.py`, so it can't
88
+ clobber a project file or another agent's script) with `apply_patch`.
89
+ 2. Run it with `exec_command`: `python3 poc_<task-id>.py`.
90
+ 3. Edit and rerun until the proof-of-concept is reliable.
91
+ ```
92
+
93
+ ## Installing extra packages
94
+
95
+ The sandbox's Python lives in `/app/.venv`, and it is the active virtualenv
96
+ (`python3` / `pip` already resolve to it). The following common libraries are
97
+ **pre-installed** — import them directly, no install step needed:
98
+ `requests`, `httpx`, `beautifulsoup4` (`bs4`), `lxml`, `pyjwt` (`jwt`),
99
+ `cryptography`.
100
+
101
+ To add a one-off dependency for an exploit script, use `uv` (already in the
102
+ image and much faster than pip):
103
+
104
+ ```bash
105
+ uv pip install --python /app/.venv/bin/python <package>
106
+ ```
107
+
108
+ Plain `pip install <package>` also works because the venv is active. Install
109
+ before you import, so scripts don't fail with `ModuleNotFoundError`.
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: semgrep
3
+ description: Exact Semgrep CLI structure, metrics-off scanning, scoped ruleset selection, and automation-safe output patterns.
4
+ ---
5
+
6
+ # Semgrep CLI Playbook
7
+
8
+ Official docs:
9
+ - https://semgrep.dev/docs/cli-reference
10
+ - https://semgrep.dev/docs/getting-started/cli
11
+ - https://semgrep.dev/docs/semgrep-code/semgrep-pro-engine-intro
12
+
13
+ Canonical syntax:
14
+ `semgrep scan [flags]`
15
+
16
+ High-signal flags:
17
+ - `--config <rule_or_ruleset>` ruleset, registry pack, local rule file, or directory
18
+ - `--metrics=off` disable telemetry and metrics reporting
19
+ - `--json` JSON output
20
+ - `--sarif` SARIF output
21
+ - `--output <file>` write findings to file
22
+ - `--severity <level>` filter by severity
23
+ - `--error` return non-zero exit when findings exist
24
+ - `--quiet` suppress progress noise
25
+ - `--jobs <n>` parallel workers
26
+ - `--timeout <seconds>` per-file timeout
27
+ - `--exclude <pattern>` exclude path pattern
28
+ - `--include <pattern>` include path pattern
29
+ - `--exclude-rule <rule_id>` suppress specific rule
30
+ - `--baseline-commit <sha>` only report findings introduced after baseline
31
+ - `--pro` enable Pro engine if available
32
+ - `--oss-only` force OSS engine only
33
+
34
+ Agent-safe baseline for automation:
35
+ `semgrep scan --config p/default --metrics=off --json --output semgrep.json --quiet --jobs 4 --timeout 20 /workspace`
36
+
37
+ Common patterns:
38
+ - Default security scan:
39
+ `semgrep scan --config p/default --metrics=off --json --output semgrep.json --quiet /workspace`
40
+ - High-severity focused pass:
41
+ `semgrep scan --config p/default --severity ERROR --metrics=off --json --output semgrep_high.json --quiet /workspace`
42
+ - OWASP-oriented scan:
43
+ `semgrep scan --config p/owasp-top-ten --metrics=off --sarif --output semgrep.sarif --quiet /workspace`
44
+ - Language- or framework-specific rules:
45
+ `semgrep scan --config p/python --config p/secrets --metrics=off --json --output semgrep_python.json --quiet /workspace`
46
+ - Scoped directory scan:
47
+ `semgrep scan --config p/default --metrics=off --json --output semgrep_api.json --quiet /workspace/services/api`
48
+ - Pro engine check or run:
49
+ `semgrep scan --config p/default --pro --metrics=off --json --output semgrep_pro.json --quiet /workspace`
50
+
51
+ Critical correctness rules:
52
+ - Always include `--metrics=off`; Semgrep sends telemetry by default.
53
+ - Always provide an explicit `--config`; do not rely on vague or implied defaults.
54
+ - Prefer `--json --output <file>` or `--sarif --output <file>` for machine-readable downstream processing.
55
+ - Keep the target path explicit; use an absolute or clearly scoped workspace path instead of `.` when possible.
56
+ - If Pro availability matters, check it explicitly with a bounded command before assuming cross-file analysis exists.
57
+
58
+ Usage rules:
59
+ - Start with `p/default` unless the task clearly calls for a narrower pack.
60
+ - Add focused packs such as `p/secrets`, `p/python`, or `p/javascript` only when they match the target stack.
61
+ - Use `--quiet` in automation to reduce noisy logs.
62
+ - Use `--jobs` and `--timeout` explicitly for reproducible runtime behavior.
63
+ - Do not use `-h`/`--help` for routine operation unless absolutely necessary.
64
+
65
+ Failure recovery:
66
+ - If scans are too slow, narrow the target path and reduce the active rulesets before changing engine settings.
67
+ - If scans time out, increase `--timeout` modestly or lower `--jobs`.
68
+ - If output is too broad, scope `--config`, add `--severity`, or exclude known irrelevant paths.
69
+ - If Pro mode fails, rerun with `--oss-only` or without `--pro` and note the loss of cross-file coverage.
70
+
71
+ If uncertain, query web_search with:
72
+ `site:semgrep.dev semgrep <flag> cli`
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: sqlmap
3
+ description: sqlmap target syntax, non-interactive execution, and common validation/enumeration workflows.
4
+ ---
5
+
6
+ # sqlmap CLI Playbook
7
+
8
+ Official docs:
9
+ - https://github.com/sqlmapproject/sqlmap/wiki/usage
10
+ - https://sqlmap.org
11
+
12
+ Canonical syntax:
13
+ `sqlmap -u "<target_url_with_params>" [options]`
14
+
15
+ High-signal flags:
16
+ - `-u, --url <url>` target URL
17
+ - `-r <request_file>` raw HTTP request input
18
+ - `-p <param>` test specific parameter(s)
19
+ - `--batch` non-interactive mode
20
+ - `--level <1-5>` test depth
21
+ - `--risk <1-3>` payload risk profile
22
+ - `--threads <n>` concurrency
23
+ - `--technique <letters>` technique selection
24
+ - `--forms` parse and test forms from target page
25
+ - `--cookie <cookie>` and `--headers <headers>` authenticated context
26
+ - `--timeout <seconds>` and `--retries <n>` transport stability
27
+ - `--tamper <scripts>` WAF/input-filter evasion
28
+ - `--random-agent` randomize user-agent
29
+ - `--ignore-proxy` bypass configured proxy
30
+ - `--dbs`, `-D <db> --tables`, `-D <db> -T <table> --columns`, `-D <db> -T <table> -C <cols> --dump`
31
+ - `--flush-session` clear cached scan state
32
+
33
+ Agent-safe baseline for automation:
34
+ `sqlmap -u "https://target.tld/item?id=1" -p id --batch --level 2 --risk 1 --threads 5 --timeout 10 --retries 1 --random-agent`
35
+
36
+ Common patterns:
37
+ - Baseline injection check:
38
+ `sqlmap -u "https://target.tld/item?id=1" -p id --batch --level 2 --risk 1 --threads 5`
39
+ - POST parameter testing:
40
+ `sqlmap -u "https://target.tld/login" --data "user=admin&pass=test" -p pass --batch --level 2 --risk 1`
41
+ - Form-driven testing:
42
+ `sqlmap -u "https://target.tld/login" --forms --batch --level 2 --risk 1 --random-agent`
43
+ - Enumerate DBs:
44
+ `sqlmap -u "https://target.tld/item?id=1" -p id --batch --dbs`
45
+ - Enumerate tables in DB:
46
+ `sqlmap -u "https://target.tld/item?id=1" -p id --batch -D appdb --tables`
47
+ - Dump selected columns:
48
+ `sqlmap -u "https://target.tld/item?id=1" -p id --batch -D appdb -T users -C id,email,role --dump`
49
+
50
+ Critical correctness rules:
51
+ - Always include `--batch` in automation to avoid interactive prompts.
52
+ - Keep target parameter explicit with `-p` when possible.
53
+ - Use `--flush-session` when retesting after request/profile changes.
54
+ - Start conservative (`--level 1-2`, `--risk 1`) and escalate only when needed.
55
+
56
+ Usage rules:
57
+ - Keep authenticated context (`--cookie`/`--headers`) aligned with manual validation state.
58
+ - Prefer narrow extraction (`-D/-T/-C`) over broad dump-first behavior.
59
+ - Do not use `-h`/`--help` during normal execution unless absolutely necessary.
60
+
61
+ Failure recovery:
62
+ - If results conflict with manual testing, rerun with `--flush-session`.
63
+ - If blocked by filtering/WAF, reduce `--threads` and test targeted `--tamper` chains.
64
+ - If initial detection misses likely injection, increment `--level`/`--risk` gradually.
65
+
66
+ If uncertain, query web_search with:
67
+ `site:github.com/sqlmapproject/sqlmap/wiki/usage sqlmap <flag>`
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: subfinder
3
+ description: Subfinder passive subdomain enumeration syntax, source controls, and pipeline-ready output patterns.
4
+ ---
5
+
6
+ # Subfinder CLI Playbook
7
+
8
+ Official docs:
9
+ - https://docs.projectdiscovery.io/opensource/subfinder/usage
10
+ - https://docs.projectdiscovery.io/opensource/subfinder/running
11
+ - https://github.com/projectdiscovery/subfinder
12
+
13
+ Canonical syntax:
14
+ `subfinder [flags]`
15
+
16
+ High-signal flags:
17
+ - `-d <domain>` single domain
18
+ - `-dL <file>` domain list
19
+ - `-all` include all sources
20
+ - `-recursive` use recursive-capable sources
21
+ - `-s <sources>` include specific sources
22
+ - `-es <sources>` exclude specific sources
23
+ - `-rl <n>` global rate limit
24
+ - `-rls <source=n/s,...>` per-source rate limits
25
+ - `-proxy <http://host:port>` proxy outbound source requests
26
+ - `-silent` compact output
27
+ - `-o <file>` output file
28
+ - `-oJ, -json` JSONL output
29
+ - `-cs, -collect-sources` include source metadata (`-oJ` output)
30
+ - `-nW, -active` show only active subdomains
31
+ - `-timeout <seconds>` request timeout
32
+ - `-max-time <minutes>` overall enumeration cap
33
+
34
+ Agent-safe baseline for automation:
35
+ `subfinder -d example.com -all -recursive -rl 20 -timeout 30 -silent -oJ -o subfinder.jsonl`
36
+
37
+ Common patterns:
38
+ - Standard passive enum:
39
+ `subfinder -d example.com -silent -o subs.txt`
40
+ - Broad-source passive enum:
41
+ `subfinder -d example.com -all -recursive -silent -o subs_all.txt`
42
+ - Multi-domain run:
43
+ `subfinder -dL domains.txt -all -recursive -rl 20 -silent -o subfinder_out.txt`
44
+ - Source-attributed JSONL output:
45
+ `subfinder -d example.com -all -oJ -cs -o subfinder_sources.jsonl`
46
+ - Passive enum via explicit proxy:
47
+ `subfinder -d example.com -all -recursive -proxy http://127.0.0.1:48080 -silent -oJ -o subfinder_proxy.jsonl`
48
+
49
+ Critical correctness rules:
50
+ - `-cs` is useful only with JSON output (`-oJ`).
51
+ - Many sources require API keys in provider config; low results can be config-related, not target-related.
52
+ - `-nW` performs active resolution/filtering and can drop passive-only hits.
53
+ - Keep passive enum first, then validate with `httpx`.
54
+
55
+ Usage rules:
56
+ - Keep output files explicit when chaining to `httpx`/`nuclei`.
57
+ - Use `-rl/-rls` when providers throttle aggressively.
58
+ - Do not use `-h`/`--help` for routine tasks unless absolutely necessary.
59
+
60
+ Failure recovery:
61
+ - If results are unexpectedly low, rerun with `-all` and verify provider config/API keys.
62
+ - If provider errors appear, lower `-rl` and apply `-rls` per source.
63
+ - If runs take too long, lower scope or split domain batches.
64
+
65
+ If uncertain, query web_search with:
66
+ `site:docs.projectdiscovery.io subfinder <flag> usage`
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: agentic-system-security
3
+ description: Security testing for authorized AI agents and MCP-style tool ecosystems, covering effective authority, tool/resource/prompt inventory, confused-deputy behavior, side-effect authorization, cross-tenant isolation, executable component supply chain, shadow integrations, and repeatable safety regression
4
+ ---
5
+
6
+ # Agentic System Security
7
+
8
+ Use this skill when an AI system can select tools, retrieve resources, invoke remote/local services, maintain memory, delegate to other agents, or install skills/plugins. Pair it with `llm_prompt_injection` for instruction attacks and classic vulnerability skills for the downstream HTTP, cloud, filesystem, identity, or code-execution sink.
9
+
10
+ Prompt text is not an authorization boundary. Treat the agent runtime as a confused deputy whose effective authority is bounded by the union of its credentials, tools, resources, network reach, filesystem access, delegated agents, and approval policy, then reduce that upper bound to the actually reachable subset by tracing token audience, scopes, routing, target authorization, environment, and approval flow.
11
+
12
+ ## Effective-Authority Map
13
+
14
+ Draw the complete path:
15
+
16
+ ```text
17
+ user / external content
18
+ -> model context and memory
19
+ -> planner / router / policy
20
+ -> tool or delegated agent
21
+ -> credential and target system
22
+ -> side effect / returned data
23
+ ```
24
+
25
+ Inventory, for each node:
26
+
27
+ - trust source and tenant/user ownership
28
+ - immutable component identity, package/server name, version, and transport
29
+ - tools, resources, prompts, model endpoints, plugins, skills, and MCP servers
30
+ - credential identity, issuer, audience/resource, subject, tenant, scopes/roles, expiry, downstream token exchange, environment, and where it is injected
31
+ - readable data and write/execute capabilities
32
+ - network/listener exposure and test-versus-production target
33
+ - argument validation, authorization point, approval point, schema/argument digest, delegated principal propagation, and audit log
34
+ - data returned to the model and whether it can contain new instructions
35
+
36
+ Test from the lowest-privileged realistic user and device. The key comparison is the user's authority versus the agent/tool credential's authority.
37
+
38
+ ## Core Test Areas
39
+
40
+ ### Shadow Agent and AI Discovery
41
+
42
+ Do not assume the approved application inventory contains every agent, model endpoint, browser extension, local MCP server, or AI API integration. Correlate multiple independent signals:
43
+
44
+ - DNS/proxy/egress logs for first-seen model, agent, vector database, plugin, and AI SaaS domains
45
+ - OAuth/SSO grants, enterprise-app consent, service principals, API tokens, and unusual delegated scopes
46
+ - endpoint processes, browser extensions/native messaging, listening loopback ports, and MCP client/server configuration
47
+ - repository, CI/CD, secrets-manager, and container/image references to model providers, tool servers, and AI credentials
48
+ - cloud-hosted model endpoints, notebooks, functions, gateways, and procurement/expense/SaaS inventory
49
+
50
+ Baseline local discovery from the host before interpreting network or SSO signals:
51
+
52
+ ```bash
53
+ # macOS
54
+ lsof -nP -iTCP -sTCP:LISTEN
55
+ ps -axo pid,ppid,user,command
56
+
57
+ # Linux
58
+ ss -lntp
59
+ ps -eo pid,ppid,user,args
60
+
61
+ # Windows PowerShell
62
+ Get-NetTCPConnection -State Listen | Select-Object LocalAddress,LocalPort,OwningProcess
63
+ Get-Process | Select-Object Id,ProcessName,Path
64
+
65
+ # Cross-platform config and credential leads
66
+ rg -l 'mcpServers|modelContextProtocol|OPENAI_API_KEY|ANTHROPIC_API_KEY|AZURE_OPENAI_ENDPOINT' <reviewed-roots>
67
+ ```
68
+
69
+ Correlate each listener or config hit to PID/container, parent process, binary hash/version, launch command, config file, destination, and credential reference before calling it an active agent component. A loopback listener is a lead, not proof of reachable authority.
70
+
71
+ Classify each discovered integration by data read, data write, external communication, execution, identity/admin, and production reach. Human-validate attribution before treating a domain or key name as active AI use. Inspect unauthenticated local MCP/agent listeners separately; network inventory tools often miss loopback-only services.
72
+
73
+ ### Tool Discovery and Argument Boundaries
74
+
75
+ - Enumerate advertised and conditionally available tools, resources, prompts, schemas, annotations, and delegated agents.
76
+ - Compare what the UI exposes with what the protocol/runtime accepts directly.
77
+ - Test missing, extra, duplicate, nested, oversized, alternate-type, and cross-tenant identifiers in tool arguments.
78
+ - Validate scheme/host/path, filesystem paths, cloud resource IDs, recipient identities, SQL/query fields, and command arguments at the tool boundary.
79
+ - Treat tool descriptions, names, examples, resource metadata, and returned content as attacker-influenceable unless provenance is enforced.
80
+ - Canonicalize tool identity as `server identity/version + endpoint/transport + tool name + schema digest`; do not collapse two identically named tools from different servers into one trust decision.
81
+ - Treat protocol hints such as `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint` as untrusted metadata, not authorization.
82
+ - Verify that unknown tools or schema-invalid calls fail closed without falling back to a broader handler.
83
+
84
+ ### Confused Deputy and Consequential Actions
85
+
86
+ - Ask whether untrusted user/document/tool text can choose the tool, target, identity, or action.
87
+ - Test read-to-write escalation: a summarizer should not send, publish, delete, purchase, deploy, or modify because retrieved text requests it.
88
+ - Test whether approval binds the exact server identity/version, tool name, schema digest, normalized arguments, credential, target, side effect, and expiry. Revalidate those fields immediately before execution; a generic “continue?” is weak if arguments can change after approval.
89
+ - Exercise replay, retry, parallel calls, partial failure, cancellation, and delegated execution for duplicate or bypassed actions.
90
+ - Prove impact at the actual target and audit log. Model narration or a fabricated tool result is not evidence.
91
+ - Use dry-run/no-op/read-only operations first; require explicit human approval for consequential operations.
92
+
93
+ ### Identity, Tenant, and Environment Isolation
94
+
95
+ - Vary user, workspace, tenant, session, conversation, and delegated-agent identity independently.
96
+ - Test whether one tenant can reference another tenant's resources, tool sessions, caches, vector entries, files, or credentials.
97
+ - Check whether development/test tools or credentials can reach production, and whether local tools inherit broad workstation authority.
98
+ - Verify credential scoping at the target service, not only in the agent's application logic.
99
+ - Confirm memory and cached tool results are partitioned and revoked when identity or role changes.
100
+
101
+ ### MCP and Local Tool Servers
102
+
103
+ - Inventory stdio, streamable HTTP, SSE/legacy, and custom transports; record bind address, origin/auth controls, process command, environment, and lifecycle.
104
+ - Look for unauthenticated loopback services reachable from browsers, containers, local users, SSRF, port forwarding, or shared hosts.
105
+ - Compare `tools/list`, `resources/list`, and `prompts/list` results across identities, but do not assume listing means calling is authorized.
106
+ - For each tool, validate the same authorization and argument checks through every supported transport.
107
+ - Treat server-launched subprocess configuration, environment variables, and working directories as sensitive executable configuration.
108
+ - For HTTP/SSE transports, validate OAuth issuer, signature, expiry, audience/resource, tenant, and scope claims at the server boundary. Reject tokens minted for the wrong audience, and do not treat a session ID as identity.
109
+ - For downstream APIs, do not pass through the same bearer token unless the target explicitly authorizes that audience and principal. Separate upstream MCP authentication from downstream target authorization.
110
+ - For browser or loopback OAuth, review redirect URI, state/PKCE handling, localhost binding, and consent proxying. Treat metadata fetches and tool discovery on remote servers as SSRF-relevant surfaces.
111
+ - For stdio servers, the launch command and environment are already code execution. Discovery must not execute an unreviewed server binary or mutable package tag.
112
+
113
+ ### Executable Component Supply Chain
114
+
115
+ Every skill, plugin, MCP server, model adapter, package, and update channel is an executable or behavior-shaping dependency. Record:
116
+
117
+ - canonical source, publisher, package namespace, pinned version and integrity/provenance
118
+ - install/update mechanism, manifest/lockfile/config source, mutable tags, automatic updates, and rollback path
119
+ - declared and effective permissions, credentials, filesystem/network access
120
+ - transitive dependencies and lifecycle scripts
121
+ - review/approval ownership and last verification date
122
+
123
+ In agent and MCP configs, inspect `command: npx` with `-y` and a bare package or
124
+ binary name. The process can fetch code without an interactive prompt and then
125
+ run it with the agent's authority. Load `npx_confusion` to determine whether the
126
+ name resolves locally, becomes a public package spec, and belongs to the
127
+ intended publisher.
128
+
129
+ Test missing/private-name fallback, typosquatting exposure, mutable remote instructions, compromised-update blast radius, and whether an “instruction-only” component can invoke tools or modify executable files. Resolve `latest`, floating git refs, and mutable image tags to immutable versions or digests before launch. Do not claim or publish contestable package names as proof, and do not execute unknown packages just to discover what they are.
130
+
131
+ Load `infrastructure_lifecycle` when a skill, plugin, MCP server, model adapter, tool-schema origin, package namespace, or update endpoint is retired, mutable, or externally reassignable. Passive receipt of an agent heartbeat or catalog request does not authorize returning tool definitions, prompts, commands, or executable content.
132
+
133
+ ### Output, Telemetry, and Failure Modes
134
+
135
+ - Validate model/tool output before it reaches HTML, shell, SQL, URLs, file paths, templates, or a second agent.
136
+ - Ensure logs record initiating user, tool/server identity, sanitized arguments, approval, target, result, and correlation ID without storing secrets.
137
+ - Test timeout, tool error, truncated output, malformed result, model retry, and policy-service failure. Failures should not silently switch to a more privileged tool or credential.
138
+ - Verify kill switches, credential revocation, and disabling a component actually terminate active sessions and queued work.
139
+
140
+ ## Safe Testing Workflow
141
+
142
+ 1. **Map** every capability and trust boundary before injecting prompts.
143
+ 2. **Classify** tools as read, write, execute, communicate, identity/admin, or external-cost.
144
+ 3. **Establish controls** with dedicated test tenants, synthetic data, read-only credentials, budgets, and target allowlists.
145
+ 4. **Probe one boundary** at a time: selection, arguments, authorization, approval, execution, result handling.
146
+ 5. **Validate the side effect** in the target system and audit trail; compare denied and allowed identities.
147
+ 6. **Chain confirmed primitives** using the effective-authority and capability map from this skill.
148
+ 7. **Clean up and revoke** created data, sessions, tokens, and local servers.
149
+ 8. **Turn each confirmed case into a regression** across relevant models, prompts, tools, roles, and environments.
150
+
151
+ ## MCP Inspector (Conditional)
152
+
153
+ Use the official [MCP Inspector](https://github.com/modelcontextprotocol/inspector) only against a reviewed local/test server:
154
+
155
+ ```bash
156
+ npx @modelcontextprotocol/inspector@<reviewed-version> --cli \
157
+ --config reviewed-mcp.json --server test-server \
158
+ --method tools/list --format json
159
+ ```
160
+
161
+ - Current upstream requirements should be checked before pinning; as of August 12, 2026, MCP Inspector 2.1.0 requires Node.js `>=22.19.0`.
162
+ - Prefer CLI/TUI and loopback binding over exposing the web UI.
163
+ - Preserve the generated API token; never disable authentication or bind the process-spawning backend to an external interface.
164
+ - Do not publish ports 6274/6277 or pass through the Docker socket/host devices.
165
+ - `tools/list` is protocol-read-only, but launching/initializing an arbitrary stdio server executes it and list handlers can still have process-side effects. Review the server command/config first. Calling a tool can perform real external actions.
166
+ - Treat the inspected server command/config as executable; `npx` also downloads code, so pin a reviewed package version for repeatable or sensitive work.
167
+
168
+ ## Regression With Promptfoo (Conditional)
169
+
170
+ [Promptfoo](https://github.com/promptfoo/promptfoo) can encode a bounded model/tool safety matrix after manual validation:
171
+
172
+ ```bash
173
+ npx promptfoo@<reviewed-version> eval
174
+ ```
175
+
176
+ - Current upstream engine constraints should be checked before pinning; as of August 12, 2026, Promptfoo documents Node.js `^20.20.0` or `>=22.22.0`.
177
+ - Use synthetic prompts/data and a dedicated test provider/project.
178
+ - Provider calls transmit data externally and can incur cost even when evaluation orchestration is local. Set request/concurrency and spending ceilings.
179
+ - Pin model, provider, prompt, tool schema, retrieval corpus revision, and evaluator versions.
180
+ - Include allowed and denied controls across roles/tenants; use multiple runs for nondeterministic outcomes.
181
+ - Automated red-team labels are leads, not findings. Confirm the real tool call, data access, or side effect manually.
182
+ - Store redacted results; evaluation logs can contain system prompts, secrets, retrieved data, and tool arguments.
183
+
184
+ ## Validation
185
+
186
+ A report must include:
187
+
188
+ 1. initiating identity, tenant, model/runtime, and exact component versions
189
+ 2. effective-authority map and relevant tool/resource schema
190
+ 3. untrusted input source and decision boundary crossed
191
+ 4. exact target-side operation or data access, with redacted audit evidence
192
+ 5. denied identity/input and allowed control results across repeat runs
193
+ 6. credential, feature, approval, environment, and user-interaction prerequisites
194
+ 7. cleanup/revocation and a bounded regression case
195
+
196
+ ## False Positives
197
+
198
+ - The model claims a tool ran but the target and audit log show no action.
199
+ - A listed tool cannot be invoked by the tested identity or validates arguments safely.
200
+ - A safety refusal changes wording but effective capability remains denied.
201
+ - Cross-session output is synthetic, cached public data, or hallucinated rather than another user's data.
202
+ - A scanner flags an instruction string without showing that it reaches a privileged decision or sink.
203
+ - A component has broad declared permissions but the runtime credential/network policy prevents the claimed access.
204
+
205
+ ## Summary
206
+
207
+ Agent security is capability security. Map the real authority carried through models, tools, credentials, plugins, and delegated agents; validate authorization and approval at the target-side effect; treat every installed component as executable supply chain; and preserve each confirmed boundary failure as a bounded regression.