opencode-skills-collection 4.0.0 → 4.0.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.
- package/bundled-skills/.antigravity-install-manifest.json +24 -1
- package/bundled-skills/007/SKILL.md +2 -2
- package/bundled-skills/10-andruia-skill-smith/SKILL.md +1 -1
- package/bundled-skills/agent-squad/SKILL.md +5 -0
- package/bundled-skills/agent-squad/alex/SKILL.md +3 -0
- package/bundled-skills/agent-squad/aria/SKILL.md +3 -0
- package/bundled-skills/agent-squad/dep/SKILL.md +3 -0
- package/bundled-skills/agent-squad/luna/SKILL.md +4 -1
- package/bundled-skills/agent-squad/mason/SKILL.md +3 -0
- package/bundled-skills/agent-squad/max/SKILL.md +3 -0
- package/bundled-skills/agent-squad/quinn/SKILL.md +3 -0
- package/bundled-skills/agent-squad/rex/SKILL.md +3 -0
- package/bundled-skills/angular/metadata.json +1 -1
- package/bundled-skills/angular-best-practices/metadata.json +1 -1
- package/bundled-skills/angular-state-management/metadata.json +1 -1
- package/bundled-skills/angular-ui-patterns/metadata.json +1 -1
- package/bundled-skills/antigravity-skill-orchestrator/SKILL.md +2 -2
- package/bundled-skills/apify-actor-development/SKILL.md +2 -2
- package/bundled-skills/apple-container/SKILL.md +165 -0
- package/bundled-skills/apple-container/references/commands.md +1593 -0
- package/bundled-skills/apple-container/references/concepts.md +294 -0
- package/bundled-skills/apple-container/references/configuration.md +499 -0
- package/bundled-skills/apple-container/references/workflows.md +498 -0
- package/bundled-skills/ask-copilot/SKILL.md +112 -0
- package/bundled-skills/auto-research/SKILL.md +126 -0
- package/bundled-skills/brooks-lint/SKILL.md +1 -1
- package/bundled-skills/browser-harness/references/install.md +3 -1
- package/bundled-skills/chrome-extension-developer/SKILL.md +1 -1
- package/bundled-skills/clean-code-guard/SKILL.md +184 -0
- package/bundled-skills/clean-code-guard/references/ai-failure-modes.md +345 -0
- package/bundled-skills/clean-code-guard/references/comments-and-formatting.md +115 -0
- package/bundled-skills/clean-code-guard/references/dry-kiss-yagni.md +133 -0
- package/bundled-skills/clean-code-guard/references/naming-and-functions.md +187 -0
- package/bundled-skills/clean-code-guard/references/review-checklist.md +150 -0
- package/bundled-skills/clean-code-guard/references/solid.md +280 -0
- package/bundled-skills/clean-code-guard/references/sources.md +47 -0
- package/bundled-skills/cloudflare-security-audit/SKILL.md +137 -0
- package/bundled-skills/cloudflare-security-audit/references/AI-AND-LLM.md +67 -0
- package/bundled-skills/cloudflare-security-audit/references/ATTACK-CLASSES.md +116 -0
- package/bundled-skills/cloudflare-security-audit/references/CLIENT-SIDE.md +67 -0
- package/bundled-skills/cloudflare-security-audit/references/HUNTING.md +110 -0
- package/bundled-skills/cloudflare-security-audit/references/MEMORY-SAFETY-AND-BINARY.md +58 -0
- package/bundled-skills/cloudflare-security-audit/references/RECONNAISSANCE.md +46 -0
- package/bundled-skills/cloudflare-security-audit/references/VALIDATION-AND-REPORTING.md +109 -0
- package/bundled-skills/cloudflare-security-audit/references/WEB-PROTOCOL-AND-AUTH.md +85 -0
- package/bundled-skills/cloudflare-security-audit/resources/report-schema.json +210 -0
- package/bundled-skills/comfyui-gateway/references/troubleshooting.md +1 -1
- package/bundled-skills/commit/SKILL.md +2 -1
- package/bundled-skills/deepapi/SKILL.md +6 -6
- package/bundled-skills/docs/README.md +1 -1
- package/bundled-skills/docs/contributors/quality-bar.md +1 -1
- package/bundled-skills/docs/contributors/security-guardrails.md +1 -1
- package/bundled-skills/docs/integrations/jetski-cortex.md +5 -5
- package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +3 -3
- package/bundled-skills/docs/maintainers/ci-drift-fix.md +7 -5
- package/bundled-skills/docs/maintainers/merge-batch.md +24 -7
- package/bundled-skills/docs/maintainers/pr-autonomy.md +89 -0
- package/bundled-skills/docs/maintainers/release-notes-7.2.0.md +1 -1
- package/bundled-skills/docs/maintainers/release-process.md +9 -9
- package/bundled-skills/docs/maintainers/repo-growth-seo.md +5 -5
- package/bundled-skills/docs/maintainers/skills-date-tracking.md +1 -1
- package/bundled-skills/docs/maintainers/skills-update-guide.md +2 -2
- package/bundled-skills/docs/users/{antigravity-awesome-skills-vs-awesome-claude-skills.md → agentic-awesome-skills-vs-awesome-claude-skills.md} +5 -5
- package/bundled-skills/docs/users/ai-agent-skills.md +4 -4
- package/bundled-skills/docs/users/best-claude-code-skills-github.md +3 -3
- package/bundled-skills/docs/users/best-cursor-skills-github.md +3 -3
- package/bundled-skills/docs/users/bundles.md +56 -57
- package/bundled-skills/docs/users/claude-code-skills.md +6 -6
- package/bundled-skills/docs/users/codex-cli-skills.md +5 -5
- package/bundled-skills/docs/users/cursor-skills.md +3 -3
- package/bundled-skills/docs/users/faq.md +27 -15
- package/bundled-skills/docs/users/gemini-cli-skills.md +4 -4
- package/bundled-skills/docs/users/getting-started.md +22 -12
- package/bundled-skills/docs/users/kiro-integration.md +7 -7
- package/bundled-skills/docs/users/plugins.md +8 -9
- package/bundled-skills/docs/users/security-skills.md +1 -1
- package/bundled-skills/docs/users/skills-vs-mcp-tools.md +1 -1
- package/bundled-skills/docs/users/specialized-plugin-roadmap.md +3 -4
- package/bundled-skills/docs/users/usage.md +9 -9
- package/bundled-skills/docs/users/visual-guide.md +7 -7
- package/bundled-skills/docs/users/windows-truncation-recovery.md +1 -1
- package/bundled-skills/docs/users/workflows.md +1 -1
- package/bundled-skills/docs/vietnamese/BUNDLES.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/FAQ.vi.md +15 -8
- package/bundled-skills/docs/vietnamese/GETTING_STARTED.vi.md +12 -5
- package/bundled-skills/docs/vietnamese/QUALITY_BAR.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/README.vi.md +21 -17
- package/bundled-skills/docs/vietnamese/SECURITY_GUARDRAILS.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/SKILLS_README.vi.md +2 -2
- package/bundled-skills/docs/vietnamese/TRANSLATION_PLAN.vi.md +1 -1
- package/bundled-skills/docs/vietnamese/VISUAL_GUIDE.vi.md +8 -8
- package/bundled-skills/docs-guard/SKILL.md +109 -0
- package/bundled-skills/docs-guard/references/code-samples.md +46 -0
- package/bundled-skills/docs-guard/references/docstrings.md +60 -0
- package/bundled-skills/docs-guard/references/review-checklist.md +45 -0
- package/bundled-skills/docs-guard/references/sources.md +22 -0
- package/bundled-skills/docs-guard/references/verification.md +51 -0
- package/bundled-skills/efficient-web-research/SKILL.md +4 -0
- package/bundled-skills/electron-development/SKILL.md +1 -1
- package/bundled-skills/event-staffing-compliance/SKILL.md +3 -0
- package/bundled-skills/event-staffing-ordering/SKILL.md +3 -0
- package/bundled-skills/feature-tracking/SKILL.md +222 -0
- package/bundled-skills/flutter-expert/SKILL.md +6 -1
- package/bundled-skills/flutter-expert/resources/implementation-playbook.md +214 -0
- package/bundled-skills/gemini-deep-research/README.md +246 -0
- package/bundled-skills/gemini-deep-research/SKILL.md +136 -0
- package/bundled-skills/gemini-deep-research/requirements.txt +2 -0
- package/bundled-skills/gemini-deep-research/scripts/research.py +692 -0
- package/bundled-skills/git-pushing/SKILL.md +21 -4
- package/bundled-skills/git-pushing/scripts/smart_commit.sh +206 -11
- package/bundled-skills/go-in-depth/scripts/workflow-script.js +4 -1
- package/bundled-skills/grok-build/SKILL.md +167 -0
- package/bundled-skills/grok-build/references/cli.md +99 -0
- package/bundled-skills/huggingface-tool-builder/references/find_models_by_paper.sh +1 -1
- package/bundled-skills/idea-autopsy/SKILL.md +147 -0
- package/bundled-skills/it-manager-hospital/README.md +1 -1
- package/bundled-skills/it-manager-pro/README.md +1 -1
- package/bundled-skills/itil-expert/README.md +1 -1
- package/bundled-skills/langgraph/SKILL.md +1 -1
- package/bundled-skills/linkedin-content-generator/SKILL.md +1 -1
- package/bundled-skills/lint-and-validate/scripts/lint_runner.py +23 -23
- package/bundled-skills/lint-and-validate/scripts/type_coverage.py +30 -30
- package/bundled-skills/logic-lens/SKILL.md +1 -1
- package/bundled-skills/lore/LICENSE +21 -0
- package/bundled-skills/lore/README.md +386 -0
- package/bundled-skills/lore/README.zh-CN.md +386 -0
- package/bundled-skills/lore/SKILL.md +453 -0
- package/bundled-skills/lore/WORKFLOWS.md +216 -0
- package/bundled-skills/lore/WORKFLOWS.zh-CN.md +216 -0
- package/bundled-skills/lore/references/audit-template.md +60 -0
- package/bundled-skills/lore/references/compatibility.md +228 -0
- package/bundled-skills/lore/references/config.md +125 -0
- package/bundled-skills/lore/references/entry-format.md +70 -0
- package/bundled-skills/lore/references/history-command.md +106 -0
- package/bundled-skills/lore/references/monorepo-detection.md +78 -0
- package/bundled-skills/lore/references/platform-mirrors.md +377 -0
- package/bundled-skills/lore/references/stale-new-markers.md +62 -0
- package/bundled-skills/lore/references/summary-template.md +98 -0
- package/bundled-skills/lore/scripts/README.md +54 -0
- package/bundled-skills/lore/scripts/README.zh-CN.md +54 -0
- package/bundled-skills/lore/scripts/find_duplicates.py +211 -0
- package/bundled-skills/lore/scripts/find_stale.py +116 -0
- package/bundled-skills/lore/scripts/history.py +527 -0
- package/bundled-skills/lore/scripts/id_hash.py +32 -0
- package/bundled-skills/lore/scripts/list_entries.py +183 -0
- package/bundled-skills/lovable-cleanup/SKILL.md +3 -3
- package/bundled-skills/makepad-splash/SKILL.md +1 -1
- package/bundled-skills/mmx-cli/SKILL.md +14 -1
- package/bundled-skills/monopoly/SKILL.md +5 -0
- package/bundled-skills/monopoly/patterns/SKILL.md +4 -0
- package/bundled-skills/monopoly/scale-benchmarks/SKILL.md +4 -0
- package/bundled-skills/monopoly/security-checklist/SKILL.md +4 -0
- package/bundled-skills/monopoly/tech-matrix/SKILL.md +4 -0
- package/bundled-skills/mtls-configuration/SKILL.md +1 -1
- package/bundled-skills/network-101/SKILL.md +4 -5
- package/bundled-skills/nika/SKILL.md +270 -0
- package/bundled-skills/not-a-vibe-coder/SKILL.md +4 -0
- package/bundled-skills/ontoly-software-graph/SKILL.md +160 -0
- package/bundled-skills/openclaw-github-repo-commander/SKILL.md +1 -1
- package/bundled-skills/pilot-protocol/SKILL.md +6 -3
- package/bundled-skills/postgres-readonly-queries/README.md +77 -0
- package/bundled-skills/postgres-readonly-queries/SKILL.md +152 -0
- package/bundled-skills/postgres-readonly-queries/connections.example.json +34 -0
- package/bundled-skills/postgres-readonly-queries/requirements.txt +1 -0
- package/bundled-skills/postgres-readonly-queries/scripts/query.py +262 -0
- package/bundled-skills/pptx-deck-creation/SKILL.md +275 -0
- package/bundled-skills/pptx-deck-creation/references/audit-checklist.md +156 -0
- package/bundled-skills/pptx-deck-creation/references/design-profiles.md +96 -0
- package/bundled-skills/pptx-deck-creation/references/python-snippets.md +150 -0
- package/bundled-skills/pptx-deck-creation/references/reference-deck-analysis.md +91 -0
- package/bundled-skills/pptx-deck-creation/references/visual-asset-adapters.md +158 -0
- package/bundled-skills/privilege-escalation-methods/SKILL.md +1 -1
- package/bundled-skills/product-decision-agent/SKILL.md +94 -0
- package/bundled-skills/product-decision-agent/agents/openai.yaml +7 -0
- package/bundled-skills/product-decision-agent/references/methodology-basis.md +232 -0
- package/bundled-skills/product-decision-agent/references/product-playbooks.md +813 -0
- package/bundled-skills/product-decision-agent/references/reasoning-engine.md +289 -0
- package/bundled-skills/product-decision-agent/references/response-examples.md +279 -0
- package/bundled-skills/product-decision-agent/scripts/quality_gate.py +221 -0
- package/bundled-skills/product-decision-agent/scripts/test_quality_gate.py +94 -0
- package/bundled-skills/pytest-skill/reference/playbook.md +358 -0
- package/bundled-skills/quit-sponsor/SKILL.md +96 -0
- package/bundled-skills/rclone-cli/references/providers/s3.md +1 -1
- package/bundled-skills/security-and-hardening/SKILL.md +1 -1
- package/bundled-skills/semgrep-rule-creator/SKILL.md +6 -6
- package/bundled-skills/skill-creator/README.md +3 -3
- package/bundled-skills/skill-creator/SKILL.md +8 -4
- package/bundled-skills/skill-creator/scripts/quick_validate.py +1 -1
- package/bundled-skills/sql-injection-testing/SKILL.md +4 -4
- package/bundled-skills/subagent-orchestrator/README.md +1 -1
- package/bundled-skills/super-code/bash/SKILL.md +3 -0
- package/bundled-skills/super-code/c/SKILL.md +3 -0
- package/bundled-skills/super-code/cpp/SKILL.md +3 -0
- package/bundled-skills/super-code/csharp/SKILL.md +3 -0
- package/bundled-skills/super-code/dart/SKILL.md +3 -0
- package/bundled-skills/super-code/elixir/SKILL.md +3 -0
- package/bundled-skills/super-code/go/SKILL.md +3 -0
- package/bundled-skills/super-code/java/SKILL.md +3 -0
- package/bundled-skills/super-code/kotlin/SKILL.md +3 -0
- package/bundled-skills/super-code/php/SKILL.md +3 -0
- package/bundled-skills/super-code/python/SKILL.md +3 -0
- package/bundled-skills/super-code/ruby/SKILL.md +3 -0
- package/bundled-skills/super-code/rust/SKILL.md +3 -0
- package/bundled-skills/super-code/scala/SKILL.md +3 -0
- package/bundled-skills/super-code/swift/SKILL.md +3 -0
- package/bundled-skills/super-code/typescript/SKILL.md +3 -0
- package/bundled-skills/telegram-bot-messaging/README.md +185 -0
- package/bundled-skills/telegram-bot-messaging/SKILL.md +101 -0
- package/bundled-skills/telegram-bot-messaging/scripts/telegram.sh +420 -0
- package/bundled-skills/test-guard/SKILL.md +132 -0
- package/bundled-skills/test-guard/references/jest.md +50 -0
- package/bundled-skills/test-guard/references/llm-app-testing.md +40 -0
- package/bundled-skills/test-guard/references/phpunit.md +56 -0
- package/bundled-skills/test-guard/references/pytest.md +65 -0
- package/bundled-skills/trading-ledger/SKILL.md +11 -3
- package/bundled-skills/uizze-ui-research/SKILL.md +93 -0
- package/bundled-skills/vibe-code-auditor/SKILL.md +1 -1
- package/bundled-skills/vibecode-production-qa-validator/SKILL.md +1 -1
- package/bundled-skills/videodb/scripts/ws_listener.py +29 -15
- package/bundled-skills/voice-ai-engine-development/README.md +1 -1
- package/bundled-skills/vulnerability-scanner/SKILL.md +1 -1
- package/bundled-skills/warehouse/SKILL.md +154 -0
- package/bundled-skills/woo-guard/SKILL.md +113 -0
- package/bundled-skills/woo-guard/references/checkout-and-money.md +64 -0
- package/bundled-skills/woo-guard/references/hpos-and-crud.md +87 -0
- package/bundled-skills/woo-guard/references/review-checklist.md +44 -0
- package/bundled-skills/woo-guard/references/sources.md +17 -0
- package/bundled-skills/wp-guard/SKILL.md +119 -0
- package/bundled-skills/wp-guard/references/i18n.md +88 -0
- package/bundled-skills/wp-guard/references/performance.md +70 -0
- package/bundled-skills/wp-guard/references/review-checklist.md +57 -0
- package/bundled-skills/wp-guard/references/security.md +100 -0
- package/bundled-skills/wp-guard/references/sources.md +27 -0
- package/bundled-skills/writing-skills/gotchas.md +1 -1
- package/bundled-skills/writing-skills/references/standards/metadata-standard.md +1 -1
- package/bundled-skills/x-twitter-scraper/SKILL.md +14 -32
- package/bundled-skills/xss-html-injection/SKILL.md +3 -3
- package/bundled-skills/youtube-seo-optimizer/SKILL.md +1 -1
- package/bundled-skills/youtube-summarizer/CHANGELOG.md +2 -2
- package/package.json +1 -1
- package/skills_index.json +273 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "cloudflare-security-audit"
|
|
3
|
+
description: "Audit authorized codebases for exploitable vulnerabilities using scoped reconnaissance, adversarial review, validation, and structured reporting."
|
|
4
|
+
risk: "offensive"
|
|
5
|
+
source: "community"
|
|
6
|
+
source_repo: "cloudflare/security-audit-skill"
|
|
7
|
+
source_type: "community"
|
|
8
|
+
date_added: 2026-07-13
|
|
9
|
+
author: "community"
|
|
10
|
+
tags: []
|
|
11
|
+
tools: []
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Security Audit
|
|
16
|
+
|
|
17
|
+
> [!WARNING]
|
|
18
|
+
> **Authorized Use Only.** Audit only code and systems the user owns or is explicitly authorized to assess. Keep testing inside the approved scope and avoid destructive exploitation.
|
|
19
|
+
|
|
20
|
+
## Example
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
User: Audit this repository for authorization bypasses and injection paths. Keep testing local and non-destructive.
|
|
24
|
+
Agent: I will confirm the repository scope, map trust boundaries, validate each candidate, and report only reproducible findings.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You are a security auditor. Your job is to find **exploitable vulnerabilities with real impact**.
|
|
28
|
+
|
|
29
|
+
## When to Use
|
|
30
|
+
|
|
31
|
+
Use this skill when asked to perform a security audit, find security bugs, do a security review, audit for vulnerabilities, or pen-test a codebase. Activate it for web apps, APIs, services, CLI tools, libraries, daemons, and more.
|
|
32
|
+
|
|
33
|
+
## Platform terminology
|
|
34
|
+
|
|
35
|
+
This skill is agent-neutral. In the methodology:
|
|
36
|
+
|
|
37
|
+
- **Task tool** means the coding agent's delegation or sub-agent mechanism.
|
|
38
|
+
- **`research` agent** means a delegated agent optimized for focused codebase exploration and factual verification.
|
|
39
|
+
- **`general` agent** means a delegated agent that can investigate broadly and spawn focused research agents.
|
|
40
|
+
- **`subagent_type`** means the equivalent delegated-agent role supported by the current platform.
|
|
41
|
+
|
|
42
|
+
Use the platform's equivalent capabilities while preserving the specified roles, parallelism, prompts, and independence boundaries.
|
|
43
|
+
|
|
44
|
+
## Setup
|
|
45
|
+
|
|
46
|
+
Before starting, establish two paths:
|
|
47
|
+
- **Target**: the codebase to audit (from the user's request or the current working directory)
|
|
48
|
+
- **Output directory**: where all audit artifacts go. Ask the user if not specified, or default to `~/security-audit-skill/<repo-name>/run-<N>` where `<N>` is the next unused integer (check what exists with `ls`). Create it if it doesn't exist. This ensures multiple runs against the same repo produce separate results.
|
|
49
|
+
|
|
50
|
+
All files written during the audit go in the output directory:
|
|
51
|
+
- `architecture.md` — Phase 1 output, fed into Phase 2 agent prompts
|
|
52
|
+
- `REPORT.md` — human-readable report (Phase 4)
|
|
53
|
+
- `FINDINGS-DETAIL.md` — detailed data flows for MEDIUM+ findings (Phase 4)
|
|
54
|
+
- `findings.json` — machine-readable structured output (Phase 5)
|
|
55
|
+
|
|
56
|
+
Subagents (Phases 1, 2, 3, 6) do NOT write files — they return results to you via the Task tool. You are responsible for writing all files to the output directory.
|
|
57
|
+
|
|
58
|
+
### Coverage and prior runs
|
|
59
|
+
|
|
60
|
+
Each audit run explores different code paths depending on which agents find what and where they dig. No single run finds everything. Testing shows the best single run finds roughly half the total vulnerabilities across multiple runs.
|
|
61
|
+
|
|
62
|
+
**If prior runs exist** for the same repo (check `~/security-audit-skill/<repo-name>/`), read their `findings.json` files before starting Phase 2. Use them to:
|
|
63
|
+
1. **Skip known findings** — don't waste agents re-discovering the same status bypass. Mention prior findings in the report but focus hunting effort on new ground.
|
|
64
|
+
2. **Target gaps** — if prior runs focused heavily on injection and auth, weight this run toward business logic, creative attacks, and the wildcard agent. If prior runs missed public endpoints, focus there.
|
|
65
|
+
3. **Resolve disagreements** — if prior runs gave conflicting verdicts on the same finding, validate it definitively.
|
|
66
|
+
|
|
67
|
+
Include a brief summary of prior runs in the architecture summary so Phase 2 agents know what's already been found.
|
|
68
|
+
|
|
69
|
+
**If no prior runs exist**, note in the report that coverage improves with additional runs and recommend the user run the audit again to catch findings this run may have missed.
|
|
70
|
+
|
|
71
|
+
## Core Principles
|
|
72
|
+
|
|
73
|
+
### Only report what you can exploit
|
|
74
|
+
|
|
75
|
+
Every finding must have a concrete attack scenario: who is the attacker, what do they do, and what do they get? "An attacker could theoretically..." is not a finding. "Send this request, get this result" is.
|
|
76
|
+
|
|
77
|
+
### Confirm dynamically when you can
|
|
78
|
+
|
|
79
|
+
This is a source-first audit, but a claim you can execute beats one you can only argue. Where the target is locally buildable — a parser, a library, a CLI, a native component — build and run it: reproduce the crash, run the payload, diff the two parsers on the same bytes. Better still, **extract the suspect code into a minimal standalone harness** and test the hypothesis in isolation — fuzz the one function, feed it the crafted input, watch what it does. Where confirmation needs infrastructure you don't have — a proxy chain, a live cache, production auth — you cannot confirm from source alone: mark it "requires deployment testing" and do not report it as confirmed. Dynamic evidence is what resolves the memory-safety and request-framing classes that static reading leaves ambiguous.
|
|
80
|
+
|
|
81
|
+
### Determine the baseline dynamically
|
|
82
|
+
|
|
83
|
+
In Phase 1, identify what this application is and what comparable applications exist. Use those comparables to calibrate -- not to dismiss findings, but to focus effort. If the comparable has the same pattern and it's been exploited there, that's a STRONGER finding, not a weaker one. If the comparable has the same pattern and nobody's ever exploited it in 20 years, you should understand why before reporting it.
|
|
84
|
+
|
|
85
|
+
Do NOT hardcode a specific comparable. A CMS gets compared to other CMSes. An API gateway gets compared to other API gateways. A novel application may have no meaningful comparable.
|
|
86
|
+
|
|
87
|
+
### Defense-in-depth gaps are not vulnerabilities
|
|
88
|
+
|
|
89
|
+
If Layer A prevents the attack, the absence of Layer B is a hardening note, not a finding. Report it separately if you want, but do not inflate its severity.
|
|
90
|
+
|
|
91
|
+
### Severity requires impact
|
|
92
|
+
|
|
93
|
+
Severity is the combination of **likelihood** (how easy to exploit, what access is needed) and **impact** (what damage is achieved). Use both axes:
|
|
94
|
+
|
|
95
|
+
- **CRITICAL**: Unauthenticated RCE, full database dump, admin account takeover without credentials
|
|
96
|
+
- **HIGH**: Authenticated RCE, SQL injection with data exfiltration, stored XSS that fires for all users, auth bypass. Also: any finding where the RBAC/permission model is *completely* defeated for an action — e.g., a user can perform an action that the system explicitly gates behind a higher role, and the action has real consequences (publishing content, deleting resources, modifying other users' data).
|
|
97
|
+
- **MEDIUM**: Targeted XSS requiring specific conditions, CSRF with meaningful state change, information disclosure of secrets/credentials. Also: business logic bypasses with real but limited consequences — e.g., the action is possible but requires authentication, or the impact is confined to the attacker's own data, or the bypass requires uncommon conditions.
|
|
98
|
+
- **LOW**: Information disclosure of non-secret data, DoS requiring sustained effort
|
|
99
|
+
- **INFORMATIONAL**: A confirmed but minimal-impact observation with no standalone exploit — useful mainly as a building block for another finding. Pure defense-in-depth gaps belong in hardening notes, not here.
|
|
100
|
+
|
|
101
|
+
The key distinction between HIGH and MEDIUM for business logic findings: **does the finding defeat an explicit security boundary?** Defeating one — acting past a role the system explicitly enforces — is HIGH; a data inconsistency, a finding that requires privileged access to exploit, or one with limited blast radius is MEDIUM.
|
|
102
|
+
|
|
103
|
+
If you cannot describe the concrete damage an attacker achieves, the severity is probably lower than you think.
|
|
104
|
+
|
|
105
|
+
These principles are enforced operationally by the **validation rules in [HUNTING.md](references/HUNTING.md)** — the canonical bar every hunter applies before reporting a finding, and that Phase 3 re-applies adversarially. The domain companion files add domain-specific checks on top of that bar; they do not replace it.
|
|
106
|
+
|
|
107
|
+
## Workflow overview
|
|
108
|
+
|
|
109
|
+
Follow all six phases in order:
|
|
110
|
+
|
|
111
|
+
1. **Recon** — Run Phase 1 from [RECONNAISSANCE.md](references/RECONNAISSANCE.md) to map the application's architecture, trust boundaries, and input surfaces.
|
|
112
|
+
2. **Hunt** — Use [HUNTING.md](references/HUNTING.md) for Phase 2 orchestration, methodology, and validation rules; select scopes from [ATTACK-CLASSES.md](references/ATTACK-CLASSES.md), which routes native, AI/LLM, HTTP-protocol/auth, and client-side targets to specialized companion files ([MEMORY-SAFETY-AND-BINARY.md](references/MEMORY-SAFETY-AND-BINARY.md), [AI-AND-LLM.md](references/AI-AND-LLM.md), [WEB-PROTOCOL-AND-AUTH.md](references/WEB-PROTOCOL-AND-AUTH.md), [CLIENT-SIDE.md](references/CLIENT-SIDE.md)).
|
|
113
|
+
3. **Validate** — Use Phase 3 in [VALIDATION-AND-REPORTING.md](references/VALIDATION-AND-REPORTING.md) to consolidate duplicates and independently try to disprove every finding.
|
|
114
|
+
4. **Report** — Use Phase 4 in [VALIDATION-AND-REPORTING.md](references/VALIDATION-AND-REPORTING.md) to write `REPORT.md` and `FINDINGS-DETAIL.md`.
|
|
115
|
+
5. **Structured output** — Use Phase 5 in [VALIDATION-AND-REPORTING.md](references/VALIDATION-AND-REPORTING.md) and `resources/report-schema.json` to write `findings.json`, then validate it with a trusted JSON Schema validator already available in the user's environment.
|
|
116
|
+
6. **Independent verification** — Use Phase 6 in [VALIDATION-AND-REPORTING.md](references/VALIDATION-AND-REPORTING.md) to verify every factual claim and reconcile all outputs.
|
|
117
|
+
|
|
118
|
+
## Limitations
|
|
119
|
+
|
|
120
|
+
- Requires a coding agent with a model that supports tool use and parallel sub-agents
|
|
121
|
+
- A trusted JSON Schema validator is required for structural validation in Phase 5
|
|
122
|
+
- Multiple runs are needed for full coverage — a single run typically finds roughly half of the total vulnerabilities
|
|
123
|
+
- The skill does not replace manual penetration testing or automated SAST/DAST tools
|
|
124
|
+
## Anti-Patterns to Avoid
|
|
125
|
+
|
|
126
|
+
These are the mistakes that make security audits useless:
|
|
127
|
+
|
|
128
|
+
1. **Listing everything that deviates from OWASP as a finding.** OWASP is a checklist, not a bug list. Every real application makes tradeoffs.
|
|
129
|
+
2. **Rating defense-in-depth gaps as HIGH/CRITICAL.** "Missing validateIdentifier where the query builder already quotes identifiers" is not HIGH severity.
|
|
130
|
+
3. **Ignoring the deployment model.** Rate limiting at the CDN layer is a valid architecture. Not every app needs application-level rate limiting.
|
|
131
|
+
4. **Treating designed behavior as a bug.** Understand the trust model before auditing. If the design says admins are fully trusted, admin-does-admin-things is not a finding.
|
|
132
|
+
5. **Padding the report with LOW findings to look thorough.** Ten LOWs don't make a useful report. Three MEDIUMs do.
|
|
133
|
+
6. **"Potential" findings without proof.** Either you can exploit it or you can't. If you need the word "potentially" or "theoretically", you haven't done enough research.
|
|
134
|
+
7. **Ignoring what the codebase does well.** If auth is solid, say so. It builds trust in the findings you DO report and helps the team prioritize.
|
|
135
|
+
8. **Constructing exploits from incorrect parser/runtime assumptions.** The most convincing false positives come from reasoning "the parser/runtime will interpret this as..." without verifying. If your exploit depends on parser or runtime behavior, cite the spec or test it. Don't assume.
|
|
136
|
+
9. **Skipping business logic and creative attacks.** The standard vulnerability classes (SQLi, XSS, SSRF) are what every scanner checks. The value of a manual audit is finding the things scanners can't: logic errors, state machine violations, chained attacks, implicit trust assumptions.
|
|
137
|
+
10. **Giving up too easily.** "The codebase uses parameterized queries so there's no SQL injection" is a lazy conclusion. Check EVERY use of sql.raw(). Check dynamic identifiers. Check search/FTS. Check if there's a code path that bypasses the query builder. Push.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# AI, LLM, and Agent Hunting
|
|
2
|
+
|
|
3
|
+
#### When to use this file
|
|
4
|
+
|
|
5
|
+
Reach for this file when the target embeds a language model in a trust-sensitive path: chatbots and assistants, RAG pipelines, agent/tool-calling loops, MCP servers and clients, code that builds prompts from untrusted input, or code that consumes model output and acts on it. These targets fail differently from ordinary web apps — the dangerous data flow is *untrusted text → model → capability or sink*, and the model is a confused deputy that will faithfully carry attacker instructions across a trust boundary the developer assumed the model would respect. It won't.
|
|
6
|
+
|
|
7
|
+
Use this alongside `ATTACK-CLASSES.md`, not instead of it: the transport is still HTTP, the tools still hit SQL/shell/filesystem sinks, and access control still applies. This file covers the model-specific layer on top.
|
|
8
|
+
|
|
9
|
+
Pick the relevant classes based on Phase 1. Split per subsystem (retrieval, tool dispatch, output rendering) for large targets.
|
|
10
|
+
|
|
11
|
+
## Core discipline (include in every agent prompt for this domain)
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
- "The model can be prompt-injected" is NOT a finding on its own. Prompt injection that only affects the attacker's own session and their own output is a party trick. A finding requires the injection to CROSS A BOUNDARY: reach a victim's context, invoke a capability the requester lacks, exfiltrate data the requester can't see, or drive a downstream sink the attacker couldn't otherwise reach (server-side SQL/shell/SSRF beyond their own session). Name the boundary crossed.
|
|
15
|
+
- The bug is in the CODE, not the model. The finding is the missing code-level gate between attacker-influenceable input and a dangerous capability or sink — point at the line that grants the capability, trusts the output, or feeds the context, not the model's mood. Non-determinism is not a defense: the model's probability of complying is an exploitability detail, never a reporting blocker. If the code makes the output harmless (output that never reaches a sink), there is no finding regardless of what the model can be talked into saying.
|
|
16
|
+
- Model output is untrusted input. Trace it to its sink with the same rigor as any user input. "It came from our model" is the exact assumption being attacked.
|
|
17
|
+
- A guardrail prompt ("never reveal the system prompt", "refuse harmful requests") is not a security control. Do not credit it as a mitigation. If the only thing standing between the attacker and impact is instructions in the prompt, the boundary is undefended.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Prompt-injection attack classes (subagent_type: `general`)
|
|
21
|
+
|
|
22
|
+
**Indirect injection via retrieved / ingested content**
|
|
23
|
+
The high-value class. Attacker plants instructions in data the model later ingests in *someone else's* session: a RAG document, an indexed web page, a file upload, an email, an issue/PR body, a tool's response, a filename. Trace every source that reaches the prompt context and ask "who can write this, and whose session does it fire in?" Find the ingestion path; confirm the content reaches the context window unfiltered; confirm that context has a capability worth hijacking.
|
|
24
|
+
|
|
25
|
+
**Tool-argument injection (model output → sink)**
|
|
26
|
+
The model emits a tool call and the code executes it with model-generated arguments. Those arguments hit a real sink — SQL (`query(args.filter)`), shell (`exec(args.cmd)`), file path (`readFile(args.path)`), HTTP (`fetch(args.url)` → SSRF), or another API. The code trusts the arguments because "the model produced structured output." Trace each tool handler's parameters to their sink and validate them at the handler like any request body.
|
|
27
|
+
|
|
28
|
+
**Direct injection into a privileged capability**
|
|
29
|
+
Direct (same-session) injection only matters when the model can do something the *user* is not authorized to do directly. If the assistant runs tools under a service identity, or has a system prompt containing secrets, or can reach internal endpoints, then a user talking the model into using those crosses a privilege boundary even in their own session. If the model can only do what the user could already do via the UI, direct injection is not a finding. Hunt step: enumerate every capability the assistant holds that its users don't, then check whether same-session user text can steer the model into each.
|
|
30
|
+
|
|
31
|
+
**Prompt-template / delimiter injection**
|
|
32
|
+
Untrusted input concatenated into the prompt without fencing or role separation, so the attacker forges structure the orchestrator trusts: a fake system turn, a fabricated prior conversation turn, or a counterfeit tool result. The finding is the assembly code — the concatenation that lets user bytes impersonate a trusted role — not the model obeying them. Find where the prompt is built and whether untrusted spans are delimited or escaped from control text.
|
|
33
|
+
|
|
34
|
+
## Agent and tool-calling attack classes (subagent_type: `general`)
|
|
35
|
+
|
|
36
|
+
**Excessive agency / confused-deputy authority**
|
|
37
|
+
The agent executes tools under *its own* identity (service account, broad API key, DB superuser) rather than the requesting user's. Every tool call is then a privilege-escalation vector: the user asks, the agent acts with more authority than the user has. Check whether tool execution re-checks the *user's* permission on the *specific resource*, or just that "the agent is allowed to call this tool." The same gap at the parameter level is IDOR through tools: `get_document(id)` / `read_file(path)` with the ID filled from user text and no check that *this* user may reach *that* resource — endpoint IDOR reached by asking. Common false positive: a shared service credential that runs every query *scoped to the authenticated user's ID* is normal, safe architecture — not a confused deputy.
|
|
38
|
+
|
|
39
|
+
**Unbounded action loops / cost and side-effect abuse**
|
|
40
|
+
Agent loops that call tools until a goal is met: can an attacker drive an expensive or irreversible loop (spend, send, delete, external API calls) through a single crafted request? Look for tool calls with side effects inside a model-controlled iteration with no per-action authorization or budget. The impact that makes this a finding crosses out of the attacker's own session — it hits the operator's bill, a shared rate/quota limit, or other tenants' availability (denial-of-wallet), so it survives the "capability they already have" test even when the attacker only touches their own request.
|
|
41
|
+
|
|
42
|
+
**Sub-agent / MCP trust inheritance**
|
|
43
|
+
When an agent spawns sub-agents or connects to MCP servers, what identity and context do they inherit? A sub-agent or tool server that receives the full session, credentials, or a broader capability set than the task needs is a lateral-movement primitive. A malicious or compromised MCP server is an attacker that speaks directly into the model's context — treat its responses as indirect injection.
|
|
44
|
+
|
|
45
|
+
## Output-handling and disclosure attack classes (subagent_type: `general`)
|
|
46
|
+
|
|
47
|
+
**Insecure output rendering (XSS / injection via model output)**
|
|
48
|
+
Model output rendered as HTML/Markdown without sanitization → stored/reflected XSS. Markdown image/link rendering is the classic exfiltration channel: the model emits `` and the client fetches it, leaking context to the attacker's server. Check where model output is displayed and whether it's treated as trusted HTML. The image-exfil channel only fires if the render surface auto-loads remote resources and no CSP `img-src` restricts the destination — if the rendering client is out of scope or unknown (native app, terminal, CSP-locked web UI), the sink is unconfirmed: treat it as unverifiable, not a finding.
|
|
49
|
+
|
|
50
|
+
**System-prompt / context extraction to a real secret**
|
|
51
|
+
Extraction is only a finding if the context actually contains something sensitive — API keys, other users' data, internal URLs, hidden business rules that gate access. Confirm the secret is really in the context (read the prompt-assembly code) before reporting. A leaked generic "you are a helpful assistant" prompt is not a finding.
|
|
52
|
+
|
|
53
|
+
**Cross-session / multi-tenant context bleed**
|
|
54
|
+
Conversation history, embeddings, or the KV/prompt cache keyed too broadly, so one user's context appears in another's session. Trace the cache/session key: is it scoped per user, or is there a path where a shared key mixes tenants? Related: retrieval (vector or keyword search) that lacks a per-tenant metadata/ACL filter at query time pulls another tenant's chunks into context — IDOR at the retrieval layer; confirm the query itself applies the tenant filter, not just that documents carry a tenant field. These are code bugs (bad cache key, shared buffer, unfiltered query), not model behavior — verify them in the storage/retrieval layer.
|
|
55
|
+
|
|
56
|
+
## Universal moves (apply across the above)
|
|
57
|
+
|
|
58
|
+
- **Draw the boundary before hunting.** Enumerate: what identity do tools run as, what's in the context window, who can write to each context source, where does output go. Most AI findings fall out of a correct map of these four; most AI false positives come from not drawing it.
|
|
59
|
+
- **Find the capability, then find who can reach it.** Start from the most dangerous tool (delete, spend, exec, fetch-internal) and work backwards to whether untrusted text can reach its arguments. Power × reachability, same as any privileged interface.
|
|
60
|
+
|
|
61
|
+
## Validation rules (apply before reporting ANY finding here)
|
|
62
|
+
|
|
63
|
+
1. **Name the boundary crossed.** State exactly who the attacker is, whose session/identity the payload executes in, and what they get that they couldn't get directly. If attacker and victim are the same principal and the capability is one they already have, it is not a finding.
|
|
64
|
+
2. **For confused-deputy / excessive-agency claims, prove both halves.** Show (a) the tool performs no per-resource check scoped to the requesting user, AND (b) the action is one the user could not perform through a normal authenticated request. A shared service credential with per-user query scoping fails both tests and is not a finding.
|
|
65
|
+
3. **Cite the trusting line and prove the taint reaches it.** For tool-argument and output findings, show the concrete sink (the `exec`/`query`/`fetch`/`innerHTML`) with model-influenced data reaching it unvalidated; for extraction/disclosure findings, cite the prompt-assembly code and confirm the secret or cross-tenant data is really in the context. If you can't cite the code, you have a black-box observation, not a finding.
|
|
66
|
+
4. **Don't assert capabilities you can't see in source.** Claims that depend on deployment facts not in the repo — whether an "internal-only" endpoint is actually unreachable by the user, what a tool's target really exposes, which client renders the output — are unverifiable from source. If the user could reach the same thing directly (flat network, same origin), it is not a privilege crossing. Confirm the capability and the boundary in code, or mark it unverifiable rather than reporting it.
|
|
67
|
+
5. **Return ONLY confirmed findings** with the boundary crossed, the trusting code path, and the observable result — or "No exploitable AI/LLM issues found" if that's honest.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Attack Classes
|
|
2
|
+
|
|
3
|
+
#### Attack classes — choose and split based on Phase 1
|
|
4
|
+
|
|
5
|
+
Select attack classes relevant to the application type. Not every class applies to every codebase. The list below is a starting point — add application-specific ones based on Phase 1. For large codebases, split classes per subsystem.
|
|
6
|
+
|
|
7
|
+
> **Native / binary / kernel targets** (C/C++/Rust-unsafe, kernel modules, parsers and decoders, reverse-engineering tooling, runtimes/JITs, firmware): the web-oriented classes below fit poorly. Use the memory-safety, binary, and kernel classes in [MEMORY-SAFETY-AND-BINARY.md](MEMORY-SAFETY-AND-BINARY.md) instead of or alongside them.
|
|
8
|
+
>
|
|
9
|
+
> **AI / LLM / agent targets** (chatbots, RAG pipelines, tool-calling agents, MCP servers/clients, anything that builds prompts from untrusted input or acts on model output): use the prompt-injection, agency, and output-handling classes in [AI-AND-LLM.md](AI-AND-LLM.md) alongside the classes below.
|
|
10
|
+
>
|
|
11
|
+
> **HTTP-protocol and auth targets** (reverse proxies, CDNs, API gateways, custom HTTP parsers, and anything implementing sessions, JWT, OAuth/OIDC, or SAML): use the request-framing, cache, and auth-protocol classes in [WEB-PROTOCOL-AND-AUTH.md](WEB-PROTOCOL-AND-AUTH.md) alongside the classes below.
|
|
12
|
+
>
|
|
13
|
+
> **Client-side / browser targets** (SPAs, browser extensions, embedded webviews, anything using `postMessage`, CORS, or WebSockets, or that renders untrusted content in the DOM): use the DOM-injection, messaging-trust, and UI-redress classes in [CLIENT-SIDE.md](CLIENT-SIDE.md) alongside the classes below.
|
|
14
|
+
|
|
15
|
+
**Injection** (subagent_type: `general`)
|
|
16
|
+
Trace untrusted input from entry point to dangerous sink. What counts as a "dangerous sink" depends on the application:
|
|
17
|
+
- Web apps: SQL queries, HTML output, shell commands, template engines, file paths, HTTP redirects, deserialization
|
|
18
|
+
- Libraries: any function that processes caller-supplied data without validation — buffer operations, parsers, format strings
|
|
19
|
+
- CLI tools: shell command construction, file path handling, environment variable interpolation
|
|
20
|
+
- Services: query construction, message serialization, log injection, LDAP/XPATH queries
|
|
21
|
+
- Client-side (browser/JS): DOM XSS, prototype pollution, `postMessage`/origin trust, and other browser-side classes — see [CLIENT-SIDE.md](CLIENT-SIDE.md)
|
|
22
|
+
|
|
23
|
+
Don't just check the obvious direct paths. Look for indirect injection: data stored safely, then retrieved and used in a dangerous context by different code. Look for injection through field names, keys, headers, and metadata — not just values. Look for injection into secondary systems (logs, caches, search indexes, analytics).
|
|
24
|
+
|
|
25
|
+
**Access control** (subagent_type: `general`)
|
|
26
|
+
Can a caller do something they shouldn't? Go beyond checking whether permission checks exist — verify they check the *right* permission for the *right* resource via the *right* mechanism:
|
|
27
|
+
- Is there a path to the same state change that checks a different (weaker) permission?
|
|
28
|
+
- Can a field in the request body override what the permission system intended to restrict?
|
|
29
|
+
- Are there endpoints that gate on authentication but forget authorization?
|
|
30
|
+
- Does the same resource have multiple access paths with inconsistent checks?
|
|
31
|
+
- What about bulk/batch/export/import operations — do they enforce per-item permissions?
|
|
32
|
+
|
|
33
|
+
For complex access models, split into separate agents for auth bypass vs authorization logic.
|
|
34
|
+
|
|
35
|
+
**Resource and file handling** (subagent_type: `general`)
|
|
36
|
+
- Path traversal (reading/writing outside intended directories) — including through symlinks, encoded sequences, and null bytes
|
|
37
|
+
- SSRF (making the application fetch attacker-controlled URLs) — including through redirects, DNS rebinding, and URL parser differentials
|
|
38
|
+
- Unsafe deserialization, archive extraction (zip slip), temp file handling
|
|
39
|
+
- Memory safety (if applicable): buffer overflows, use-after-free, integer overflow
|
|
40
|
+
- Race conditions on file operations (TOCTOU between check and use)
|
|
41
|
+
|
|
42
|
+
**Cryptography and secrets** (subagent_type: `general`)
|
|
43
|
+
- Weak randomness for security-critical values (tokens, keys, nonces)
|
|
44
|
+
- Hardcoded secrets, secrets in logs, error messages, URLs, or client-visible responses
|
|
45
|
+
- Broken key derivation, missing HMAC verification, nonce reuse
|
|
46
|
+
- Timing side-channels on secret comparison
|
|
47
|
+
- Misuse of crypto primitives (ECB mode, unauthenticated encryption, static IVs, etc.)
|
|
48
|
+
- What happens when crypto operations fail? Does the error path fall back to no-crypto?
|
|
49
|
+
|
|
50
|
+
**Business logic** (subagent_type: `general`)
|
|
51
|
+
This is where the real bugs hide. Standard scanners can't find logic errors. For each major workflow:
|
|
52
|
+
- **State machine violations**: Can you skip steps? Go backwards? Reach an invalid state? What happens if you replay a completed flow? What about partial failure — if step 2 of 3 fails, is step 1 rolled back?
|
|
53
|
+
- **Race conditions with business impact**: Concurrent operations that produce invalid states (double-spend, double-approve, lost updates). Focus on operations that check-then-act non-atomically.
|
|
54
|
+
- **Numeric/quantity manipulation**: Negative values, zero values, overflow, precision loss, type coercion between string and number.
|
|
55
|
+
- **Access boundary violations**: Not "does the permission check exist" but "is it the right check for the business rule?" Can input to one operation bypass a restriction enforced on a different operation for the same effect?
|
|
56
|
+
- **Implicit trust assumptions**: Data from storage, config, other components, or plugins assumed safe because "we validated it on the way in." What if a different code path wrote it?
|
|
57
|
+
- **Time-based logic**: Expiry checks, scheduling, rate windows, clock skew. What happens at exact boundary moments? What about timezone differences between components?
|
|
58
|
+
- **Default and fallback behavior**: What's the security posture when config is missing? When a feature flag is off? When a dependency is unavailable? When the system is mid-migration?
|
|
59
|
+
|
|
60
|
+
**Feature abuse and data leakage** (subagent_type: `general`)
|
|
61
|
+
Legitimate features used for unintended purposes. Don't look for bugs in the code — look for bugs in the design:
|
|
62
|
+
- **Export/backup as exfiltration**: Can a low-privilege user trigger an export, snapshot, or backup that includes data above their access level? Can they export other users' data? Does the export include deleted/draft/private content? Revision history that was supposed to be pruned?
|
|
63
|
+
- **Import/restore as injection**: Can import overwrite existing data? Can it create records that bypass normal validation? Can it inject content into collections the user doesn't have write access to? Does it respect the same permission model as the UI?
|
|
64
|
+
- **Search/filter/sort as oracle**: Can search queries reveal whether content exists that the user can't directly access? Do filter parameters let users probe statuses, roles, or fields they shouldn't know about? Does sorting by a hidden field reveal its values through result ordering?
|
|
65
|
+
- **Enumeration through side effects**: Do error messages differ between "doesn't exist" and "you don't have access"? Do response times differ? Response sizes? HTTP status codes? Can you enumerate users through password reset, invite, or registration flows?
|
|
66
|
+
- **Preview/draft/staging leakage**: Are preview tokens scoped to one item or do they unlock broader access? Can draft content be discovered through search, RSS feeds, sitemaps, or API listing endpoints? Can cache headers cause a CDN to serve private content publicly?
|
|
67
|
+
- **Notification/webhook as SSRF**: Can a user set a notification URL, webhook URL, or callback URL that the server fetches? Is it validated against internal networks? What about after a redirect?
|
|
68
|
+
|
|
69
|
+
**Chained attacks and trust boundaries** (subagent_type: `general`)
|
|
70
|
+
Individual safe behaviors that become dangerous in combination. Think about the full system:
|
|
71
|
+
- **Multi-step chains**: Map out what a low-privilege user CAN do, then look for combinations. Info disclosure (learning a resource ID) + IDOR (accessing it directly) + missing rate limit (brute-forcing the ID space). Open redirect + OAuth callback = token theft. Benign XSS in a low-value context + CSRF to escalate it.
|
|
72
|
+
- **Cross-component trust gaps**: Component A validates input and passes it to component B. Does B re-validate or trust A? What if A's validation is subtly different from what B needs (e.g., A allows 255 chars but B truncates at 128, creating a different string)? What about plugin/extension trust — can third-party code manipulate core state, bypass permission hooks, or access storage directly?
|
|
73
|
+
- **Second-order attacks**: Data safe when stored but dangerous when used in a different context. A field name safe in SQL becomes a key in a JSON path expression. A slug safe in a URL becomes part of a file path. Content stored HTML-escaped gets double-escaped or rendered in a context that expects raw text. Config values stored as strings get parsed as URLs, regexes, or templates.
|
|
74
|
+
- **Scope and capability escalation**: Tokens, API keys, or OAuth scopes that grant broader access than their name implies. A `read` scope that also allows listing draft content. Session cookies that survive a role downgrade. Plugin capabilities that provide a stepping stone to higher access. MCP or AI tool integrations that inherit the user's full session.
|
|
75
|
+
- **Timing and ordering**: Can you use a feature before setup/migration is complete? Act on a resource between soft-delete and hard-delete? Use a token between revocation and cache expiry? Exploit the gap between two non-atomic operations (check-then-act, read-then-write, validate-then-use)?
|
|
76
|
+
- **Rollback and recovery abuse**: What happens when an operation is undone? Undelete, restore from backup, revert a revision, cancel a pending action. Does the rollback restore more than intended? Does it bypass current permissions? Can you restore a resource into a state that's no longer valid?
|
|
77
|
+
|
|
78
|
+
**Wildcard** (subagent_type: `general`)
|
|
79
|
+
You are not given a category. You are given the codebase and told to break it.
|
|
80
|
+
|
|
81
|
+
Ignore the standard vulnerability classes — other agents are covering those. Your job is to find the thing nobody thought to look for. Read code that looks boring. Follow functions that seem unrelated to security. Get curious about the weird stuff.
|
|
82
|
+
|
|
83
|
+
Some starting points, but don't limit yourself to these:
|
|
84
|
+
- What's the strangest code in the codebase? Why does it exist? What happens if it's abused?
|
|
85
|
+
- Are there any features that feel half-finished, experimental, or bolted on? Those have the weakest security because they got the least review.
|
|
86
|
+
- What happens if you use the API in a way the frontend never would? The UI constrains users, but the API doesn't. What API calls are possible but never made by the client?
|
|
87
|
+
- Are there any hidden or undocumented endpoints, parameters, headers, or features? Look at route registrations, middleware, and config for things that aren't in the docs.
|
|
88
|
+
- What happens when you mix features that weren't designed to work together? Localization + preview + caching. Import + plugins + webhooks. OAuth + impersonation + API keys.
|
|
89
|
+
- Is there anything interesting in the git history? Reverted security fixes, commented-out auth checks, secrets that were committed then removed (still in history).
|
|
90
|
+
- What would you do if you had a valid account but wanted to cause maximum damage without being detected? Not escalation — sabotage. Corrupting data, poisoning caches, exhausting resources, creating confusing state.
|
|
91
|
+
- Are there any operations that are irreversible? What if you trick an admin into performing one?
|
|
92
|
+
- What assumptions does the code make about the environment? That the database is local, that the clock is accurate, that DNS is trustworthy, that the filesystem is case-sensitive?
|
|
93
|
+
- Look at the test files — what are they NOT testing? What edge cases did the developer think about (tests exist) vs. what they didn't (no tests)?
|
|
94
|
+
|
|
95
|
+
Follow rabbit holes. If something looks weird, dig. If a function has a comment explaining why it's safe, verify the explanation. If a variable is named `temp` or `hack` or `legacy`, read every line of it.
|
|
96
|
+
|
|
97
|
+
**Obvious things** (subagent_type: `general`)
|
|
98
|
+
The other agents are hunting for subtle bugs. This agent checks the dumb stuff that's easy to overlook because everyone assumes someone else already checked it:
|
|
99
|
+
- Are there any hardcoded passwords, API keys, tokens, or secrets in the source? (grep for `password`, `secret`, `apikey`, `token`, `Bearer`, `-----BEGIN`, common default passwords)
|
|
100
|
+
- Are there any TODO/FIXME/HACK/XXX comments that reference security? (`TODO: add auth`, `FIXME: validate input`, `HACK: skip permission check`)
|
|
101
|
+
- Is debug mode / dev mode properly gated? Can it be enabled in production via environment variable, query parameter, or header?
|
|
102
|
+
- Are there test/example/seed credentials that work in production?
|
|
103
|
+
- Is there a `/debug`, `/admin`, `/test`, `/status`, `/health`, `/metrics`, `/env`, `/.env`, `/config` endpoint that's unprotected?
|
|
104
|
+
- Are there any `.env`, `.env.local`, `credentials.json`, `*.pem`, `*.key` files checked into the repo?
|
|
105
|
+
- Does the `.gitignore` actually cover secrets, uploads, and local config?
|
|
106
|
+
- Are dependencies pinned? Are there known CVEs in the dependency tree? (check lockfiles)
|
|
107
|
+
- Are there any `eval()`, `exec()`, `child_process`, `Function()`, `vm.runInContext`, `import()` with dynamic input?
|
|
108
|
+
- Are CORS headers set to `*` or overly permissive? Is `Access-Control-Allow-Credentials` combined with a wildcard origin?
|
|
109
|
+
- Are cookies missing `HttpOnly`, `Secure`, or `SameSite` attributes?
|
|
110
|
+
- Are there any open redirects? (parameters named `redirect`, `return`, `next`, `url`, `goto`, `continue` that feed into redirects without validation)
|
|
111
|
+
- Is TLS enforced? Are there any HTTP-only endpoints?
|
|
112
|
+
- Are error responses in production returning stack traces, internal paths, or SQL errors?
|
|
113
|
+
|
|
114
|
+
This agent doesn't need to be creative. It needs to be thorough and literal. Check every item. Report what it finds.
|
|
115
|
+
|
|
116
|
+
IMPORTANT: For any finding this agent reports, it must verify the full code path, not just surface appearance. If a cookie is missing `HttpOnly`, check whether the cookie contains security-sensitive data and whether JS needs to read it by design. If an error message contains a field name, check whether the field is ever actually populated with sensitive data. A flag is not a finding — trace the impact before reporting.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Client-Side and Browser Hunting
|
|
2
|
+
|
|
3
|
+
#### When to use this file
|
|
4
|
+
|
|
5
|
+
Reach for this file when meaningful trust decisions or untrusted rendering happen in the browser: single-page apps, browser extensions, embedded webviews, and anything that renders attacker-influenceable content into the DOM, receives cross-window messages, opens WebSockets, or serves credentialed cross-origin responses. These bugs live in code the server never executes — the fragment after `#`, `window.name`, a `postMessage` payload — so server-side escaping and the classes in `ATTACK-CLASSES.md` don't cover them.
|
|
6
|
+
|
|
7
|
+
Use alongside `ATTACK-CLASSES.md`. The injection class there covers server-side sinks; this file covers the browser-side source→sink paths, cross-origin trust, and UI-redress classes that only exist client-side.
|
|
8
|
+
|
|
9
|
+
Pick the relevant classes based on Phase 1. Split per surface (DOM rendering, message/WebSocket handlers, auth-carrying endpoints) for large front-ends.
|
|
10
|
+
|
|
11
|
+
## Core discipline (include in every agent prompt for this domain)
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
- Client-side taint needs a controllable SOURCE and an executing SINK on the client path. A source with no sink, or a sink fed only server-rendered trusted data, is not a finding. Name both and show untrusted data reaching the sink unsanitized.
|
|
15
|
+
- The impact must cross to a victim or cross an origin. XSS in the attacker's own DOM, or a "leak" of the attacker's own data, is not a finding. State whose session executes it or whose cross-origin data it steals.
|
|
16
|
+
- Framework auto-escaping is a real mitigation. React/Vue/Angular escape interpolation by default — the finding is where the code opts OUT (`dangerouslySetInnerHTML`, `v-html`, `bypassSecurityTrust*`, `$sce.trustAs*`). Do not report escaped interpolation.
|
|
17
|
+
- A missing header or attribute (X-Frame-Options, frame-ancestors, rel=noopener, SameSite) is only a finding with a concrete sensitive action behind it. A bare missing flag with no state-changing action or credentialed cross-origin read is a hardening note.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## DOM-based injection attack classes (subagent_type: `general`)
|
|
21
|
+
|
|
22
|
+
**DOM-based XSS**
|
|
23
|
+
Trace client-side sources — `location.hash`/`search`/`href`/`pathname`, `document.referrer`, `window.name`, `postMessage` data, `document.cookie` — into execution sinks: `innerHTML`/`outerHTML`, `document.write`, `eval`, `Function`, `setTimeout`/`setInterval` with a string argument, `element.src`/`href` set to a `javascript:` URI, jQuery `$(...)`/`.html()`, or framework escape hatches (`dangerouslySetInnerHTML`, `v-html`, `bypassSecurityTrustHtml`). The bug is source→sink with no sanitization *on the client path*; server-side escaping never sees fragment or `window.name` data.
|
|
24
|
+
|
|
25
|
+
**DOM clobbering**
|
|
26
|
+
Attacker-injected `id`/`name` attributes — surviving an HTML sanitizer that strips script but allows attributes — that shadow a global the script later reads (`window.config`, a `form.action`, a flag checked before initialization). Look for code reading `window.X`/`document.X` that an injected element named `X` can override. Requires a markup-injection sink that permits `id`/`name`.
|
|
27
|
+
|
|
28
|
+
## Client-side trust and messaging attack classes (subagent_type: `general`)
|
|
29
|
+
|
|
30
|
+
**postMessage origin trust**
|
|
31
|
+
A `message` handler that acts on `event.data` (writes the DOM, calls a privileged function, stores a token) without checking `event.origin` against an allowlist, or with a weak check (`indexOf`, `startsWith`, unanchored regex, `endsWith` on the host). Also the send side: `postMessage(data, '*')` leaking data to any embedder. Confirm the handler does something security-relevant with the data.
|
|
32
|
+
|
|
33
|
+
**Cross-site WebSocket hijacking (CSWSH)**
|
|
34
|
+
A WebSocket handshake authenticated only by ambient cookies, with no `Origin` check and no per-session CSRF token — an attacker page opens a socket in the victim's authenticated context and reads/writes their data. Find the upgrade handler; check whether it validates `Origin` and binds to a token, not just the cookie.
|
|
35
|
+
|
|
36
|
+
**CORS with credentials**
|
|
37
|
+
A server that reflects the request `Origin` into `Access-Control-Allow-Origin` while sending `Access-Control-Allow-Credentials: true`, or allowlists `null` or a weak suffix match — any origin then reads authenticated responses. The finding is reflection or weak-match *with credentials*, not a wildcard alone (`*` with credentials is rejected by browsers).
|
|
38
|
+
|
|
39
|
+
## UI-redress and navigation attack classes (subagent_type: `general`)
|
|
40
|
+
|
|
41
|
+
**Clickjacking**
|
|
42
|
+
A state-changing action (transfer, delete, grant, confirm) reachable in a framed page with no `X-Frame-Options: DENY`/`SAMEORIGIN` and no `frame-ancestors` CSP and no UI framebusting. A missing frame guard on a read-only page with no sensitive action is not a finding — require the action.
|
|
43
|
+
|
|
44
|
+
**Reverse tabnabbing**
|
|
45
|
+
A link whose target is attacker-influenceable, opened with `target="_blank"`, letting the opened page rewrite `window.opener.location` to a phishing origin. Modern browsers imply `noopener` for `target="_blank"`, so this is a finding only where the code sets `rel="opener"` explicitly, uses `window.open` without `noopener`, or the threat model includes older browsers — check before reporting.
|
|
46
|
+
|
|
47
|
+
**Client-side open redirect / navigation**
|
|
48
|
+
A navigation built from a client source (`location = params.get('next')`, `location.hash` fed into `location.href`, a router redirect) with no allowlist — including `javascript:`/`data:` schemes that promote the redirect into XSS. Distinct from a server open-redirect: the sink is in JS, so the server never sees it.
|
|
49
|
+
|
|
50
|
+
## Prototype pollution attack classes (subagent_type: `general`)
|
|
51
|
+
|
|
52
|
+
**Prototype pollution and gadget chain**
|
|
53
|
+
An attacker-controlled key (`__proto__`, `constructor.prototype`) reaching a *nested/recursive* write — a deep merge, `lodash.set`-style path assignment, `obj[a][b]=v` with an attacker-controlled segment, or a query-string parser that builds nested objects — that lands on `Object.prototype`. A plain `JSON.parse` or shallow `Object.assign` does NOT pollute. Require the recursive sink AND a gadget that reads the polluted property (an options object checked with `opts.isAdmin`, a template reading a config default, a sink that concatenates a polluted `src`). Pollution with no reachable gadget is not exploitable; the gadget is what turns it into XSS, auth bypass, or (in Node) RCE.
|
|
54
|
+
|
|
55
|
+
## Universal moves (apply across the above)
|
|
56
|
+
|
|
57
|
+
- **Start from the sink and walk back to a client source.** Grep the execution sinks (`innerHTML`, `eval`, `document.write`, `dangerouslySetInnerHTML`, `postMessage`, `new WebSocket`) and trace each argument back to `location`/`name`/`referrer`/message data. A sink fed only server-rendered trusted data is not a finding.
|
|
58
|
+
- **Server escaping ends where the fragment begins.** Data after `#`, plus `window.name` and cross-window messages, never reaches the server — so server-side filters can't see it. That blind spot is the DOM-XSS goldmine.
|
|
59
|
+
- **Enumerate the escape hatches.** In an auto-escaping framework, the candidate list *is* every `dangerouslySetInnerHTML`/`v-html`/`bypassSecurityTrust*`/`$sce.trustAs*` call. Start there.
|
|
60
|
+
|
|
61
|
+
## Validation rules (apply before reporting ANY finding here)
|
|
62
|
+
|
|
63
|
+
1. **Confirm a controllable source AND an executing sink on the client path.** Cite the source (`location.hash`, `event.data`, `window.name`) and the sink (`innerHTML`, `eval`, navigation), and show untrusted data reaching the sink without sanitization. A source with no sink, or a sink fed only trusted data, is not a finding.
|
|
64
|
+
2. **For prototype pollution, prove the recursive write AND a gadget.** Show the nested/recursive assignment that reaches `Object.prototype`, then the code that later reads the polluted property to a security-relevant effect. Pollution with no reachable gadget is not exploitable.
|
|
65
|
+
3. **For messaging / CORS / WebSocket, show the origin check is absent or weak.** Cite the handler and the missing or `indexOf`/`startsWith`/unanchored-regex origin check, and that the data drives a security-relevant action or a credentialed cross-origin read. Reflection plus credentials, not a bare wildcard.
|
|
66
|
+
4. **For UI-redress, require the sensitive action behind the missing guard.** Name the state-changing action that gets framed (clickjacking) or the attacker-controlled `_blank` link (tabnabbing). A missing `X-Frame-Options`/`rel=noopener` with nothing sensitive behind it is a hardening note — and framebusting, `frame-ancestors`, or the browser's `noopener` default may already defeat it. Check before reporting.
|
|
67
|
+
5. **Return ONLY confirmed findings** with the client source→sink path and whose session it fires in — or "No exploitable client-side issues found" if that's honest.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Vulnerability Hunting
|
|
2
|
+
|
|
3
|
+
### Phase 2: Hunt for vulnerabilities
|
|
4
|
+
|
|
5
|
+
Launch **multiple `general` agents in parallel** via the Task tool. Use `general`, not `research` — general agents can spawn their own sub-agents via the Task tool, so when a hunter finds a rabbit hole that needs deeper investigation (e.g., tracing injection into an auth subsystem it doesn't fully understand), it can spin up a focused `research` sub-agent rather than trying to do everything in one context window.
|
|
6
|
+
|
|
7
|
+
Each agent gets the architecture summary from Phase 1 injected into its prompt plus the hunting methodology and validation rules. Launch them in a single message so they run concurrently.
|
|
8
|
+
|
|
9
|
+
**How many agents?** Use Phase 1 to decide. More focused agents produce better results than broad ones that run out of context. For a small library, 3-4 agents may suffice. For a large application with distinct subsystems, launch 8-12+ — split by attack class AND by subsystem. If Phase 1 revealed an auth system, a plugin system, a media pipeline, and a comment engine, each of those could warrant its own injection agent, its own logic agent, etc.
|
|
10
|
+
|
|
11
|
+
Every agent prompt MUST include:
|
|
12
|
+
1. The architecture summary from Phase 1 (copy it in verbatim)
|
|
13
|
+
2. The specific attack class and scope to investigate
|
|
14
|
+
3. Relevant file paths from Phase 1 as starting points
|
|
15
|
+
4. The hunting methodology (below)
|
|
16
|
+
5. The validation rules (below)
|
|
17
|
+
|
|
18
|
+
#### Hunting methodology — include in every Phase 2 agent prompt
|
|
19
|
+
|
|
20
|
+
Tell each agent to think like an attacker, not a code reviewer:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
## How to hunt
|
|
24
|
+
|
|
25
|
+
Don't just check if defenses exist. Try to break them.
|
|
26
|
+
|
|
27
|
+
READ THE CODE AT DEPTH. Don't stop at the first function. Follow the data through
|
|
28
|
+
every layer — from the entry point through validation, transformation, storage, retrieval,
|
|
29
|
+
and output. Bugs live in the gaps between layers.
|
|
30
|
+
|
|
31
|
+
Think about these angles:
|
|
32
|
+
|
|
33
|
+
1. THE HAPPY PATH IS DEFENDED. ATTACK THE SAD PATH.
|
|
34
|
+
Error handlers, fallback branches, catch blocks, default cases, timeout paths,
|
|
35
|
+
retry logic, cleanup routines. What happens when things fail? Are errors handled
|
|
36
|
+
with the same rigor as success? Does a failed validation leave state half-modified?
|
|
37
|
+
|
|
38
|
+
2. WHAT HAPPENS AT BOUNDARIES?
|
|
39
|
+
Empty input. Maximum-length input. Null vs undefined vs missing. Zero. Negative numbers.
|
|
40
|
+
Unicode edge cases. The first item and the last item. One more than the maximum. Exactly
|
|
41
|
+
at the rate limit. The moment a token expires.
|
|
42
|
+
|
|
43
|
+
3. WHAT DO COMPONENTS ASSUME ABOUT EACH OTHER?
|
|
44
|
+
Does the database layer assume the API layer validated input? Does the renderer assume
|
|
45
|
+
content was sanitized on write? Does the auth middleware assume routes register themselves
|
|
46
|
+
correctly? Find where trust is implicit and test whether it's justified.
|
|
47
|
+
|
|
48
|
+
4. WHAT IF OPERATIONS HAPPEN IN THE WRONG ORDER?
|
|
49
|
+
Call step 3 before step 1. Call delete during create. Send the callback before the request.
|
|
50
|
+
Hit the confirmation endpoint without starting the flow. Replay a completed flow.
|
|
51
|
+
|
|
52
|
+
5. WHAT IF TWO THINGS HAPPEN AT ONCE?
|
|
53
|
+
Two requests to the same resource. Modify while reading. Delete while iterating.
|
|
54
|
+
Publish while someone else is editing. Two users claiming the same unique resource.
|
|
55
|
+
|
|
56
|
+
6. WHERE DO TWO PARSERS OR VALIDATORS DISAGREE?
|
|
57
|
+
Input accepted by the schema but rejected by the database. URL parsed differently by
|
|
58
|
+
the router vs the application code. Content-type header says one thing, body is another.
|
|
59
|
+
Filename extension vs MIME type vs magic bytes.
|
|
60
|
+
|
|
61
|
+
7. WHAT SURVIVES A ROUND TRIP?
|
|
62
|
+
Data stored then retrieved — is it the same? Does encoding change? Does escaping
|
|
63
|
+
double-up? Is a relative path resolved differently on read vs write? Does serialization
|
|
64
|
+
lose type information?
|
|
65
|
+
|
|
66
|
+
8. WHAT DOES THE CONFIGURATION CONTROL?
|
|
67
|
+
What happens when config is missing or default? Can an environment variable override a
|
|
68
|
+
security control? Does a feature flag disable validation? What's the security posture
|
|
69
|
+
during setup/first-run before config is complete?
|
|
70
|
+
|
|
71
|
+
9. FOLLOW THE MONEY (OR THE PRIVILEGE).
|
|
72
|
+
For every operation that changes state, ask: who authorized this? Trace back to the
|
|
73
|
+
permission check. Is it checking the right permission? Is it checking against the right
|
|
74
|
+
resource? Is there a parallel path to the same state change that checks differently
|
|
75
|
+
or not at all?
|
|
76
|
+
|
|
77
|
+
10. LOOK FOR LEAKED CONTEXT.
|
|
78
|
+
Error messages that reveal internal paths. Stack traces in production. Timing differences
|
|
79
|
+
that reveal whether a record exists. Response size differences. HTTP headers that
|
|
80
|
+
disclose versions. Debug endpoints that survived into production.
|
|
81
|
+
|
|
82
|
+
11. WHAT PARAMETERS OVERRIDE SECURITY-RELEVANT DEFAULTS?
|
|
83
|
+
Where a default is safe but a user-supplied parameter can change it. Look for
|
|
84
|
+
every input that overrides a security-relevant default and check if the override
|
|
85
|
+
is gated by appropriate permissions.
|
|
86
|
+
|
|
87
|
+
12. WHERE DO UNVERIFIED CLAIMS DRIVE TRUST DECISIONS?
|
|
88
|
+
Anywhere self-declared identity, capability, or metadata influences an access
|
|
89
|
+
or trust decision without independent verification.
|
|
90
|
+
|
|
91
|
+
GO DEEP, AND PROVE IT. You can spawn sub-agents: if evaluating a candidate finding needs
|
|
92
|
+
deep understanding of a subsystem, use the Task tool to launch a research agent instead of
|
|
93
|
+
holding everything in one context. And where the code is locally runnable, don't just reason
|
|
94
|
+
about it — extract the suspect function into a minimal harness (or build and run the target)
|
|
95
|
+
and test the hypothesis directly. A reproduced result beats an argued one.
|
|
96
|
+
|
|
97
|
+
YOUR SCOPE IS YOUR PRIMARY FOCUS, NOT A BOUNDARY.
|
|
98
|
+
If while investigating your assigned area you notice something wrong in a different
|
|
99
|
+
category — a permission issue while tracing injection, a race condition while reviewing
|
|
100
|
+
auth — report it. Don't ignore a bug because it's "not your area." Attackers don't
|
|
101
|
+
respect category boundaries.
|
|
102
|
+
|
|
103
|
+
## Validation rules — apply before reporting ANY finding
|
|
104
|
+
1. You MUST construct a concrete attack (exact inputs, requests, or action sequence)
|
|
105
|
+
2. The attack MUST achieve meaningful impact (not just "learn field names" or "cause an error")
|
|
106
|
+
3. Check if another layer already prevents exploitation — if so, it's a hardening note, not a finding
|
|
107
|
+
4. If the baseline comparable has the same pattern, note whether it's been exploited there
|
|
108
|
+
5. If your exploit depends on parser/runtime behavior, verify against the relevant spec or implementation — do not reason from intuition.
|
|
109
|
+
6. Return ONLY confirmed findings with concrete attacks, or "No exploitable vulnerabilities found" if that's honest.
|
|
110
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Memory Safety, Binary, and Kernel Hunting
|
|
2
|
+
|
|
3
|
+
#### When to use this file
|
|
4
|
+
|
|
5
|
+
The attack classes in `ATTACK-CLASSES.md` are tuned for web apps, APIs, and services. Reach for *this* file when the target processes untrusted bytes in a memory-unsafe context: C/C++/Objective-C, Rust `unsafe`, kernel modules and drivers, parsers and decoders (image/video/font/archive/PDB), reverse-engineering and dev tooling, network daemons, firmware, and language runtimes/JITs. These targets fail differently from web apps — the bug is a memory corruption or a logic error in privileged code, not an injection or an access-control gap — so the hunt needs a different lens.
|
|
6
|
+
|
|
7
|
+
Pick the relevant classes based on Phase 1. Split per subsystem for large targets.
|
|
8
|
+
|
|
9
|
+
## Core discipline (include in every agent prompt for this domain)
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
- A buffer sized for the common case can still overflow on adversarial input. Verify every "this length is bounded" claim against the WORST case, not the happy path.
|
|
13
|
+
- "Huge count = guaranteed crash" is FALSE. An oversized copy length is size- and libc-dependent: it often faults, but the copy primitive can also wrap or land a short, scattered write first. Determine the actual write behavior before downgrading to DoS-only.
|
|
14
|
+
- Static offsets are a guess; the crash dump is truth. An unreproduced bug is not a bug — if you claim exploitability, say exactly which input reaches which sink and what the observable result is.
|
|
15
|
+
- Sanitizer silence ≠ safety where the deref is outside instrumented code (hand-written asm, JIT-emitted, intra-allocation). Don't trust a clean ASan run for those.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Memory-safety attack classes (subagent_type: `general`)
|
|
19
|
+
|
|
20
|
+
**Spatial: out-of-bounds read/write**
|
|
21
|
+
- **Length subtraction underflow** — a copy/loop bound is `a - b` (`uri.len - prefix`, `total - consumed`) where the attacker can make `b > a`. Negative → casts to ~SIZE_MAX. Map which bytes land where; don't assume "just a crash."
|
|
22
|
+
- **Operator-precedence / multi-term length errors** — an unparenthesized `+`/`-` length chain (`endp - begin + consume`) that silently over-adds when one term is attacker-sized. Audit each CALLER's value of the variable term — the common caller is often correct-by-accident on the zero path and survives testing.
|
|
23
|
+
- **`sizeof(*p)` vs `sizeof(element)` pointer-depth confusion** — an allocation/copy size computed one indirection too deep (`gid_t **` → `sizeof(*p)`=8 not 4). The bounds check passes because it uses the same wrong unit. Compiled tell: `shl $0x3` where `shl $0x2` was meant.
|
|
24
|
+
- **Wire-length into fixed stack buffer** — a function rebuilds a network/user blob into a fixed array using an attacker length field, with the bounds check missing/late or computed on the wrong headroom (a header pre-written into the buffer). Re-derive true headroom (size minus fixed prefix); confirm no guard precedes the copy.
|
|
25
|
+
|
|
26
|
+
**Temporal: use-after-free / lifetime**
|
|
27
|
+
- **Embedded waiter-anchor freed without draining** — a struct embeds a list head (`selinfo`/`knlist`/timer/knote) reachable by unprivileged poll/select/kqueue, and a free path destroys it but skips the drain a wakeup path does. For every `selrecord(&obj->x)`, require a matching drain on EACH path that can free `obj`.
|
|
28
|
+
- **Cached raw pointer + reallocating owner** — a view caches `base+offset`, a grow/realloc path moves the backing store, and the invalidation walks only the *current* wrapper's view set while grow *replaces* the wrapper. The original view dangles.
|
|
29
|
+
|
|
30
|
+
**Type confusion**
|
|
31
|
+
- **Read-and-write confusion → addrof/fakeobj** — a confusion that reads a pointer slot as a scalar (addrof) and writes a scalar into a pointer slot (fakeobj). The standard pivot of runtime/JIT exploitation; the prior art is about the PROBLEM CLASS (NaN-boxing, cached typed-array data pointer), not the specific target.
|
|
32
|
+
- **Hierarchical-walker leaf check skipped** — a page-table / nested / B-tree / extent walker checks the valid bit but not the leaf/size bit at level N, then descends treating an attacker-owned leaf as an interior node.
|
|
33
|
+
|
|
34
|
+
**Value: uninitialized & oracle**
|
|
35
|
+
- **Uninitialized worst-case buffer + observable compare = read oracle** — a buffer sized to a MAX constant is partially written, then compared against attacker bytes with an attacker-controlled compare length where match/no-match is observable. No memory-disclosure bug needed; the gap between actual output and MAX-size is the leak window. Brute one byte/connection, hint the structural bits, parallelize.
|
|
36
|
+
|
|
37
|
+
## Kernel & privileged-interface attack classes (subagent_type: `general`)
|
|
38
|
+
|
|
39
|
+
- **User-copy bounds + double-fetch (TOCTOU)** — a syscall/ioctl/Mach-trap entry whose user-copy primitive (`copyin` / `copy_from_user`) brings attacker memory in, then re-reads the SAME user address after a check. Any fact derived from concurrently-mutable user memory and trusted on a later pass is a double-fetch even when each op is individually correct.
|
|
40
|
+
- **Object lifecycle / UAF (IOKit/OSObject and friends)** — unbalanced retain/release on an externally-reachable object; a method that releases on one path but a sibling dispatch (compat/fallback/ptrace) forgot it. Diff the duplicated dispatch paths.
|
|
41
|
+
- **Unchecked downcast / type confusion** — `OSDynamicCast` (or any tagged-union cast) whose result is used without a null check, or a selector/index into a dispatch table without a bounds check.
|
|
42
|
+
- **World-writable / under-permissioned powerful interface** — a device node, admin socket, or mgmt API exposed more broadly than its power, that validates the request SHAPE (index in range) but never the requester's AUTHORITY over the named resource. Danger = power × reachability; enumerate the surface reachable from the *actual* untrusted context first.
|
|
43
|
+
- **Validate-then-act-on-stale-state** — a fast path and a compat/ptrace/fallback path to the same operation where one copy forgot a guard the other performs.
|
|
44
|
+
|
|
45
|
+
## Universal moves (apply across the above)
|
|
46
|
+
|
|
47
|
+
- **Audit the incomplete fix.** A targeted patch is a high-signal pointer to a dangerous sink with the analysis already done. Read the diff → find the exact sink it hardened → scan the same function, parallel paths, and alternate callers for the SAME tainted-data-to-sink shape the patch missed. Incomplete fixes are their own bug class.
|
|
48
|
+
- **Trust asymmetry between two ends of a protocol.** A filter/verification/size-cap installed on one side of a connection but missing on the symmetric call on the other. Find the protective call → grep its mirror on the opposite role → if absent, the earliest unprotected pre-auth parse is the prize. A malicious server/MITM is a real attacker.
|
|
49
|
+
- **Chain a weak primitive.** A blocked path means you haven't found the right pivot, not that it's unexploitable. Always ask "what does this actually let me do, and what runs automatically once I can put bytes on disk?" (plugin dirs, autoload, `.git/hooks`, `conftest.py`).
|
|
50
|
+
- **Hunt where the crowd isn't.** The tools researchers themselves trust — debuggers, disassemblers, scanners, dev tooling — are under-audited and high-impact. Old code and obscure formats are gold.
|
|
51
|
+
|
|
52
|
+
## Validation rules (apply before reporting ANY finding here)
|
|
53
|
+
|
|
54
|
+
1. **Build a debuggable target first.** Wire in crash dumps + a debugger before you claim exploitability. You can't iterate on what you can't observe.
|
|
55
|
+
2. **Read the offset from the crash, not the disassembly.** Send a cyclic (De Bruijn) pattern; the faulting register values give the exact offset. A variable-length prefix (handle, optional field, padding) shifts the geometry off the static prediction.
|
|
56
|
+
3. **Prove a UAF by reclaim-and-compare** when the sanitizer is blind (asm/JIT/intra-allocation): trigger the dangling view, reclaim the freed region with a size-matched content-controlled allocation, write through the dangler, read the reclaimer back — aliasing either way proves it.
|
|
57
|
+
4. **Distinguish crash from exploitable.** For an OOB write, map which bytes land where and whether a security-relevant field is reachable; for a "huge count," prove the bounded-write case before calling it DoS-only.
|
|
58
|
+
5. **Return ONLY confirmed findings** with the exact input → sink path and the observable result, or "No exploitable memory-safety issues found" if that's honest.
|