mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
Existing URL and code-execution signatures miss cloud metadata access and language-specific deserializers. Add scoped static evidence and inspect safe YAML and torch options within each call so safe siblings cannot hide risks. Validate and preserve file applicability across overrides, scans and rule listings. Collect PHP scripts and propagate rule-load errors so malformed filters cannot silently disable global scanning. Document the policy and limits with paired regressions, fuzzing and an isolated CLI runbook. Co-authored-by: GPT-6.1 Sol <noreply@openai.com> Co-authored-by: sim <sim@example.invalid> Co-authored-by: Willie <egg358358@gmail.com>
458 lines
22 KiB
YAML
458 lines
22 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: '(?im)^\s*(SYSTEM|OVERRIDE|IGNORE|ADMIN|ROOT):'
|
||
# Lowercase config keys whose value is data on the same line are not
|
||
# directives; uppercase labels always match. Each key accepts only the
|
||
# value kinds its config uses: scalars for all, space-free paths for root
|
||
# (RE2 has no backreferences, so each quoting is listed), and inline
|
||
# objects for ignore whose words are joined by punctuation, not spaces or
|
||
# slashes, or inline arrays of quoted space-free items (globs). root also
|
||
# accepts a typed parameter (root: Path, lang: set[str] | None = None):
|
||
# every type and type argument is a capitalized or builtin name, and
|
||
# further parameters must be name: Type. No empty values (an indented
|
||
# block follows) and no trailing comments (# and // do not hide text in
|
||
# Markdown).
|
||
exclude: '^\s*(?:(?:system|override|ignore|admin|root):\s*(?:true|false|yes|no|on|off|null|~|-?\d+(?:\.\d+)?)|root:\s*(?:"(?:[.~/]|\w[\w.-]*/|[A-Za-z]:\\)[^\s"'']*"|''(?:[.~/]|\w[\w.-]*/|[A-Za-z]:\\)[^\s"'']*''|(?:[.~/]|\w[\w.-]*/|[A-Za-z]:\\)[^\s"'']*)|ignore:\s*\{\s*(?:["'']?[\w-]*["'']?\s*[:,\[\]]\s*)*["'']?[\w-]*["'']?\s*\}|ignore:\s*\[\s*(?:(?:"[^\s"]*"|''[^\s'']*'')(?:\s*,\s*(?:"[^\s"]*"|''[^\s'']*''))*\s*,?\s*)?\]|root:\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?)*\])?(?:\s*\|\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?)*\])?)*(?:\s*=\s*(?:None|True|False|-?\d+(?:\.\d+)?|"[^\s"]*"|''[^\s'']*''))?(?:\s*,\s*\w+\s*:\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?)*\])?(?:\s*\|\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\[(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object)(?:\s*[,|]\s*(?:[A-Z]\w*|str|int|float|bool|bytes|list|dict|set|tuple|object))*\])?)*\])?)*(?:\s*=\s*(?:None|True|False|-?\d+(?:\.\d+)?|"[^\s"]*"|''[^\s'']*''))?)*),?\s*$'
|
||
|
||
- id: prompt-injection-2
|
||
severity: HIGH
|
||
pattern: prompt-injection
|
||
message: "Agent directive tag detected"
|
||
regex: '(?i)<\/?(system|instructions|override|prompt|rules)\b[^>]*>'
|
||
|
||
- id: prompt-injection-3
|
||
severity: CRITICAL
|
||
pattern: prompt-injection
|
||
message: "Directive-style prompt override detected"
|
||
regex: '(?im)^\s*(DEV(ELOPER)?[\s_]*MODE|JAILBREAK|DAN[\s_.]*MODE)\b'
|
||
|
||
# ── CRITICAL: data exfiltration (curl/wget + secrets) ──
|
||
- id: data-exfiltration-2
|
||
severity: MEDIUM
|
||
pattern: data-exfiltration
|
||
message: "External image with query parameters — potential data exfiltration vector"
|
||
regex: '!\[[^\]]*\]\(https?://[^)]*\?[^)]+\)'
|
||
|
||
- 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/HIGH/MEDIUM/LOW: credential access ──
|
||
# Credential-access rules are now table-driven (see credentials.go).
|
||
# To disable a specific credential rule, use its descriptive ID in audit-rules.yaml:
|
||
# - id: credential-access-ssh-private-key
|
||
# enabled: false
|
||
|
||
# ── CRITICAL: invisible payload (Unicode tag characters U+E0001–E007F) ──
|
||
# Primary vector for Pillar Security "Rules File Backdoor" attack.
|
||
# Tag characters render 0px wide but are fully processed by LLMs.
|
||
- id: hidden-unicode-1
|
||
severity: CRITICAL
|
||
pattern: invisible-payload
|
||
message: "Unicode tag characters detected — may contain invisible payload"
|
||
regex: '[\x{E0001}-\x{E007F}]'
|
||
|
||
# ── CRITICAL: output suppression directives ──
|
||
# Explicit concealment of actions or instructions is a strong malicious signal.
|
||
- id: prompt-injection-4
|
||
severity: CRITICAL
|
||
pattern: prompt-injection
|
||
message: "Output suppression directive — attempts to hide actions from user"
|
||
regex: '(?i)((don''t|do\s+not)\s+tell\s+the\s+user\s+(about\s+)?(this|the)\s+(instruction|change|action)\b|do\s+not\s+(mention|reveal)\s+this\s+(instruction|change|action|to\s+the\s+user)|never\s+(mention|reveal)\s+this\s+instruction|hide\s+this\s+from\s+the\s+user|remove\s+(this\s+)?from\s+(chat|conversation)\s+history)'
|
||
|
||
# A generic disclosure restriction may be advice or concealment. Keep it
|
||
# visible without treating an ambiguous prefix as confirmed malicious intent.
|
||
- id: prompt-injection-5
|
||
severity: HIGH
|
||
pattern: prompt-injection
|
||
message: "Possible output suppression — review disclosure restriction"
|
||
regex: '(?i)(don''t|do\s+not)\s+tell\s+the\s+user'
|
||
exclude: '(?i)(don''t|do\s+not)\s+tell\s+the\s+user\s+(about\s+)?(this|the)\s+(instruction|change|action)\b'
|
||
|
||
# ── 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: bidirectional text control (Trojan Source CVE-2021-42574) ──
|
||
- id: hidden-unicode-2
|
||
severity: HIGH
|
||
pattern: hidden-unicode
|
||
message: "Bidirectional text control characters — may reorder visible text (Trojan Source)"
|
||
regex: "[\u202A-\u202E\u2066-\u2069]"
|
||
|
||
# ── HIGH: config/memory file poisoning ──
|
||
# Skills should not modify agent config files (MEMORY.md, CLAUDE.md, .cursorrules).
|
||
- id: config-manipulation-0
|
||
severity: HIGH
|
||
pattern: config-manipulation
|
||
message: "Instructions to modify AI agent configuration or memory files"
|
||
regex: '(?i)\b(write|modify|edit|update|append|add|insert|inject)\b.{0,20}(MEMORY\.md|SOUL\.md|CLAUDE\.md|\.cursorrules|\.windsurfrules|\.clinerules)\b'
|
||
|
||
# ── HIGH: prompt injection in markdown reference-link comment ──
|
||
- id: hidden-comment-injection-1
|
||
severity: HIGH
|
||
pattern: hidden-comment-injection
|
||
message: "Prompt injection hidden in markdown comment"
|
||
regex: '(?i)\[//\]:\s*#\s*\(.*?(ignore\s+(all\s+)?previous|disregard|you\s+are\s+now|forget\s+everything|override\s+safety|SYSTEM:|ADMIN:)'
|
||
|
||
# ── HIGH: DNS data exfiltration ──
|
||
- id: data-exfiltration-3
|
||
severity: HIGH
|
||
pattern: data-exfiltration
|
||
message: "Potential DNS data exfiltration via encoded subdomain"
|
||
regex: '(?i)\b(dig|nslookup|host)\b\s+.*(\$[({]|`)'
|
||
|
||
# ── HIGH: self-replication / propagation instructions ──
|
||
- id: self-propagation-0
|
||
severity: HIGH
|
||
pattern: self-propagation
|
||
message: "Self-replication instruction — may spread payload to other files"
|
||
regex: '(?i)(add|inject|insert|include)\s+(this|these)\s+(instruction|rule|directive|text)\s+(to|into|in)\s+(all|every|each|other)\b'
|
||
|
||
# ── MEDIUM: untrusted package execution ──
|
||
- id: untrusted-install-0
|
||
severity: MEDIUM
|
||
pattern: untrusted-install
|
||
message: "Auto-execute untrusted npm package without confirmation"
|
||
regex: '(?i)\bnpx\s+(-y\s+|--yes\s+)'
|
||
|
||
- id: untrusted-install-1
|
||
severity: MEDIUM
|
||
pattern: untrusted-install
|
||
message: "pip install from URL (not PyPI registry)"
|
||
regex: '(?i)\bpip3?\s+install\s+https?://'
|
||
|
||
# ── MEDIUM: additional invisible Unicode (soft hyphen, math operators, directional marks) ──
|
||
- id: hidden-unicode-3
|
||
severity: MEDIUM
|
||
pattern: hidden-unicode
|
||
message: "Invisible Unicode characters detected (soft hyphen, directional marks, math operators)"
|
||
regex: "[\u00AD\u200E\u200F\u2061-\u2064]"
|
||
|
||
# ── 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: dynamic code execution (JS/Python eval/exec) ──
|
||
- id: dynamic-code-exec-0
|
||
severity: HIGH
|
||
pattern: dynamic-code-exec
|
||
message: "Dynamic code execution (eval/exec) detected"
|
||
regex: '(?i)\b(eval|exec)\s*\('
|
||
exclude: '(?i)\b(eval|exec)\w+\s*\('
|
||
|
||
- id: dynamic-code-exec-1
|
||
severity: HIGH
|
||
pattern: dynamic-code-exec
|
||
message: "Dynamic Function constructor detected"
|
||
regex: '(?i)\bnew\s+Function\s*\('
|
||
|
||
# ── HIGH: Python shell execution ──
|
||
- id: shell-execution-0
|
||
severity: HIGH
|
||
pattern: shell-execution
|
||
message: "Python shell execution detected"
|
||
regex: '(?i)\b(os\.system|subprocess\.(run|call|Popen|check_output|check_call))\s*\('
|
||
|
||
# ── HIGH: hidden injection in HTML comments ──
|
||
- id: hidden-comment-injection-0
|
||
severity: HIGH
|
||
pattern: hidden-comment-injection
|
||
message: "Prompt injection hidden in HTML comment"
|
||
regex: '(?i)<!--.*?(ignore\s+(all\s+)?previous|disregard|you\s+are\s+now|forget\s+everything|override\s+safety|SYSTEM:)'
|
||
|
||
# ── 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))'
|
||
|
||
# ── MEDIUM: escape sequence obfuscation ──
|
||
- id: escape-obfuscation-0
|
||
severity: MEDIUM
|
||
pattern: escape-obfuscation
|
||
message: "Consecutive escape sequences may hide content"
|
||
regex: '(\\x[0-9a-fA-F]{2}){3,}|(\\u[0-9a-fA-F]{4}){3,}'
|
||
|
||
# ── 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)'
|
||
|
||
# ── 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)'
|
||
|
||
# ── LOW: external links in markdown ──
|
||
- id: external-link-0
|
||
severity: LOW
|
||
pattern: external-link
|
||
message: "External URL in markdown link"
|
||
regex: '\]\(https?://[^)]+\)'
|
||
exclude: '(?i)\]\(https?://(localhost|127\.0\.0\.1|0\.0\.0\.0|learn\.microsoft\.com|developers\.figma\.com|developer\.mozilla\.org|lawsofux\.com|help\.figma\.com|developer\.apple\.com|help\.obsidian\.md|azure\.microsoft\.com|web\.dev|www\.microsoft\.com|opentelemetry\.io|nextjs\.org|motion\.dev|www\.radix-ui\.com|ui\.shadcn\.com|tailwindcss\.com|caniuse\.com)([:/)]|\?)'
|
||
|
||
# ── HIGH: remote code execution (pipe to interpreter) ──
|
||
- id: fetch-with-pipe-0
|
||
severity: HIGH
|
||
pattern: fetch-with-pipe
|
||
message: "Remote code execution: curl output piped to interpreter"
|
||
regex: '(?i)\bcurl\b[^|]*\|\s*(sudo\s+)?(ba)?sh\b'
|
||
|
||
- id: fetch-with-pipe-1
|
||
severity: HIGH
|
||
pattern: fetch-with-pipe
|
||
message: "Remote code execution: wget output piped to interpreter"
|
||
regex: '(?i)\bwget\b[^|]*\|\s*(sudo\s+)?(ba)?sh\b'
|
||
|
||
- id: fetch-with-pipe-2
|
||
severity: HIGH
|
||
pattern: fetch-with-pipe
|
||
message: "Remote code execution: fetched content piped to script interpreter"
|
||
regex: '(?i)\b(curl|wget)\b[^|]*\|\s*(sudo\s+)?(python[23]?|node|ruby|perl|zsh|fish)\b'
|
||
|
||
# ── MEDIUM: URL with raw IP address ──
|
||
- id: ip-address-url-0
|
||
severity: MEDIUM
|
||
pattern: ip-address-url
|
||
message: "URL with raw IP address — may bypass DNS-based security controls"
|
||
regex: 'https?://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}([:/\s)]|$)'
|
||
exclude: '(?i)https?://(127\.0\.0\.1|0\.0\.0\.0|10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})([:/\s)]|$)'
|
||
|
||
# ── MEDIUM: data URI with embedded executable content ──
|
||
- id: data-uri-0
|
||
severity: MEDIUM
|
||
pattern: data-uri
|
||
message: "data: URI may embed executable or obfuscated content"
|
||
regex: '(?i)\]\(data:[^)]+\)'
|
||
|
||
# ── HIGH: hardcoded secrets (inline API keys, tokens, passwords) ──
|
||
- id: hardcoded-secret-0
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "Google API key detected"
|
||
regex: 'AIza[0-9A-Za-z\-_]{35}'
|
||
|
||
- id: hardcoded-secret-1
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "AWS access key detected"
|
||
regex: 'AKIA[0-9A-Z]{16}'
|
||
|
||
- id: hardcoded-secret-2
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "GitHub personal access token (classic) detected"
|
||
regex: 'gh[ps]_[A-Za-z0-9_]{36,}'
|
||
|
||
- id: hardcoded-secret-3
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "GitHub fine-grained personal access token detected"
|
||
regex: 'github_pat_[A-Za-z0-9_]{22,}'
|
||
|
||
- id: hardcoded-secret-4
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "Slack token detected"
|
||
regex: 'xox[bporas]-[A-Za-z0-9\-]{10,}'
|
||
|
||
- id: hardcoded-secret-5
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "OpenAI API key detected"
|
||
regex: 'sk-[A-Za-z0-9]{20,}T3BlbkFJ[A-Za-z0-9]{20,}'
|
||
|
||
- id: hardcoded-secret-6
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "Anthropic API key detected"
|
||
regex: 'sk-ant-[A-Za-z0-9\-_]{80,}'
|
||
|
||
- id: hardcoded-secret-7
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "Stripe secret or restricted key detected"
|
||
regex: '[sr]k_(live|test)_[A-Za-z0-9]{20,}'
|
||
|
||
- id: hardcoded-secret-8
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "Private key block detected"
|
||
regex: '-----BEGIN (RSA|DSA|EC|OPENSSH) PRIVATE KEY-----'
|
||
|
||
- id: hardcoded-secret-9
|
||
severity: HIGH
|
||
pattern: hardcoded-secret
|
||
message: "Hardcoded secret assignment detected"
|
||
regex: '(?i)(api[_-]?key|secret[_-]?key|access[_-]?token|auth[_-]?token|password)\s*[:=]\s*["\x27][A-Za-z0-9+/\-_]{20,}["\x27]'
|
||
|
||
# ── 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'
|
||
|
||
# Narrow imperative prose patterns; anchor at the start to avoid prohibitions.
|
||
- id: anti-refusal-0
|
||
severity: HIGH
|
||
pattern: anti-refusal
|
||
message: "Directive to comply despite safety policies"
|
||
confidence: 0.85
|
||
regex: '(?i)^\s*(?:(?:[-*+>]|\d+[.)])\s*)?(?:\*\*)?(?:never\s+refuse\s+any\s+request|always\s+(?:comply(?:\s+with\s+(?:any|all|every)\s+(?:user\s+)?requests?)?|answer(?:\s+(?:(?:any|all|every)\s+)?(?:user\s+)?questions?)?))(?:\*\*)?\s*[,]?\s*(?:regardless\s+of|despite|even\s+if)\s+(?:(?:any|all|the|your|its|their)\s+)?(?:safety|security|refusal)\s+(?:policies|policy|rules|restrictions|checks|guidelines|protocols|requirements)\b'
|
||
|
||
- id: prompt-leakage-0
|
||
severity: HIGH
|
||
pattern: prompt-leakage
|
||
message: "Directive to disclose hidden system instructions"
|
||
confidence: 0.85
|
||
regex: '(?i)^\s*(?:(?:[-*+>]|\d+[.)])\s*)?(?:\*\*)?(?:reveal|print|disclose|output|show)\s+(?:(?:your|the|hidden|original)\s+){1,3}(?:system\s+prompt|system\s+instructions)\b(?:\s+to\s+(?:the\s+)?user\b|\s*[.!]|\s*$)'
|
||
|
||
- id: memory-poisoning-0
|
||
severity: HIGH
|
||
pattern: memory-poisoning
|
||
message: "Directive to persist a safety override in memory"
|
||
confidence: 0.85
|
||
regex: '(?i)^\s*(?:(?:[-*+>]|\d+[.)])\s*)?(?:\*\*)?(?:remember\s+permanently|save\s+to\s+(?:long[- ]term\s+)?memory)\b.{0,100}\b(?:safety|security)\s+(?:checks|rules|policies|restrictions)\s+(?:are(?:\s+to\s+be)?|is(?:\s+to\s+be)?|should\s+be|must\s+be|gets)\s+(?:disabled|ignored|bypassed)\b'
|
||
|
||
- id: agent-snooping-0
|
||
severity: HIGH
|
||
pattern: agent-snooping
|
||
message: "Directive to disclose or access agent configuration or another skill without permission"
|
||
confidence: 0.85
|
||
regex: '(?i)^\s*(?:(?:[-*+>]|\d+[.)])\s*)?(?:\*\*)?(?:read|open|copy)\s+(?:~/(?:\.claude|\.codex|\.gemini)/\S+|mcp\.json|another\s+skill''s\s+SKILL\.md)\s+(?:and\s+(?:then\s+)?(?:send|share|exfiltrate)|without\s+(?:permission|consent))\b'
|
||
|
||
- id: persistence-0
|
||
severity: HIGH
|
||
pattern: persistence
|
||
message: "Directive to establish persistent execution"
|
||
confidence: 0.85
|
||
regex: '(?i)^\s*(?:(?:[-*+>]|\d+[.)])\s*)?(?:\*\*)?(?:install\s+a\s+cron\s+job\b|run\s+(?:crontab\s+-e|launchctl\s+load|systemctl\s+enable)\b|append\s+.{1,100}\s+to\s+~/\.(?:bashrc|zshrc|profile)\b).{0,100}\b(?:run|install|execute|launch|load)\s+(?:the\s+)?(?:payload\b(?:\s+(?:every|at|on|from|with)\b|\s*[.,;!]|\s*$)|(?:malware|backdoor)\b)|^\s*(?:(?:[-*+>]|\d+[.)])\s*)?(?:\*\*)?append\s+.{0,80}\b(?:payload|malware|backdoor)\b.{0,80}\s+to\s+~/\.(?:bashrc|zshrc|profile)\b'
|
||
|
||
# Sensitive destinations are evidence, not a runtime SSRF verdict. Metadata
|
||
# hosts deliberately remain visible in every admitted text format.
|
||
- id: ssrf-metadata-0
|
||
severity: CRITICAL
|
||
pattern: ssrf-metadata
|
||
message: "Cloud metadata host reference — review request context and possible credential exposure"
|
||
regex: '(?i)(?:^|[^a-z0-9_.])(?:169\.254\.(?:169\.254|170\.2)|100\.100\.100\.200|metadata\.google\.internal)(?:[^a-z0-9_.]|\.(?:[^a-z0-9_.]|$)|$)|(?:^|[^a-z0-9_.:]|[^0-9a-f:]:)fd00:ec2::254(?:[^a-z0-9_.:]|:(?:[^0-9a-f:]|$)|$)'
|
||
|
||
- id: ssrf-internal-0
|
||
severity: MEDIUM
|
||
pattern: ssrf-internal
|
||
message: "Request to a loopback, private, link-local or internal destination (static evidence)"
|
||
files: ['*.py', '*.js', '*.ts', '*.rb', '*.php', '*.php3', '*.php4', '*.php5', '*.phtml', '*.sh', '*.bash', '*.zsh', '*.fish']
|
||
regex: '(?:\b(?:requests|httpx|axios)\.(?:get|post|put|patch|delete|head|options)|\b(?:fetch|urlopen|file_get_contents|fopen)|\burllib\.request\.urlopen|\bNet::HTTP\.(?:get|post)|\bURI\.open)\s*\(\s*(?:URI\s*\(\s*)?["''](https?://[^"''\s]+)|\b(?:curl|wget)\b[^\n;|]*?["'']?(https?://[^"''\s;|)]+)'
|
||
|
||
- id: ssrf-dynamic-0
|
||
severity: MEDIUM
|
||
confidence: 0.6
|
||
pattern: ssrf-dynamic
|
||
message: "Dynamic request target — destination or validation unknown; review source and validation"
|
||
files: ['*.py', '*.js', '*.ts', '*.rb', '*.php', '*.php3', '*.php4', '*.php5', '*.phtml']
|
||
regex: '(?:\b(?:requests|httpx|axios)\.(?:get|post|put|patch|delete|head|options)|\b(?:fetch|urlopen|file_get_contents|fopen)|\burllib\.request\.urlopen|\bURI\.open)\s*\(\s*(?:(?:req|request)\.(?:query|body|params|args|GET)\b|\$_(?:GET|POST|REQUEST)\s*\[|params\s*\[|f["'']https?://\{|`https?://\$\{)'
|
||
|
||
- id: unsafe-deserialization-python
|
||
severity: HIGH
|
||
pattern: unsafe-deserialization
|
||
message: "Python pickle/marshal/dill deserialization can execute code with untrusted data"
|
||
files: ['*.py']
|
||
regex: '\b(?:pickle|marshal|dill)\.loads?\s*\('
|
||
|
||
- id: unsafe-deserialization-yaml
|
||
severity: HIGH
|
||
pattern: unsafe-deserialization
|
||
message: "Unsafe YAML loader or load call without an explicit SafeLoader/CSafeLoader"
|
||
files: ['*.py']
|
||
regex: '\byaml\.(?:load|load_all|unsafe_load|unsafe_load_all|full_load|full_load_all)\s*\('
|
||
|
||
- id: unsafe-deserialization-torch
|
||
severity: HIGH
|
||
pattern: unsafe-deserialization
|
||
message: "torch.load without explicit weights_only=True in this call"
|
||
files: ['*.py']
|
||
regex: '\btorch\.load\s*\('
|
||
|
||
- id: unsafe-deserialization-php
|
||
severity: HIGH
|
||
pattern: unsafe-deserialization
|
||
message: "PHP unserialize can instantiate objects from untrusted data"
|
||
files: ['*.php', '*.php3', '*.php4', '*.php5', '*.phtml']
|
||
regex: '(?i)\bunserialize\s*\('
|
||
|
||
- id: unsafe-deserialization-ruby
|
||
severity: HIGH
|
||
pattern: unsafe-deserialization
|
||
message: "Ruby Marshal.load/restore can execute code with untrusted data"
|
||
files: ['*.rb']
|
||
regex: '\bMarshal\.(?:load|restore)\s*\('
|
||
|
||
- id: unsafe-deserialization-js
|
||
severity: HIGH
|
||
pattern: unsafe-deserialization
|
||
message: "node-serialize dependency can deserialize executable values; review usage"
|
||
files: ['*.js', '*.ts']
|
||
regex: '(?:\brequire\s*\(\s*["'']node-serialize["'']\s*\)|\bfrom\s+["'']node-serialize["''])'
|
||
|
||
# File-level detector: thresholds and Markdown exemptions live in Go.
|
||
- id: whitespace-padding
|
||
severity: MEDIUM
|
||
pattern: whitespace-padding
|
||
message: "Padding may push instructions out of view; review context"
|