Skip to content

tanviet12/vbsec / skills/vbs-scan-security

vbs-scan-security

Flagged

Use when scanning code for security vulnerabilities. Use when user says "scan security", "kiểm tra bảo mật", "security audit", "review security", or invokes `/vbs-scan-security`. Auto-delegates to sub-agents for large scans (>20 main-language files OR >30 total OR >14 days). Outputs bilingual reports (vi/en). Optional `--auto-fix` (agentic patch + verify loop) and `--sca` (live CVE lookup via OSV.dev).

FileKindSize
SKILL.mdskill md36.2 KB
VERSIONother6 B
references/chunking-strategy.mdmarkdown7.2 KB
references/data-flow-classification.mdmarkdown9.5 KB
references/dependency-scan.mdmarkdown9.7 KB
references/i18n/en.mdmarkdown8.7 KB
references/i18n/vi.mdmarkdown9.4 KB
references/language-detection.mdmarkdown7.5 KB
references/load-rules.shexecutablescript5.2 KB
references/output-format.mdmarkdown26.1 KB
references/project-context.mdmarkdown2.7 KB
references/sub-agent-prompts.mdmarkdown16.5 KB
references/validate-report.pyexecutablescript8.7 KB
rules/generic/01-hardcoded-secret.mdmarkdown5.4 KB
rules/generic/02-sql-injection.mdmarkdown5.2 KB
rules/generic/03-xss.mdmarkdown4.9 KB
rules/generic/04-idor.mdmarkdown5.7 KB
rules/generic/05-slopsquatting.mdmarkdown6.1 KB
rules/generic/06-brute-force.mdmarkdown6.9 KB
rules/generic/07-mass-assignment.mdmarkdown6.3 KB
rules/generic/08-insecure-deserialization.mdmarkdown6.3 KB
rules/generic/09-ssrf.mdmarkdown6.7 KB
rules/generic/10-path-traversal.mdmarkdown6.3 KB
rules/generic/11-csrf.mdmarkdown7.8 KB
rules/generic/12-broken-access-control.mdmarkdown7.9 KB
rules/generic/13-weak-password-hashing.mdmarkdown5.2 KB
rules/generic/14-jwt-none-algorithm.mdmarkdown5.3 KB
rules/generic/15-cors-misconfig.mdmarkdown5.3 KB
rules/generic/16-unrestricted-file-upload.mdmarkdown5.9 KB
rules/generic/17-verbose-error-debug-mode.mdmarkdown5.8 KB
rules/generic/18-missing-rate-limit.mdmarkdown10.7 KB
rules/generic/19-race-condition.mdmarkdown11.5 KB
rules/generic/20-outdated-dependency.mdmarkdown7.2 KB
rules/generic/21-command-injection.mdmarkdown6.6 KB
rules/generic/22-vulnerable-dependency.mdmarkdown5.3 KB
rules/generic/23-llm-prompt-injection.mdmarkdown9.7 KB
rules/generic/24-excessive-agency.mdmarkdown10.1 KB
rules/generic/25-tenant-isolation.mdmarkdown10.1 KB
rules/generic/26-authz-path-parity.mdmarkdown10.9 KB
rules/generic/27-excessive-data-exposure.mdmarkdown10.4 KB
rules/generic/28-business-state-integrity.mdmarkdown9.5 KB
rules/generic/29-sensitive-data-in-logs.mdmarkdown9.1 KB
rules/generic/30-auth-session-lifecycle.mdmarkdown9.4 KB
rules/generic/31-resource-exhaustion.mdmarkdown9.0 KB
rules/languages/README.mdmarkdown8.5 KB
rules/languages/dart/01-hardcoded-secret.mdmarkdown7.9 KB
rules/languages/dart/03-xss.mdmarkdown5.2 KB
rules/languages/dart/05-slopsquatting.mdmarkdown4.6 KB
rules/languages/dart/10-path-traversal.mdmarkdown6.3 KB
rules/languages/dart/12-broken-access-control.mdmarkdown8.3 KB
rules/languages/dart/17-verbose-error-debug-mode.mdmarkdown6.7 KB
rules/languages/dart/20-outdated-dependency.mdmarkdown4.7 KB
rules/languages/dart/README.mdmarkdown3.7 KB
rules/languages/dotnet/02-sql-injection.mdmarkdown5.7 KB
rules/languages/dotnet/07-mass-assignment.mdmarkdown6.0 KB
rules/languages/dotnet/08-insecure-deserialization.mdmarkdown5.7 KB
rules/languages/dotnet/17-verbose-error-debug-mode.mdmarkdown5.0 KB
rules/languages/dotnet/21-command-injection.mdmarkdown5.3 KB
rules/languages/dotnet/README.mdmarkdown1.7 KB
rules/languages/go/02-sql-injection.mdmarkdown5.2 KB
rules/languages/go/08-insecure-deserialization.mdmarkdown5.0 KB
rules/languages/go/09-ssrf.mdmarkdown5.8 KB
rules/languages/go/17-verbose-error-debug-mode.mdmarkdown6.1 KB
rules/languages/go/21-command-injection.mdmarkdown5.2 KB
rules/languages/go/README.mdmarkdown2.7 KB
rules/languages/php/02-sql-injection.mdmarkdown5.8 KB
rules/languages/php/08-insecure-deserialization.mdmarkdown6.2 KB
rules/languages/php/11-csrf.mdmarkdown6.2 KB
rules/languages/php/17-verbose-error-debug-mode.mdmarkdown6.5 KB
rules/languages/php/21-command-injection.mdmarkdown6.7 KB
rules/languages/php/README.mdmarkdown2.9 KB
rules/languages/python/02-sql-injection.mdmarkdown7.2 KB
rules/languages/python/07-mass-assignment.mdmarkdown7.3 KB
rules/languages/python/08-insecure-deserialization.mdmarkdown7.3 KB
rules/languages/python/09-ssrf.mdmarkdown7.5 KB
rules/languages/python/11-csrf.mdmarkdown7.6 KB
rules/languages/python/14-jwt-none-algorithm.mdmarkdown7.5 KB
rules/languages/python/15-cors-misconfig.mdmarkdown8.0 KB
rules/languages/python/17-verbose-error-debug-mode.mdmarkdown8.4 KB
rules/languages/python/21-command-injection.mdmarkdown8.5 KB
rules/languages/python/README.mdmarkdown3.4 KB
rules/languages/typescript/02-sql-injection.mdmarkdown7.5 KB
rules/languages/typescript/03-xss.mdmarkdown6.7 KB
rules/languages/typescript/07-mass-assignment.mdmarkdown7.4 KB
rules/languages/typescript/08-insecure-deserialization.mdmarkdown7.0 KB
rules/languages/typescript/09-ssrf.mdmarkdown7.5 KB
rules/languages/typescript/11-csrf.mdmarkdown7.3 KB
rules/languages/typescript/14-jwt-none-algorithm.mdmarkdown7.0 KB
rules/languages/typescript/15-cors-misconfig.mdmarkdown7.2 KB
rules/languages/typescript/17-verbose-error-debug-mode.mdmarkdown7.2 KB
rules/languages/typescript/21-command-injection.mdmarkdown6.7 KB
rules/languages/typescript/README.mdmarkdown3.3 KB
workflows/auto-fix.mdmarkdown18.9 KB
workflows/large-review.mdmarkdown10.5 KB
workflows/small-review.mdmarkdown10.1 KB

rules/languages/README.md

View on GitHub
# Language Specialization Rules

This folder contains **language-specific overrides** for the 21 generic rules in `rules/generic/`. When vbsec detects the primary language of a target repo, the corresponding language folder is consulted; any rule with a matching `id` in frontmatter REPLACES the generic version for that scan.

## Override mechanism

```
rules/
├── generic/
│   ├── 01-hardcoded-secret.md         (applies_to: all)
│   ├── 02-sql-injection.md            (applies_to: all)
│   ├── ...
│   └── 21-command-injection.md        (applies_to: all)
└── languages/
    ├── go/
    │   ├── 02-sql-injection.md        (applies_to: go)   ← overrides generic 02
    │   ├── 08-insecure-deserialization.md
    │   ├── 09-ssrf.md
    │   ├── 17-verbose-error-debug-mode.md
    │   └── 21-command-injection.md
    ├── php/
    │   ├── 02-sql-injection.md        (applies_to: php)
    │   ├── 08-insecure-deserialization.md
    │   ├── 11-csrf.md
    │   ├── 17-verbose-error-debug-mode.md
    │   └── 21-command-injection.md
    ├── typescript/
    │   ├── 02-sql-injection.md        (applies_to: typescript — gộp cả .js .ts)
    │   ├── 03-xss.md
    │   ├── 07-mass-assignment.md
    │   ├── 08-insecure-deserialization.md
    │   ├── 09-ssrf.md
    │   ├── 11-csrf.md
    │   ├── 14-jwt-none-algorithm.md
    │   ├── 15-cors-misconfig.md
    │   ├── 17-verbose-error-debug-mode.md
    │   └── 21-command-injection.md
    ├── python/
    │   ├── 02-sql-injection.md        (applies_to: python — .py .pyw)
    │   ├── 07-mass-assignment.md
    │   ├── 08-insecure-deserialization.md
    │   ├── 09-ssrf.md
    │   ├── 11-csrf.md
    │   ├── 14-jwt-none-algorithm.md
    │   ├── 15-cors-misconfig.md
    │   ├── 17-verbose-error-debug-mode.md
    │   └── 21-command-injection.md
    ├── dotnet/
    │   ├── 02-sql-injection.md        (applies_to: dotnet — .cs .csproj .sln)
    │   ├── 07-mass-assignment.md
    │   ├── 08-insecure-deserialization.md
    │   ├── 17-verbose-error-debug-mode.md
    │   └── 21-command-injection.md
    └── dart/                          (applies_to: dart — .dart, app Flutter)
        ├── 01-hardcoded-secret.md
        ├── 03-xss.md
        ├── 05-slopsquatting.md
        ├── 10-path-traversal.md
        ├── 12-broken-access-control.md
        ├── 17-verbose-error-debug-mode.md
        └── 20-outdated-dependency.md
```

**Matching is by frontmatter `id`, not filename.** Filename numeric prefix is convention only, to aid navigation. If `rules/languages/go/02-sql-injection.md` has `id: SQL-INJECTION`, it overrides `rules/generic/02-sql-injection.md` (also `id: SQL-INJECTION`) when scanning a Go repo.

Rules without a language-specific override fall back to the generic version. So a Go scan still uses generic `01-hardcoded-secret.md`, `03-xss.md`, `12-broken-access-control.md`, etc. — only the 5 overrides above are replaced.

## Language detection

See `references/language-detection.md` for the detection heuristic. In short:

- Count files by extension (`.go`, `.php`, `.py`, `.js`, `.ts`, ...) under the target path
- Primary language = highest count (with minimum threshold, e.g. ≥ 5 files)
- For mixed repos (vd: Laravel + Vue), detection picks the **backend** language (server-side risk dominates)
- Multi-language detection is possible: agent can run both `php` and `js` rule sets and merge

## Supported languages

| Language | Folder | Override count | Status |
|---|---|---|---|
| Go | `go/` | 5 | Stable (v0.1) |
| PHP | `php/` | 5 | Stable (v0.1) |
| TypeScript/JavaScript | `typescript/` | 10 | Stable (v0.2) — includes both `.ts` and `.js` files |
| Python | `python/` | 9 | Stable (v0.4) — `.py` and `.pyw` |
| .NET / C# | `dotnet/` | 5 | Stable (v0.6) — ASP.NET Core / EF Core |
| Dart / Flutter | `dart/` | 7 | Beta (v0.8) — app di động Flutter: lưu token, xoá phiên, deep link, payload push, WebView, cấu hình Android / iOS, `pubspec.lock` |

**v0.7**: `--auto-fix` (agentic patch loop) + `--sca` (live CVE via OSV.dev, rule 22 `VULNERABLE-DEPENDENCY`) — not a language overlay, cross-cutting feature.

**Phase v0.9+** (planned): Ruby, Rust, Java/Kotlin.

## Why specialize?

Generic rules describe **intent and reasoning** — they work cross-language. But search patterns, library names, idioms differ greatly:

- "SQL injection" in Python = `cursor.execute(f"...")`; in Go = `db.Raw(fmt.Sprintf(...))`; in PHP = `mysqli_query("$_GET[id]")`
- "Verbose error" in Go = `gin.DebugMode`; in PHP = `APP_DEBUG=true` + Ignition page (CRITICAL because leaks APP_KEY)
- "Command injection" in Go is rarer (args usually passed separately); in PHP it's common (shell_exec ubiquitous); in .NET it usually appears through `Process.Start` and `cmd.exe /c` / PowerShell wrappers.

Severity also shifts: PHP `VERBOSE-ERROR-DEBUG-MODE` is CRITICAL (Ignition leaks secrets + has past RCE CVE), while Go is HIGH (gin debug leaks routes/stack but no secret leak).

## L1–L4 reasoning still applies

Language overrides give **better patterns + examples**, NOT a shortcut around the L1–L4 data-flow analysis (see `references/data-flow-classification.md`). LLM agent must still:

1. **Grep** for sink patterns (language-specific now)
2. **Read** the full function containing the sink
3. **Trace** input back through call chain to its source (L1 request, L2 DB, L3 config, L4 constant)
4. **Verify** sanitization context (parameterized query, whitelist, escape, allowlist)

Pattern match alone produces false positives (vd: `fmt.Sprintf` in Go is fine if not in a SQL sink) and false negatives (vd: input passed through a helper function still reaches the sink).

## Contributing — add an override

For an existing language (Go or PHP):

1. Pick a rule id from `rules/generic/` not yet specialized for that language
2. Create `rules/languages/<lang>/<NN>-<name>.md` (use same numeric prefix for nav)
3. Frontmatter: copy generic, change `applies_to: <lang>` (e.g. `go`, `php`)
4. Sections to override:
   - **Intent**: lead with language-specific reasons this risk hits harder/lesser
   - **Search patterns**: replace fully with `<lang>`-specific regex (no JS examples in Go file)
   - **Examples**: ALL code blocks in target language
   - **Fix recommendation**: idiomatic `<lang>` fix
5. Keep **Cách reasoning** L1–L4 structure
6. Test: run `/vbs-scan-security` against a `<lang>` repo with the vulnerability — confirm the rule fires with the right reasoning

## Contributing — add a NEW language

To support Python / Ruby / Rust / etc.:

1. Create `rules/languages/<newlang>/`
2. Add at minimum these overrides (highest leverage):
   - `SQL-INJECTION`
   - `COMMAND-INJECTION`
   - `INSECURE-DESERIALIZATION` (Python pickle is CRITICAL!)
   - `VERBOSE-ERROR-DEBUG-MODE` (Django/Flask/FastAPI debug = leak vars)
3. Create `rules/languages/<newlang>/README.md` listing what was specialized
4. Update `references/language-detection.md`:
   - Add extension mapping
   - Add Phase table entry
5. Update the folder tree in `SKILL.md` and the "Specialized for" column in `README.md`, `README.vi.md`, `docs/{en,vi}/rules.md`
6. Run a real scan + 5-10 sample repos to validate before announcing the language as "stable"

## Future: rule composition

Currently override is binary (full replace). Future direction: allow language file to ONLY override specific sections (vd: only `Search patterns`) while inheriting `Intent` from generic. Not implemented yet — keep override files self-contained.

## Quality bar

- Each rule file: 80–200 lines (focused, not bloated)
- Vietnamese prose, English technical terms (consistent with generic rules)
- At least 3 CRITICAL/HIGH examples + 2 NOT-critical (safe) examples
- Cross-references to other relevant rules
- Fix recommendations are actionable (specific function/config, not "use safe practices")
- **Section order matters** (applies to generic rules too): detection sections first (`## Intent`, `## Khi nào ...`, reasoning, `## Search patterns`), then detail sections (`## Examples`, `## Fix recommendation`, `## Cross-references`). `references/load-rules.sh` loads only the text before the first detail heading during scanning; detail is read later only for rules with CRITICAL/HIGH findings. Anything the scanner needs to *detect* the issue must be above `## Examples`.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall