vuln-patterns-core
Universal vulnerability detection patterns applicable across all programming languages. Includes hardcoded secrets, SQL/command injection, path traversal, and configuration file patterns.
What this skill does
# Vulnerability Patterns: Core
Universal security patterns applicable to all programming languages.
## When to Use This Skill
- **Live security hooks** - Real-time validation of code changes
- **Cross-language scanning** - Patterns that work on any codebase
- **Configuration audits** - Scanning env files, Docker, YAML configs
## When NOT to Use This Skill
- **Language-specific patterns** - Use vuln-patterns-languages skill
- **Full security audits** - Use domain auditor agents
- **Remediation guidance** - Use remediation-* skills
---
## Hardcoded Secrets
**Detection Pattern**:
```regex
# API Keys
(?i)(api[_-]?key|apikey)\s*[:=]\s*['"][a-zA-Z0-9]{16,}['"]
# AWS Keys
(?:AKIA|ABIA|ACCA|ASIA)[A-Z0-9]{16}
# Private Keys
-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----
# Generic Secrets
(?i)(password|secret|token|credential)s?\s*[:=]\s*['"][^'"]{8,}['"]
# JWT Secrets
(?i)(jwt[_-]?secret|signing[_-]?key)\s*[:=]\s*['"][^'"]+['"]
```
**Grep Commands**:
```bash
# API keys
grep -rn --include="*.{js,ts,py,java,go,rb}" -E "(api[_-]?key|apikey)\s*[:=]\s*['\"][a-zA-Z0-9]{16,}['\"]" .
# AWS keys
grep -rn -E "AKIA[A-Z0-9]{16}" .
# Private keys
grep -rn "BEGIN.*PRIVATE KEY" .
# Password assignments
grep -rn --include="*.{js,ts,py,java,go,rb}" -E "(password|secret)\s*[:=]\s*['\"][^'\"]{8,}['\"]" .
```
**Severity**: High
**ASVS**: V13.3.1 - Secrets not in version control
**CWE**: CWE-798 (Hardcoded Credentials)
---
## SQL Injection
**Detection Pattern**:
```regex
# String concatenation in queries
(?i)(SELECT|INSERT|UPDATE|DELETE|FROM|WHERE).*\+\s*[a-zA-Z_]+
# f-string/template queries
(?i)f['"](SELECT|INSERT|UPDATE|DELETE).*\{
# Format string queries
(?i)(SELECT|INSERT|UPDATE|DELETE).*%\s*\(
# String interpolation
(?i)(SELECT|INSERT|UPDATE|DELETE).*\$\{
```
**Grep Commands**:
```bash
# Python f-string SQL
grep -rn --include="*.py" -E "f['\"]SELECT.*\{|f['\"]INSERT.*\{|f['\"]UPDATE.*\{|f['\"]DELETE.*\{" .
# JavaScript template SQL
grep -rn --include="*.{js,ts}" -E "\`SELECT.*\$\{|\`INSERT.*\$\{|\`UPDATE.*\$\{|\`DELETE.*\$\{" .
# String concatenation SQL (all languages)
grep -rn -E "(SELECT|INSERT|UPDATE|DELETE).*\+.*\+" .
```
**Severity**: Critical
**ASVS**: V1.2.1 - Parameterized queries
**CWE**: CWE-89 (SQL Injection)
---
## Command Injection
**Detection Pattern**:
```regex
# Shell execution with variables
(?i)(os\.system|subprocess\.call|exec|shell_exec|system)\s*\([^)]*\+
(?i)(os\.system|subprocess\.call|exec|shell_exec|system)\s*\([^)]*\$\{
(?i)(os\.system|subprocess\.call|exec|shell_exec|system)\s*\([^)]*f['"]
# Dangerous shell=True
subprocess\.[a-z]+\([^)]*shell\s*=\s*True
```
**Grep Commands**:
```bash
# Python os.system
grep -rn --include="*.py" -E "os\.system\s*\(.*\+" .
# Python subprocess shell=True
grep -rn --include="*.py" "shell\s*=\s*True" .
# Node.js exec
grep -rn --include="*.{js,ts}" -E "exec\s*\(.*\+" .
# PHP system calls
grep -rn --include="*.php" -E "(system|exec|shell_exec|passthru)\s*\(" .
```
**Severity**: Critical
**ASVS**: V1.2.3 - OS command injection prevention
**CWE**: CWE-78 (OS Command Injection)
---
## Path Traversal
**Detection Pattern**:
```regex
# Direct path concatenation
(?i)(open|read|write|file|path)\s*\([^)]*\+.*\)
(?i)(open|read|write|file|path)\s*\([^)]*\$\{.*\)
# No path validation
os\.path\.join\s*\([^)]*,[^)]*\)(?!.*resolve|.*is_relative)
```
**Grep Commands**:
```bash
# Python file operations with variables
grep -rn --include="*.py" -E "open\s*\(.*\+" .
# Node.js file operations
grep -rn --include="*.{js,ts}" -E "(readFile|writeFile|createReadStream)\s*\(.*\+" .
# Check for missing path validation
grep -rn --include="*.py" "os\.path\.join" . | grep -v "resolve\|is_relative"
```
**Severity**: High
**ASVS**: V5.4.1 - Path traversal prevention
**CWE**: CWE-22 (Path Traversal)
---
## Configuration File Patterns
### .env Files
**Detection Pattern**:
```regex
# Sensitive keys in .env
(?i)(password|secret|token|api[_-]?key|private[_-]?key)\s*=\s*[^\s]+
```
**Grep Commands**:
```bash
grep -rn -E "(?i)(password|secret|token|api.?key)=" .env* 2>/dev/null
```
**Severity**: High
**ASVS**: V13.3.1 - Secrets management
**CWE**: CWE-798 (Hardcoded Credentials)
---
### Docker/Container
**Detection Pattern**:
```regex
# Privileged mode
--privileged
privileged:\s*true
# Running as root
USER\s+root
# Exposed secrets
ENV\s+(PASSWORD|SECRET|API_KEY|TOKEN)\s*=
```
**Grep Commands**:
```bash
grep -rn "privileged" Dockerfile docker-compose.yml 2>/dev/null
grep -rn "USER root" Dockerfile 2>/dev/null
grep -rn -E "ENV.*(PASSWORD|SECRET|API_KEY)" Dockerfile 2>/dev/null
```
**Severity**: High
**ASVS**: V13.2.1 - Secure configuration
**CWE**: CWE-250 (Excessive Privilege)
---
## Quick Scan Script
Use this script for rapid vulnerability detection:
```bash
#!/bin/bash
# quick-security-scan.sh
echo "=== Quick Security Scan ==="
echo -e "\n[1] Hardcoded Secrets"
grep -rn --include="*.{js,ts,py,java,go,rb,php}" -E "(api[_-]?key|password|secret)\s*[:=]\s*['\"][^'\"]{8,}['\"]" . 2>/dev/null | head -20
echo -e "\n[2] SQL Injection Patterns"
grep -rn --include="*.{js,ts,py,java,go,rb,php}" -E "(SELECT|INSERT|UPDATE|DELETE).*\+" . 2>/dev/null | head -20
echo -e "\n[3] Command Injection"
grep -rn --include="*.py" "shell\s*=\s*True" . 2>/dev/null
grep -rn --include="*.{js,ts}" -E "exec\s*\(|spawn\s*\(" . 2>/dev/null | head -10
echo -e "\n[4] Unsafe Deserialization"
grep -rn --include="*.py" "pickle\.load\|yaml\.load" . 2>/dev/null
grep -rn --include="*.java" "ObjectInputStream\|readObject" . 2>/dev/null
echo -e "\n[5] Weak Cryptography"
grep -rn --include="*.{py,java,go}" -E "md5|sha1|DES|RC4" . 2>/dev/null | head -10
echo -e "\n[6] Debug/Dev Settings"
grep -rn --include="*.py" "DEBUG\s*=\s*True" . 2>/dev/null
grep -rn "NODE_ENV.*development" . 2>/dev/null
echo -e "\n=== Scan Complete ==="
```
---
## Integration with Live Hooks
When using these patterns in PreToolUse hooks:
1. **Parse the file content** from the tool input
2. **Apply relevant patterns** based on file extension
3. **Return blocking result** for Critical/High severity matches
4. **Return warning** for Medium severity matches
### Pattern Matching Priority
| Severity | Action | Response Time |
|----------|--------|---------------|
| Critical | Block | Immediate |
| High | Block/Warn | Immediate |
| Medium | Warn | Deferred |
| Low | Log | Async |
### False Positive Mitigation
1. **Context awareness**: Check surrounding code for sanitization
2. **Allowlists**: Skip known-safe patterns (e.g., test files)
3. **Confidence scoring**: Multiple indicators increase confidence
4. **User overrides**: Allow explicit bypass with comments
---
## See Also
- `vuln-patterns-languages` - Language-specific patterns
- `remediation-injection` - SQL/command injection fixes
- `remediation-auth` - Secrets management fixes
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.