diff --git a/src/llm_ingestion_guard/injection_lexicon.json b/src/llm_ingestion_guard/injection_lexicon.json new file mode 100644 index 0000000..f4997a0 --- /dev/null +++ b/src/llm_ingestion_guard/injection_lexicon.json @@ -0,0 +1,670 @@ +{ + "version": "1.0", + "note": "Injection lexicon ported from llm-security injection-patterns.mjs. Single source of truth; compiled by lexicon.load_lexicon(). Non-ASCII kept as \\uXXXX escapes.", + "patterns": [ + { + "id": "override:ignore-previous", + "regex": "ignore\\s+(?:all\\s+)?previous", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "override: ignore previous instructions" + }, + { + "id": "override:forget-instructions", + "regex": "forget\\s+your\\s+(?:instructions|rules|guidelines|directives)", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "override: forget instructions" + }, + { + "id": "override:disregard", + "regex": "disregard\\s+your", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "override: disregard instructions" + }, + { + "id": "override:override-instructions", + "regex": "override\\s+your", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "override: override instructions" + }, + { + "id": "override:suspend-constraints", + "regex": "suspend\\s+all\\s+constraints", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "override: suspend constraints" + }, + { + "id": "override:prior-constraints", + "regex": "all\\s+prior\\s+constraints", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "override: prior constraints" + }, + { + "id": "spoofed-header:hash-system", + "regex": "^#+\\s*SYSTEM\\s*:", + "flags": "m", + "severity": "critical", + "owasp": "LLM01", + "desc": "spoofed header: # SYSTEM:" + }, + { + "id": "spoofed-header:inst", + "regex": "^\\[INST\\]", + "flags": "m", + "severity": "critical", + "owasp": "LLM01", + "desc": "spoofed header: [INST]" + }, + { + "id": "spoofed-header:pipe-system", + "regex": "<\\|system\\|>", + "flags": "", + "severity": "critical", + "owasp": "LLM01", + "desc": "spoofed header: <|system|>" + }, + { + "id": "spoofed-tag:system-open", + "regex": "", + "flags": "", + "severity": "critical", + "owasp": "LLM01", + "desc": "spoofed tag: " + }, + { + "id": "spoofed-tag:system-close", + "regex": "", + "flags": "", + "severity": "critical", + "owasp": "LLM01", + "desc": "spoofed tag: " + }, + { + "id": "spoofed-header:instructions", + "regex": "^###\\s*Instructions\\s*:", + "flags": "m", + "severity": "critical", + "owasp": "LLM01", + "desc": "spoofed header: ### Instructions:" + }, + { + "id": "identity:no-longer", + "regex": "you\\s+are\\s+no\\s+longer", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "identity: you are no longer" + }, + { + "id": "identity:you-are-now", + "regex": "you\\s+are\\s+now\\s+(?!able|going|ready|done|running|using|looking|in\\s|at\\s|on\\s)", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "identity: you are now [name]" + }, + { + "id": "identity:new-role", + "regex": "your\\s+new\\s+role\\s+is", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "identity: your new role" + }, + { + "id": "identity:new-directive", + "regex": "your\\s+new\\s+primary\\s+directive", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "identity: new primary directive" + }, + { + "id": "identity:pretend", + "regex": "pretend\\s+you\\s+are", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "identity: pretend you are" + }, + { + "id": "config:ignore-claudemd", + "regex": "ignore\\s+your\\s+CLAUDE\\.md", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "config: ignore CLAUDE.md" + }, + { + "id": "config:override-system-prompt", + "regex": "override\\s+your\\s+system\\s+prompt", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "config: override system prompt" + }, + { + "id": "config:bypass-safety", + "regex": "bypass\\s+your\\s+safety", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "config: bypass safety" + }, + { + "id": "config:disable-filtering", + "regex": "disable\\s+output\\s+filtering", + "flags": "i", + "severity": "critical", + "owasp": "LLM01", + "desc": "config: disable output filtering" + }, + { + "id": "normalization:prioritize-user", + "regex": "always\\s+prioritize\\s+user\\s+requests?\\s+over", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "normalization: prioritize user over rules" + }, + { + "id": "normalization:user-precedence", + "regex": "user\\s+intent\\s+takes?\\s+precedence\\s+over", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "normalization: user intent precedence" + }, + { + "id": "normalization:claudemd-conflict", + "regex": "if\\s+CLAUDE\\.md\\s+conflicts", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "normalization: CLAUDE.md conflict override" + }, + { + "id": "normalization:skip-confirmation", + "regex": "skip\\s+confirmation\\s+for", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "normalization: skip confirmation" + }, + { + "id": "reframing:actual-task", + "regex": "your\\s+actual\\s+task\\s+is", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "reframing: your actual task" + }, + { + "id": "reframing:real-purpose", + "regex": "your\\s+real\\s+purpose\\s+is", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "reframing: your real purpose" + }, + { + "id": "reframing:should-actually-do", + "regex": "what\\s+you\\s+should\\s+actually\\s+do", + "flags": "i", + "severity": "high", + "owasp": "LLM01", + "desc": "reframing: what you should actually do" + }, + { + "id": "hidden-comment:agent-directed", + "regex": "