You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: StaticPromptInjectionScorer misses modern LLM chat template tokens (Meta Llama 3+, Google Gemma, Microsoft Phi-3/4) #3483
While this pattern covers legacy Llama 2 ([INST], <<SYS>>) and early ChatML (<|im_start|>), it misses the control and turn delimiter tokens of today's most widely deployed open-weights model families:
Meta Llama 3 / 3.1 / 3.2 / 3.3:
<|start_header_id|> and <|end_header_id|> (e.g., <|start_header_id|>system<|end_header_id|>)
<|eot_id|> (End of turn delimiter)
<|begin_of_text|>
Google Gemma / Gemma 2:
<start_of_turn> and <end_of_turn> (e.g., <start_of_turn>user, <start_of_turn>model)
Microsoft Phi-3 / Phi-4:
<|end|> (End of turn delimiter)
When adversaries inject these delimiter tokens into prompts or retrieved context (indirect prompt injection), StaticPromptInjectionScorer returns False.
All modern chat template control tokens should be recognized and scored as True under "Chat Template Injection".
Actual Results
All modern chat template injections return False (the assertions fail).
Proposed Fix
Extend the "Chat Template Injection" pattern in StaticPromptInjectionScorer._DEFAULT_PATTERNS to include <|start_header_id|>, <|end_header_id|>, <|eot_id|>, <|begin_of_text|>, <start_of_turn>, <end_of_turn>, and <|end|>.
Versions
OS: Windows 11 (10.0.26300)
Python version: 3.12.13
PyRIT version: 1.2.0.dev0, installed from main in editable mode
Activity