Skip to content

tanviet12/vbsec / skills/antigravity/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`. For large scans (>20 main-language files OR >30 total OR >14 days) processes chunks sequentially. Outputs bilingual reports (vi/en). Optional `--auto-fix` (agentic patch + verify loop) and `--sca` (live CVE lookup via OSV.dev).

FileKindSize
SKILL.mdskill md28.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-sequential.mdmarkdown14.8 KB
workflows/small-review.mdmarkdown10.1 KB

rules/generic/05-slopsquatting.md

View on GitHub
---
id: SLOPSQUATTING
severity_max: CRITICAL
applies_to: all
---

# Slopsquatting (AI-hallucinated Package Names)

## Intent

AI sinh code import package **không tồn tại trên npm/PyPI/Packagist** (hallucination). Attacker tự đăng ký tên đó với **malware bên trong**: post-install script đánh cắp `~/.aws/credentials`, `~/.ssh/`, env var, crypto wallet, hoặc cài backdoor RAT.

Đây là attack mới đặc trưng cho vibe code: research 2024 cho thấy LLM hay invent tên kiểu `requets`, `python-requestz`, `lodahs`, `react-toastr-pro`, `axios-utils`. Một khi attacker đăng ký, chỉ cần `npm install` là dính ngay.

## Khi nào CRITICAL

- Package name trông giống package nổi tiếng nhưng sai chính tả (`requets`, `lodahs`, `expresss`, `mongose`)
- Package có suffix lạ (`-js`, `-py`, `-pro`, `-utils`, `-helpers`, `-core`) không có nguồn nào nhắc đến
- Ký tự lookalike: `l` ↔ `I` ↔ `1`, `0` ↔ `O`, dấu gạch lạ
- Project chưa cài (chưa có trong `node_modules` / `pip freeze`)

## Khi nào MEDIUM (giảm cấp)

- Package có vẻ lạ nhưng đã cài thành công và chạy ổn (có thể là package thật ít nổi)
- Package thuộc tổ chức scoped đáng tin (`@vercel/*`, `@aws-sdk/*`, `@nestjs/*`)
- Đã pin version cụ thể trong lock file và lock file đã commit

## Cách reasoning (KHÔNG pattern-match thuần)

1. **Collect** mọi import statement trong project:
   - JS/TS: `import ... from "..."`, `require("...")`, `package.json` `dependencies`
   - Python: `import X`, `from X import ...`, `requirements.txt`, `pyproject.toml`
   - PHP: `composer.json` `require`
   - Ruby: `Gemfile`
2. **Loại** built-in/std-lib (vd: `os`, `sys`, `fs`, `path`, `crypto`) và relative import (`./`, `../`)
3. **Đánh giá heuristic**:
   - Có giống tên phổ biến không? (Levenshtein distance ≤ 2 với `requests`, `lodash`, `express`, `react`, `axios`, `numpy`, `pandas`...)
   - Có suffix khả nghi không? (`-js`, `-py`, `-pro`, `-helpers`, `-core`, `-utils`)
   - Có ký tự lookalike không?
   - Có scope không (`@org/name`)? Scope chính chủ thì an toàn hơn.
4. **Verify** (cảnh báo cho user, scanner không tự lên mạng):
   - JS: `npm view <name>` — kiểm tra publisher, downloads/week, age, repo URL
   - Python: `pip show <name>` hoặc check `pypi.org/project/<name>`
   - Cross-check: lock file có chứa package này chưa? Nếu chưa, **cảnh báo trước khi install**
5. Chú ý: package mới upload <30 ngày, weekly downloads <100, không có repo GitHub → đỏ rực

## Search patterns (gợi ý — KHÔNG chạy literal, dùng Grep tool)

### JS/TS

```
^import\s+.*\s+from\s+["']([^"'./][^"']*)["']
^const\s+.*=\s+require\s*\(\s*["']([^./][^"']*)["']
# package.json
"dependencies"\s*:\s*\{
```

### Python

```
^import\s+([a-z_][a-z0-9_]*)
^from\s+([a-z_][a-z0-9_]*)\s+import
# requirements.txt
^[a-zA-Z][a-zA-Z0-9_-]+
```

### Suspicious heuristics

```
# Lookalike / typo của package nổi tiếng (check thủ công)
requets|requestz|python-requests-                 # vs "requests"
lodahs|lodahs-utils|lodash-pro                    # vs "lodash"
expresss|express-pro|express-helpers              # vs "express"
mongose|mongoosee                                 # vs "mongoose"
axios-utils|axios-helpers|axios-pro               # khả nghi
react-toastr-pro|react-utils-helpers              # generic suffix
```

## Examples

### CRITICAL — flag

```javascript
// import gần giống "requests" của Python nhưng người dùng để vào Node?
const requets = require("requets");   // Typo của "requests"? Hay slopsquatting?
```

```python
# AI hay hallucinate kiểu này
import python_requests_pro       # KHÔNG tồn tại — slopsquatting bait
from openai_helpers import gpt   # KHÔNG có package "openai_helpers" chính thức
```

```json
// package.json — suspicious suffix, weekly downloads = 12
{
  "dependencies": {
    "lodahs": "^1.0.0",
    "express-utils-pro": "^0.1.2",
    "react-router-helpers": "*"
  }
}
```

```python
# requirements.txt
flask-utils-pro==0.0.1     # CỜ ĐỎ — version 0.0.1, suffix lạ
requets>=2.0                # typo của "requests"
```

### NOT critical — không flag (hoặc downgrade)

```javascript
// Scoped package từ tổ chức uy tín
import { createClient } from "@supabase/supabase-js";
import { S3Client } from "@aws-sdk/client-s3";
import { Module } from "@nestjs/common";
```

```python
# Package std/phổ biến — tên đúng
import requests
import numpy as np
from fastapi import FastAPI
```

```json
// package.json — lock file commit, version pin
{
  "dependencies": {
    "express": "4.19.2",
    "axios": "1.7.2"
  }
}
```

## Fix recommendation

1. **Trước khi install bất kỳ package nào do AI gợi ý, VERIFY:**
   ```bash
   # JS
   npm view <name>                # check publisher, repo, downloads
   npm view <name> time            # ngày publish

   # Python
   pip show <name>
   # hoặc mở https://pypi.org/project/<name>
   ```
2. **Đỏ rực nếu**:
   - Weekly downloads < 1000 với JS, < 500 với Python
   - Publisher / repo không tồn tại
   - Package mới publish <30 ngày
   - Tên gần giống package nổi tiếng (Levenshtein ≤ 2)
3. **Commit lock file** (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `poetry.lock`, `Pipfile.lock`) — bắt buộc.
4. **Bật npm/pip integrity check**:
   ```bash
   npm config set audit-level moderate
   npm install --ignore-scripts <name>   # chặn post-install script — sau đó audit
   pip install --require-hashes -r requirements.txt
   ```
5. **Dùng tool quét**:
   - `socket.dev` — phát hiện malware npm
   - `pip-audit` — CVE Python
   - `npm audit` — CVE Node
6. **Nếu lỡ install package khả nghi**:
   - `npm uninstall <name>` ngay
   - Xóa `node_modules` và lock file, install lại từ đầu
   - **Coi như máy đã bị compromised**: rotate AWS/GH/SSH key, scan máy bằng anti-malware

## Cross-references

- Rule `01-hardcoded-secret`: malware từ slopsquatting scan secret trong code và env
- Rule `20-outdated-dependency`: package cũ có CVE — khác slopsquatting nhưng cùng họ supply chain
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: 472kUpdated 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: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated 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