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/languages/php/17-verbose-error-debug-mode.md

View on GitHub
---
id: VERBOSE-ERROR-DEBUG-MODE
severity_max: CRITICAL
applies_to: php
---

# Verbose Error / Debug Mode (PHP)

## Intent

PHP có lịch sử leak nặng vì:

- `display_errors = On` trong `php.ini` production → mọi notice/warning/fatal in trực tiếp ra HTML, leak file path, DB credential trong DSN, secret trong include path.
- **Laravel `APP_DEBUG=true`** trong `.env` production → Ignition error page hiện full stack trace, env var (bao gồm `APP_KEY`, `DB_PASSWORD`!), config dump, registered routes. CVE-2021-3129 Ignition còn cho RCE qua "Solution" feature.
- **Symfony `APP_ENV=dev`** trong prod → Web Profiler toolbar exposed `/_profiler`, hiện request/response/DB query/email/log của mọi request gần đây.
- WordPress `WP_DEBUG = true` → notice/warning hiện inline, leak plugin path + version → attacker biết chính xác CVE.
- `error_reporting(E_ALL)` + `ini_set('display_errors', 1)` cuối file.
- Custom `try/catch` echo `$e->getMessage()` hoặc `$e->getTraceAsString()` về client.

Đây là **CRITICAL** trong PHP (cao hơn Go) vì:
1. Laravel Ignition page leak APP_KEY → forge session cookie → ATO
2. PHP error message leak full path `/var/www/html/...` → attacker biết web root
3. Ignition RCE CVE đã có exploit public

## Khi nào CRITICAL

- Laravel `APP_DEBUG=true` trong production `.env`
- Symfony `APP_ENV=dev` trong prod
- `display_errors = On` trên prod php.ini hoặc set qua `ini_set` trong code
- Endpoint trả về `$e->getTraceAsString()` / `print_r($e)` / `var_dump($e)` về user
- WordPress `WP_DEBUG_DISPLAY = true` prod

## Khi nào HIGH

- `WP_DEBUG = true` nhưng `WP_DEBUG_DISPLAY = false` + `WP_DEBUG_LOG = true` — log vào file, không hiện response (vẫn rủi ro nếu log file public)
- `error_reporting(E_ALL)` nhưng `display_errors = Off` — log only

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

1. **Đọc `.env`** (hoặc `.env.example` + check production deploy doc): `APP_DEBUG`, `APP_ENV`, `WP_DEBUG`
2. **Grep `ini_set`** với `display_errors` / `error_reporting`
3. **Grep `getTraceAsString`, `getMessage`, `print_r`, `var_dump`, `dd(`, `dump(`** trong handler
4. **Check route `/_profiler`** (Symfony), `/telescope` (Laravel Telescope chỉ nên local), `/horizon` (chỉ admin), `/_debugbar`
5. **Verify environment detection**:
   - `app()->environment('production')` check rồi mới set debug?
   - `WP_ENVIRONMENT_TYPE` check?
6. **Cross-check `.env` commit**: nếu `.env` committed (cross-ref HARDCODED-SECRET) + APP_DEBUG=true → attacker biết debug ON

## Search patterns (PHP-specific)

```
# Laravel env
APP_DEBUG\s*=\s*true
APP_ENV\s*=\s*local|dev|development

# Symfony
APP_ENV\s*=\s*dev

# WordPress
define\s*\(\s*['"]WP_DEBUG['"]\s*,\s*true
define\s*\(\s*['"]WP_DEBUG_DISPLAY['"]\s*,\s*true

# Direct ini_set
ini_set\s*\(\s*['"]display_errors['"]\s*,\s*['"]?(1|On|on|true)
error_reporting\s*\(\s*E_ALL\s*\)

# Error leak to response
echo\s+\$e->getMessage
echo\s+\$e->getTraceAsString
print_r\s*\(\s*\$(e|exception|error)
var_dump\s*\(.*\$_(GET|POST|SESSION)
dd\s*\(                                      # Laravel dd() — fatal in dev, in response in some cases
dump\s*\(                                    # Symfony VarDumper

# Debug bar / profiler routes
\/_profiler
\/telescope
\/horizon
\/_debugbar
Laravel\\Telescope
```

## Examples

### CRITICAL — flag

```bash
# .env trong production
APP_NAME=MyApp
APP_ENV=production
APP_KEY=base64:realKey==
APP_DEBUG=true                # BAD: Ignition exposed
DB_PASSWORD=realpassword
```

```php
<?php
// Custom handler trả về trace
try {
    do_something();
} catch (\Exception $e) {
    http_response_code(500);
    echo $e->getTraceAsString();  // BAD
}
```

```php
<?php
// Symfony prod với APP_ENV=dev
// .env
APP_ENV=dev  # BAD trong prod → /_profiler exposed
```

```php
<?php
// wp-config.php production
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);  // BAD: error inline trên page
```

```php
<?php
// Code top-level
ini_set('display_errors', 1);
error_reporting(E_ALL);
// chạy trong prod → leak
```

```php
// Laravel handler echo error
public function show($id) {
    try {
        return User::findOrFail($id);
    } catch (\Throwable $e) {
        return response()->json(['error' => $e->getMessage(), 'trace' => $e->getTrace()], 500);
        // BAD: leak query, file path
    }
}
```

### NOT critical — safe

```bash
# .env production
APP_ENV=production
APP_DEBUG=false   # OK
LOG_LEVEL=warning
```

```php
<?php
// php.ini production
display_errors = Off
log_errors = On
error_log = /var/log/php/error.log
```

```php
// Laravel central handler — generic error
// app/Exceptions/Handler.php
public function render($request, Throwable $e) {
    Log::error($e);  // log internal
    if ($e instanceof ModelNotFoundException) {
        return response()->json(['error' => 'not found'], 404);
    }
    return response()->json(['error' => 'internal error'], 500);  // generic
}
```

```php
// wp-config.php production
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);       // log vào file, không hiện UI
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);
```

## Fix recommendation

1. **Laravel**: `APP_DEBUG=false` trong production `.env`. Set qua deployment pipeline, KHÔNG commit `.env`.
2. **Symfony**: `APP_ENV=prod` trong production. Disable Web Profiler (`symfony/web-profiler-bundle` chỉ require-dev).
3. **WordPress**: `WP_DEBUG_DISPLAY=false`, log vào file ngoài web root (`/var/log/wp-debug.log`).
4. **php.ini prod**:
   ```
   display_errors = Off
   display_startup_errors = Off
   log_errors = On
   error_log = /var/log/php/error.log
   error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
   expose_php = Off
   ```
5. **Central error handler**: log internal, response generic. KHÔNG echo `$e->getMessage()`.
6. **Tắt `dd()`, `dump()`, `var_dump()`** trước commit. Lint rule (PHPStan / Larastan) catch.
7. **Block `/_profiler`, `/telescope`, `/_debugbar`** ở web server level (nginx/Apache) cho production domain.
8. **Update Laravel `facade/ignition`** lên ≥ 2.5.2 fix CVE-2021-3129.
9. **APP_KEY rotation**: nếu từng leak qua Ignition page → rotate ngay, mọi session cũ invalidate.

## Cross-references

- Rule `01-hardcoded-secret`: Ignition leak APP_KEY + DB_PASSWORD từ `.env` → secret rotation
- Rule `08-insecure-deserialization`: APP_KEY leak → forge serialized cookie (Laravel session)
- Rule `02-sql-injection`: SQLi + Ignition error = attacker thấy full query, schema instantly
- Rule `20-outdated-dependency`: Ignition < 2.5.2 CVE-2021-3129 RCE
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: 470kUpdated 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: 470kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 470kUpdated 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