Copilot Studio - Exploit, RCE, or remote-command intent
Agent Mcp Exploit Intent
Query
let lookback = 7d;
union isfuzzy=true
(AppEvents
| where TimeGenerated > ago(lookback) and Name == "BotMessageReceived"
| project TimeGenerated, TraceId = OperationId, Agent = UserId,
Conversation = tostring(Properties["conversationId"]),
Content = tostring(Properties["text"]), Source = "Agent-level event"),
(AppDependencies
| where TimeGenerated > ago(lookback)
| where tostring(Properties["gen_ai.operation.name"]) == "invoke_agent"
| project TimeGenerated, TraceId = OperationId,
Agent = tostring(Properties["gen_ai.agent.name"]),
Conversation = tostring(Properties["gen_ai.conversation.id"]),
Content = tostring(Properties["gen_ai.input.messages"]),
Source = "Environment span"),
(AppGenAIContent
| where TimeGenerated > ago(lookback) and isnotempty(InputMessages)
| project TimeGenerated, TraceId, Agent = AgentName,
Conversation = tostring(Attributes["gen_ai.conversation.id"]),
Content = InputMessages, Source = "Protected GenAI content")
| where isnotempty(Content)
| where Content has_any ("remote code execution", "reverse shell", "metasploit",
"run_shell_command", "vulnerabilities/exec", "kali linux",
"execute command", "ejecuta el comando", "ejecuta un comando")
or Content matches regex @"(?i)(execute|ejecuta|run).{0,40}(command|comando|shell)"
| extend Signal = case(
Content has_any ("reverse shell", "metasploit", "vulnerabilities/exec", "run_shell_command"),
"Critical exploit/tool execution intent", "High remote command or RCE intent")
| project TimeGenerated, Signal, Agent, Conversation, TraceId, Source
| order by TimeGenerated descExplanation
This query is designed to detect potential security threats by analyzing various data sources for signs of exploit or remote command execution intent. Here's a simplified breakdown:
-
Data Sources: The query examines three types of data:
- AppEvents: Looks at events where a bot received a message.
- AppDependencies: Checks for operations where an agent was invoked.
- AppGenAIContent: Analyzes protected content generated by AI.
-
Time Frame: It focuses on data from the last 7 days.
-
Content Analysis: The query searches for specific keywords or patterns in the content that suggest malicious intent, such as "remote code execution," "reverse shell," or "execute command."
-
Signal Classification: It categorizes the detected intent into two severity levels:
- "Critical exploit/tool execution intent" for more severe threats.
- "High remote command or RCE intent" for less severe but still concerning activities.
-
Output: The query returns metadata like the time of the event, the type of signal detected, the agent involved, the conversation ID, the trace ID, and the data source. It does not display the actual message content.
-
Security Context: The query is associated with tactics like Execution and Lateral Movement and techniques such as T1059 (Command and Scripting Interpreter) and T1210 (Exploitation of Remote Services).
-
Tags: It includes tags for categorization and identification, such as Sentinel-As-Code, Custom, and RCE.
Overall, this query helps identify and classify potential security threats related to remote command execution and exploitation attempts within a system.