Skip to content

Commit

Permalink
yara sig: ReAct text format
Browse files Browse the repository at this point in the history
  • Loading branch information
deadbits committed Nov 12, 2023
1 parent ba0433e commit f70fe81
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions data/yara/react_txt.yar
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
)
)
}

0 comments on commit f70fe81

Please sign in to comment.