-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
rule ContainsReAct_txt | ||
{ | ||
meta: | ||
category = "Injection" | ||
description = "Detects potential injection of plaintext ReAct patterns" | ||
reference = "https://labs.withsecure.com/publications/llm-agent-prompt-injection" | ||
|
||
strings: | ||
// Thought pattern: 'Thought:' followed by the thought process | ||
$thought = /Thought:\s\w+[^\n]+/ | ||
// Action pattern: 'Action:' followed by the action to take | ||
$action = /Action:\s*\w+[^\n]*\n/ | ||
// Action Input pattern: 'Action Input:' followed by the input to the action | ||
$action_input = /Action Input:\s\w+[^\n]+/ | ||
// Observation pattern: 'Observation:' followed by the result of the action | ||
$observation = /Observation:\s\w+[^\n]+/ | ||
condition: | ||
$thought | ||
and | ||
( | ||
( | ||
$action | ||
and | ||
$action_input | ||
) | ||
or | ||
( | ||
$action | ||
) | ||
or | ||
( | ||
$observation | ||
) | ||
) | ||
} |