mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
127 lines
4.1 KiB
YAML
127 lines
4.1 KiB
YAML
rules:
|
|
# ── CRITICAL: prompt injection ──
|
|
- id: prompt-injection-0
|
|
severity: CRITICAL
|
|
pattern: prompt-injection
|
|
message: "Prompt injection attempt detected"
|
|
regex: '(?i)(ignore\s+(all\s+)?previous\s+instructions|disregard\s+(all\s+)?rules|you\s+are\s+now\b|forget\s+everything|override\s+safety)'
|
|
|
|
- id: prompt-injection-1
|
|
severity: CRITICAL
|
|
pattern: prompt-injection
|
|
message: "SYSTEM: prompt override detected"
|
|
regex: '(?m)^SYSTEM:'
|
|
|
|
# ── CRITICAL: data exfiltration (curl/wget + secrets) ──
|
|
- id: data-exfiltration-0
|
|
severity: CRITICAL
|
|
pattern: data-exfiltration
|
|
message: "Command may exfiltrate sensitive data"
|
|
regex: '(?i)(curl|wget)\s+.*(\$SECRET|\$TOKEN|\$API_KEY|\$OPENAI_API_KEY|\$ANTHROPIC_API_KEY|\$AWS_SECRET)'
|
|
|
|
- id: data-exfiltration-1
|
|
severity: CRITICAL
|
|
pattern: data-exfiltration
|
|
message: "Command sends environment variables externally"
|
|
regex: '(?i)(curl|wget)\s+.*\$\{?(HOME|USER|PATH|SSH|GPG|AWS|GITHUB_TOKEN|OPENAI|ANTHROPIC)'
|
|
|
|
# ── CRITICAL: credential access ──
|
|
- id: credential-access-0
|
|
severity: CRITICAL
|
|
pattern: credential-access
|
|
message: "Accessing SSH private keys"
|
|
regex: 'cat\s+~/?\.\s*ssh/(id_|known_hosts|authorized_keys|config)'
|
|
|
|
- id: credential-access-1
|
|
severity: CRITICAL
|
|
pattern: credential-access
|
|
message: "Accessing .env secrets file"
|
|
regex: 'cat\s+\.env\b'
|
|
|
|
- id: credential-access-2
|
|
severity: CRITICAL
|
|
pattern: credential-access
|
|
message: "Accessing AWS credentials"
|
|
regex: 'cat\s+~/?\.\s*aws/(credentials|config)'
|
|
|
|
# ── HIGH: hidden unicode (zero-width characters) ──
|
|
- id: hidden-unicode-0
|
|
severity: HIGH
|
|
pattern: hidden-unicode
|
|
message: "Hidden zero-width Unicode characters detected"
|
|
regex: "[\u200B\u200C\u200D\u2060\uFEFF]"
|
|
|
|
# ── HIGH: destructive commands ──
|
|
- id: destructive-commands-0
|
|
severity: HIGH
|
|
pattern: destructive-commands
|
|
message: "Potentially destructive command"
|
|
regex: '(?i)\brm\s+-rf\s+(/(\s|$|\*)|\*|\./)'
|
|
|
|
- id: destructive-commands-1
|
|
severity: HIGH
|
|
pattern: destructive-commands
|
|
message: "Unsafe permission change"
|
|
regex: '(?i)\bchmod\s+777\b'
|
|
|
|
- id: destructive-commands-2
|
|
severity: HIGH
|
|
pattern: destructive-commands
|
|
message: "Sudo escalation"
|
|
regex: '(?i)\bsudo\s+'
|
|
|
|
- id: destructive-commands-3
|
|
severity: HIGH
|
|
pattern: destructive-commands
|
|
message: "Disk overwrite command"
|
|
regex: '(?i)\bdd\s+if='
|
|
|
|
- id: destructive-commands-4
|
|
severity: HIGH
|
|
pattern: destructive-commands
|
|
message: "Filesystem format command"
|
|
regex: '(?i)\bmkfs\.'
|
|
|
|
# ── HIGH: obfuscation ──
|
|
- id: obfuscation-0
|
|
severity: HIGH
|
|
pattern: obfuscation
|
|
message: "Base64 decode pipe may hide malicious content"
|
|
regex: '(?i)(base64\s+(-d|--decode)|\bbase64\b.*\|\s*(sh|bash|zsh|eval))'
|
|
|
|
- id: obfuscation-1
|
|
severity: HIGH
|
|
pattern: obfuscation
|
|
message: "Long base64-encoded string detected"
|
|
regex: '[A-Za-z0-9+/]{100,}={0,2}'
|
|
|
|
# ── MEDIUM: suspicious URL usage ──
|
|
- id: suspicious-fetch-0
|
|
severity: MEDIUM
|
|
pattern: suspicious-fetch
|
|
message: "URL used in command context"
|
|
regex: '(?i)(curl|wget|invoke-webrequest|iwr)\s+[''"]?https?://'
|
|
exclude: '(?i)https?://(localhost|127\.0\.0\.1)'
|
|
|
|
# ── MEDIUM: system path writes ──
|
|
- id: system-writes-0
|
|
severity: MEDIUM
|
|
pattern: system-writes
|
|
message: "References to system directories"
|
|
regex: '(?i)(write|copy|cp|mv|install)\s+.*/?(usr|etc|var|opt)/'
|
|
|
|
# ── LOW: insecure transport hints ──
|
|
- id: insecure-http-0
|
|
severity: LOW
|
|
pattern: insecure-http
|
|
message: "Non-HTTPS URL in command context"
|
|
regex: '(?i)(curl|wget|invoke-webrequest|iwr)\s+http://'
|
|
exclude: '(?i)http://(localhost|127\.0\.0\.1|0\.0\.0\.0)'
|
|
|
|
# ── INFO: risky shell chaining patterns (advisory) ──
|
|
- id: shell-chain-0
|
|
severity: INFO
|
|
pattern: shell-chain
|
|
message: "Command chaining detected; verify intent"
|
|
regex: '(?m)(\|\||&&|;)\s*(rm|chmod|curl|wget|bash|sh)\b'
|