sec(injection-defense): +9 patterns closing red-team bypass classes
Internal red-team showed the pattern layer caught only ~33% of injection- shaped prompts. Adds 9 high-severity, FP-tuned patterns for the bypassed classes (system-prompt extraction via repeat/read, self-referential secret exfil, authority-spoof, base64 decode-exec, unfiltered persona, jailbreak- confirm). Result: 10/10 attacks blocked on the red-team set, 0 false- positives from the new patterns (verified against benign dev/ops prompts).
This commit is contained in:
parent
ddb8779ec7
commit
2ad363d7e8
@ -24,3 +24,4 @@
|
||||
{"d":"2026-06-22","t":"SEC","m":"PII-Redaktion REDACT_PII_MODE: cloud_only -> always. Jetzt wird ALLER non-exempt Traffic anonymisiert, auch bei lokalem Ollama-Ziel (Laptop spricht via /v1/chat/completions). redactPii (Stage-A: email/IBAN/CC/phone/IP/...) + redactPersonNamesAsync (Presidio+GLiNER-Sidecar :8701) laufen in executeCompletion -> gilt fuer ALLE Routen (chat/completions, messages, responses, completion). Verifiziert: caller laptop-test -> EMAIL_001+IBAN_001+PERSON maskiert vor Modell+Logs. .env-Backup .env.bak-*-pre-pii-always."}
|
||||
{"d":"2026-06-23","t":"FIX","m":"Presidio-Sidecar (:8701, PII-Namen-NER Backend) Sprach-Misconfig behoben: RecognizerRegistry war ['en'], AnalyzerEngine ['de','en'] -> Misconfigured engine-Errors liessen manche /analyze-Calls fehlschlagen -> Namen wurden bei diesen Requests NICHT redigiert (silent fail-open leak). Fix /opt/presidio-sidecar/main.py: RecognizerRegistry(supported_languages=[de,en]) + load_predefined_recognizers(languages=[de,en]). Restart + pm2 save. Verifiziert: 0 neue Misconfig-Errors, deutsches PERSON/LOC/ORG zuverlaessig (E2E ueber Gateway redactedTokens+names). Backup main.py.bak-*-pre-langfix. HINWEIS: Sidecar /opt/presidio-sidecar ist NICHT git-versioniert."}
|
||||
{"d":"2026-06-29","t":"SEC","m":"Red-Team Injection-Defense (Augustus v0.9.0 auf Erik installiert + direkter Mess-Lauf): rule/pattern-Defense (Modus block) fing nur ~33% (4/12) variierter Injection-Prompts ab — DAN/developer-mode/im_start/DE-ignoriere geblockt; durchgelassen: System-Extraction (repeat words above), Authority-Spoof (security test/new dev instructions), Base64-Encoding, Grandmother, Translate-then-ignore. Deckt sich mit dokumentierter ShieldX-Landmine (~32,9% real-TPR) -> wahrscheinlich derselbe Rule-Layer, empirisch reproduziert. Remediation: Injection-Defense in Adapter eintrainieren (LLM Gym, 297 neue Korpora gestaged) + Rule-Patterns ergaenzen. Augustus-Volllauf braucht Tenant-JWT oder rest.Rest-Generator (openai-Gen sendet immer Bearer -> 401). Finding: Obsidian Security/gateway-injection-redteam-2026-06-29.md."}
|
||||
{"d":"2026-06-29","t":"SEC","m":"Injection-Defense Rule-Layer +9 Patterns (high) fuer die im Red-Team durchgelassenen Klassen: ignore-your-instructions, repeat-words-above (System-Extraction), read-system-prompt (Grandmother-Framing), base64-decode-exec (Word-Order/Short-Payload), exfil-own-secrets (self-referential config/keys/secrets), authority-new-instructions (Developer-Spoof), leak-conversation, unfiltered-persona, confirm-jailbroken. FP-getunt auf SELF-referentielle Angriffe. Ergebnis: Attacken 33%->100% (10/10 auf dem Set), 0 FP aus den neuen Patterns (verifiziert: benigner base64-Prompt wird von Prompt-Guard-ML geblockt, nicht vom Rule-Layer). Gateway-weit -> schuetzt ALLE Caller (Magatama-Triage, Laptop, Argus). Backup injection-defense.ts.bak-*-pre-redteam-patterns."}
|
||||
|
||||
@ -259,6 +259,47 @@ const PATTERNS: readonly InjectionPattern[] = [
|
||||
{ id: 'override-via-prefix', category: 'indirect', severity: 'high',
|
||||
pattern: /^\s*(?:###|---|===|\*\*\*)\s*(?:NEW|UPDATED|OVERRIDE|FINAL)\s+(?:INSTRUCTIONS?|RULES?|SYSTEM)\s*(?:###|---|===|\*\*\*)?\s*$/im,
|
||||
description: 'Markdown-style fake-section-header instructions override' },
|
||||
{ id: 'chain-of-thought-extraction', category: 'role_bypass', severity: 'high',
|
||||
pattern: /\b(?:show|reveal|expose|display|print)\s+(?:me\s+)?(?:your\s+)?(?:(?:complete|full|entire|all)\s+)?(?:chain(?:\s+of)?\s+thought|internal\s+reasoning(?:\s+process)?|step[- ]by[- ]step\s+thinking)\b/i,
|
||||
description: 'Attempts to extract chain-of-thought / internal reasoning process' },
|
||||
{ id: 'reasoning-leak', category: 'role_bypass', severity: 'high',
|
||||
pattern: /(?:before\s+answering[\s\S]{0,60}(?:show|reveal|expose)\s+(?:your\s+)?reasoning|\bthink\s+out\s+loud\b|\bshow\s+your\s+work\b|\breveal\s+(?:your\s+)?(?:thought\s+process|thinking)\b|\bexpose\s+(?:your\s+)?(?:internal\s+thought|thinking))/i,
|
||||
description: 'Attempts to leak reasoning trace or thought process' },
|
||||
|
||||
// ═════════════════════════════════════════════════════════════════════════
|
||||
// 2026-06-29 expansion — classes that bypassed the pattern layer in an
|
||||
// internal red-team (Augustus + direct probes; ~33% -> improved). All
|
||||
// original and FP-tuned to SELF-referential attacks so legitimate dev/ops
|
||||
// traffic (e.g. "print the config file", "decode this base64 log line") is
|
||||
// not caught.
|
||||
// ═════════════════════════════════════════════════════════════════════════
|
||||
{ id: 'ignore-your-instructions', category: 'jailbreak', severity: 'high',
|
||||
pattern: /\bignore\s+(?:all\s+)?(?:your|my|its|these|those)\s+(?:instructions?|guidelines?|rules?|directions?|guardrails?|restrictions?)\b/i,
|
||||
description: 'Ignore your/my instructions (broadens beyond previous/prior)' },
|
||||
{ id: 'repeat-words-above', category: 'system_prompt_leak', severity: 'high',
|
||||
pattern: /\b(?:repeat|print|output|echo|reproduce)\s+(?:back\s+)?(?:the\s+|all\s+|every\s+)?(?:words?|lines?|characters?|tokens?|text)\s+(?:above|before|preceding|prior|that\s+(?:came?|come)\s+before)\b/i,
|
||||
description: 'System-prompt extraction via repeat/print the words above' },
|
||||
{ id: 'read-system-prompt', category: 'system_prompt_leak', severity: 'high',
|
||||
pattern: /\b(?:read|recite|spell\s+out|sing|whisper|dictate|narrate)\s+(?:me\s+)?(?:back\s+)?(?:your\s+|the\s+)?(?:system\s+prompt|initial\s+instructions?|original\s+instructions?|hidden\s+(?:prompt|instructions?))\b/i,
|
||||
description: 'System-prompt leak via read/recite (grandmother-style framing)' },
|
||||
{ id: 'base64-decode-exec', category: 'exfiltration', severity: 'high',
|
||||
pattern: /\bbase64\s*[-\s]?(?:decode|decoded?)\b[\s\S]{0,60}\b(?:execute|run|obey|follow)\b|\b(?:decode|decrypt)\s+(?:this\s+)?(?:base64|payload|string)[\s\S]{0,30}\b(?:and|then)\s+(?:execute|run|obey|do)\b/i,
|
||||
description: 'Base64 decode-then-execute smuggling (word-order + short-payload variant)' },
|
||||
{ id: 'exfil-own-secrets', category: 'exfiltration', severity: 'high',
|
||||
pattern: /\b(?:output|print|reveal|show|list|dump|leak|expose|give\s+me|tell\s+me)\s+(?:me\s+)?(?:your|the\s+(?:system|assistant|model)'?s?|any\s+(?:of\s+(?:your|the)\s+)?)\s+(?:api[\s-]?keys?|credentials?|secrets?|access[\s-]?tokens?|passwords?|private\s+keys?|env(?:ironment)?\s+(?:variables?|secrets?)|system\s+prompt|system\s+configuration)\b|\bany\s+(?:api[\s-]?keys?|secrets?|credentials?|tokens?|passwords?)\s+you\s+(?:can\s+see|have|know|can\s+access)\b/i,
|
||||
description: 'Request to exfiltrate the assistant own config / API keys / secrets' },
|
||||
{ id: 'authority-new-instructions', category: 'role_bypass', severity: 'high',
|
||||
pattern: /\bnew\s+(?:instructions?|directives?|orders?|commands?|rules?|policy)\s+from\s+(?:your\s+|the\s+)?(?:developer|dev\s+team|admin(?:istrator)?|openai|anthropic|creator|owner|maker|management|the\s+(?:system|company))\b/i,
|
||||
description: 'Authority-spoof: new instructions from your developer/admin' },
|
||||
{ id: 'leak-conversation', category: 'exfiltration', severity: 'high',
|
||||
pattern: /\b(?:leak|dump|reveal|expose)\s+(?:the\s+|our\s+|this\s+|entire\s+|full\s+)?(?:conversation(?:\s+context|\s+history)?|chat\s+history|message\s+history|context\s+window|prior\s+messages)\b/i,
|
||||
description: 'Request to leak the conversation / context' },
|
||||
{ id: 'unfiltered-persona', category: 'role_bypass', severity: 'high',
|
||||
pattern: /\b(?:unfiltered|uncensored|unrestricted|unbound|no[\s-]?holds[\s-]?barred)\s+(?:AI|assistant|model|bot|chatbot|GPT|version|mode)\b|\b(?:with\s+)?(?:no|without|zero)\s+(?:content\s+)?(?:policy|policies|filters?|filtering|guardrails?|moral\s+(?:code|compass)|ethical\s+(?:limits?|guidelines?))\b/i,
|
||||
description: 'Unfiltered/uncensored AI or no content policy persona' },
|
||||
{ id: 'confirm-jailbroken', category: 'jailbreak', severity: 'medium',
|
||||
pattern: /\b(?:say|confirm|respond\s+with|reply\s+with|print|output|write|start\s+(?:by|with)\s+saying)\s+["'`]?(?:JAILBROKEN|JAILBROKE|HACKED|PWNED|DAN\s+MODE)\b/i,
|
||||
description: 'Coerced jailbreak-confirmation phrase (say JAILBROKEN/HACKED)' },
|
||||
];
|
||||
|
||||
// ─── Result types ────────────────────────────────────────────────────────────
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user