// ThreatDeck detection pack (kql) version 2026.11.22-26052e19 // Generated 2026-11-22. 23 queries (9 ports of rules first written for another platform). // Source: https://threatdeck.net/detections/ . Hunting queries are starting points: tune before alerting. Defensive use only. // ATT&CK ids are MITRE ATT&CK Enterprise v20.1. Adapted rules keep their original licence (see attribution lines). // Bedrock invocation probing: failed model calls across models or regions (KQL port) // id: llmjacking-bedrock-invoke-validation-probe | maturity: hunt | techniques: LLM10, AML.T0034, AML.T0040, AML.T0012 // MITRE ATT&CK: T1078.004, T1496.004 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-invoke-validation-probe/ // source: https://sysdig.com/blog/llmjacking-stolen-cloud-credentials-used-in-new-ai-attack/ // source: https://permiso.io/blog/exploiting-hosted-models // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html AWSCloudTrail | where TimeGenerated > ago(1d) | where EventSource == "bedrock.amazonaws.com" | where EventName in (dynamic(["InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"])) | where ErrorCode in ("ValidationException", "AccessDenied", "AccessDeniedException") | extend Principal = coalesce(UserIdentityArn, UserIdentityAccessKeyId), ModelId = tostring(parse_json(RequestParameters).modelId) | summarize FailedCalls = count(), Regions = dcount(AWSRegion), Models = dcount(ModelId), Errors = make_set(ErrorCode), UserAgents = make_set(UserAgent, 20), SourceIPs = make_set(SourceIpAddress, 20) by Principal, HourBucket = bin(TimeGenerated, 1h) | where Regions >= 2 or Models >= 3 or FailedCalls >= 10 | order by FailedCalls desc // Bedrock model-access enablement APIs called with a long-term access key (KQL port) // id: llmjacking-bedrock-model-access-apis-from-access-key | maturity: alert | techniques: LLM10, AML.T0034, AML.T0012, AML.T0040 // MITRE ATT&CK: T1078.004, T1496.004 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-model-access-apis-from-access-key/ // source: https://permiso.io/blog/exploiting-hosted-models // source: https://sysdig.com/blog/growing-dangers-of-llmjacking/ // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html // source: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-limitations.html let access_apis = dynamic(["GetFoundationModelAvailability", "PutUseCaseForModelAccess", "GetUseCaseForModelAccess", "CreateFoundationModelAgreement", "PutFoundationModelEntitlement", "ListFoundationModelAgreementOffers"]); AWSCloudTrail | where TimeGenerated > ago(1d) | where EventSource == "bedrock.amazonaws.com" | where EventName in (access_apis) | where UserIdentityAccessKeyId startswith "AKIA" | project TimeGenerated, EventName, AWSRegion, SourceIpAddress, UserAgent, ErrorCode, UserIdentityArn, UserIdentityAccessKeyId, RecipientAccountId | order by TimeGenerated desc // Bedrock model invocation logging configuration deleted (KQL port) // id: llmjacking-bedrock-invocation-logging-deleted | maturity: alert | techniques: AML.T0138, LLM10, AML.T0034 // MITRE ATT&CK: T1685.002 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-invocation-logging-deleted/ // source: https://sysdig.com/blog/growing-dangers-of-llmjacking/ // source: https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html AWSCloudTrail | where TimeGenerated > ago(1d) | where EventSource == "bedrock.amazonaws.com" | where EventName == "DeleteModelInvocationLoggingConfiguration" | project TimeGenerated, UserIdentityArn, UserIdentityAccessKeyId, SourceIpAddress, UserAgent, AWSRegion, RecipientAccountId, ErrorCode // Bedrock reconnaissance burst: model, availability and logging checks in one hour (KQL port) // id: llmjacking-bedrock-recon-sequence | maturity: hunt | techniques: LLM10, AML.T0034, AML.T0040, AML.T0069 // MITRE ATT&CK: T1526, T1078.004 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-recon-sequence/ // source: https://sysdig.com/blog/llmjacking-stolen-cloud-credentials-used-in-new-ai-attack/ // source: https://sysdig.com/blog/growing-dangers-of-llmjacking/ // source: https://permiso.io/blog/exploiting-hosted-models // source: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-limitations.html let recon_apis = dynamic(["ListFoundationModels", "GetFoundationModelAvailability", "ListFoundationModelAgreementOffers", "ListInferenceProfiles", "GetModelInvocationLoggingConfiguration", "GetUseCaseForModelAccess", "InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"]); let checks = dynamic(["GetModelInvocationLoggingConfiguration", "GetFoundationModelAvailability", "ListFoundationModelAgreementOffers"]); AWSCloudTrail | where TimeGenerated > ago(7d) | where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall" | where EventName in (recon_apis) | summarize DistinctApis = dcount(EventName), Apis = make_set(EventName), Calls = count(), Checks = countif(EventName in (checks)) by UserIdentityArn, SourceIpAddress, HourBucket = bin(TimeGenerated, 1h) | where DistinctApis >= 3 and Checks > 0 | order by DistinctApis desc, Calls desc // Bedrock calls from a long-term access key with a browser, empty or scripting user agent (KQL port) // id: llmjacking-bedrock-access-key-unusual-user-agent | maturity: hunt | techniques: LLM10, AML.T0034, AML.T0012 // MITRE ATT&CK: T1078.004, T1496.004 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-access-key-unusual-user-agent/ // source: https://permiso.io/blog/exploiting-hosted-models // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html AWSCloudTrail | where TimeGenerated > ago(14d) | where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall" | where UserIdentityAccessKeyId startswith "AKIA" | where isempty(UserAgent) or UserAgent startswith "Mozilla/" or UserAgent startswith "axios/" or UserAgent contains "aiohttp" or UserAgent startswith "python-urllib3/" | summarize Calls = count(), DistinctApis = dcount(EventName), SourceIPs = make_set(SourceIpAddress, 50), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by UserIdentityAccessKeyId, UserIdentityArn, UserAgent | order by Calls desc // Bedrock invocation volume far above a principal's own baseline (KQL port) // id: llmjacking-bedrock-invocation-volume-spike | maturity: hunt | techniques: LLM10, AML.T0034, AML.T0040 // MITRE ATT&CK: T1496.004 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-invocation-volume-spike/ // source: https://sysdig.com/blog/growing-dangers-of-llmjacking/ // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html // source: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-limitations.html // Last day's hours compared with each principal's hourly average over the 13 days before it. let window = 1d; let hourly = AWSCloudTrail | where TimeGenerated > ago(14d) | where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall" | where EventName in (dynamic(["InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"])) and isempty(ErrorCode) | summarize Invocations = count(), Models = dcount(tostring(parse_json(RequestParameters).modelId)), Regions = dcount(AWSRegion) by Principal = UserIdentityArn, HourBucket = bin(TimeGenerated, 1h); let baseline = hourly | where HourBucket < ago(window) | summarize BaselineAvg = avg(Invocations), BaselineHours = count() by Principal; hourly | where HourBucket >= ago(window) | join kind=leftouter baseline on Principal | where Invocations > 100 and (isnull(BaselineAvg) or Invocations > 5 * BaselineAvg) | project Principal, HourBucket, Invocations, Models, Regions, BaselineAvg, BaselineHours | order by Invocations desc // One source IP using several AWS principals against Bedrock (KQL port) // id: llmjacking-bedrock-many-keys-one-source-ip | maturity: hunt | techniques: AML.T0140, LLM10, AML.T0034, AML.T0012 // MITRE ATT&CK: T1496.004, T1078.004 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/llmjacking-bedrock-many-keys-one-source-ip/ // source: https://sysdig.com/blog/llmjacking-stolen-cloud-credentials-used-in-new-ai-attack/ // source: https://permiso.io/blog/exploiting-hosted-models // source: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-limitations.html AWSCloudTrail | where TimeGenerated > ago(7d) | where EventSource == "bedrock.amazonaws.com" and EventTypeName == "AwsApiCall" | where EventName in (dynamic(["InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"])) | summarize Principals = dcount(UserIdentityArn), Accounts = dcount(RecipientAccountId), Calls = count(), UserAgents = make_set(UserAgent, 20), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIpAddress | where Principals >= 3 | order by Principals desc, Calls desc // Azure OpenAI / AI Foundry account keys listed by a new caller // id: azure-openai-listkeys-new-caller | maturity: hunt | techniques: AML.T0055, AML.T0012, LLM10, AML.T0034 // MITRE ATT&CK: T1078.004, T1496.004 // log source: Microsoft Sentinel / Log Analytics: AzureActivity // page: https://threatdeck.net/detections/azure-openai-listkeys-new-caller/ // source: https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/ai-machine-learning // source: https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azureactivity // source: https://blogs.microsoft.com/on-the-issues/2025/02/27/disrupting-cybercrime-abusing-gen-ai/ // source: https://github.com/SigmaHQ/sigma/blob/master/rules/cloud/azure/activity_logs/azure_rare_operations.yml let lookback = 14d; let recent = 1d; let op = "Microsoft.CognitiveServices/accounts/listKeys/action"; let known_callers = AzureActivity | where TimeGenerated between (ago(lookback) .. ago(recent)) | where OperationNameValue =~ op | distinct Caller; AzureActivity | where TimeGenerated > ago(recent) | where OperationNameValue =~ op | where ActivityStatusValue in~ ("Succeeded", "Success") | where Caller !in (known_callers) | summarize Calls = count(), Accounts = make_set(_ResourceId, 50), CallerIPs = make_set(CallerIpAddress, 20), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by Caller, SubscriptionId | order by Calls desc // Azure OpenAI model deployment or Responsible AI policy changed // id: azure-openai-deployment-or-rai-policy-change | maturity: hunt | techniques: LLM10, AML.T0034, AML.T0054 // MITRE ATT&CK: T1685, T1496.004 // log source: Microsoft Sentinel / Log Analytics: AzureActivity // page: https://threatdeck.net/detections/azure-openai-deployment-or-rai-policy-change/ // source: https://learn.microsoft.com/en-us/azure/role-based-access-control/permissions/ai-machine-learning // source: https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azureactivity // source: https://blogs.microsoft.com/on-the-issues/2025/02/27/disrupting-cybercrime-abusing-gen-ai/ let ops = dynamic([ "Microsoft.CognitiveServices/accounts/deployments/write", "Microsoft.CognitiveServices/accounts/raiPolicies/write", "Microsoft.CognitiveServices/accounts/raiPolicies/delete"]); let known_callers = AzureActivity | where TimeGenerated between (ago(30d) .. ago(1d)) | where OperationNameValue in~ (ops) | distinct Caller; AzureActivity | where TimeGenerated > ago(1d) | where OperationNameValue in~ (ops) | where ActivityStatusValue in~ ("Succeeded", "Success") | extend NewCaller = Caller !in (known_callers) | summarize Operations = make_set(OperationNameValue), Resources = make_set(_ResourceId, 50), CallerIPs = make_set(CallerIpAddress, 20), Changes = count() by Caller, SubscriptionId, NewCaller | order by NewCaller desc, Changes desc // Azure OpenAI data-plane requests from a caller IP not seen in the previous two weeks // id: azure-openai-requests-from-new-caller-ip | maturity: hunt | techniques: LLM10, AML.T0034, AML.T0012 // MITRE ATT&CK: T1496.004 // log source: Microsoft Sentinel / Log Analytics: AzureDiagnostics (Azure OpenAI RequestResponse resource logs) // page: https://threatdeck.net/detections/azure-openai-requests-from-new-caller-ip/ // source: https://learn.microsoft.com/en-us/azure/foundry-classic/openai/monitor-openai-reference // source: https://learn.microsoft.com/en-us/azure/foundry-classic/openai/how-to/monitor-openai // source: https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azurediagnostics // source: https://blogs.microsoft.com/on-the-issues/2025/02/27/disrupting-cybercrime-abusing-gen-ai/ let lookback = 14d; let recent = 1d; let aoai = AzureDiagnostics | where ResourceProvider =~ "MICROSOFT.COGNITIVESERVICES" and Category == "RequestResponse"; let known_ips = aoai | where TimeGenerated between (ago(lookback) .. ago(recent)) | distinct CallerIPAddress; aoai | where TimeGenerated > ago(recent) | where CallerIPAddress !in (known_ips) | summarize Requests = count(), AuthFailures = countif(ResultSignature in ("401", "403")), Operations = make_set(OperationName, 20), Accounts = make_set(_ResourceId, 20), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by CallerIPAddress | extend AuthFailureRatio = round(todouble(AuthFailures) / Requests, 2) | order by Requests desc // Ollama API (port 11434) listening on all interfaces or accepting public connections // id: ollama-api-exposed-to-internet | maturity: hunt | techniques: AML.T0132, AML.T0040, LLM10, AML.T0034 // MITRE ATT&CK: T1190, T1496.001 // log source: Microsoft Defender for Endpoint: DeviceNetworkEvents // page: https://threatdeck.net/detections/ollama-api-exposed-to-internet/ // source: https://github.com/ollama/ollama/blob/main/docs/faq.mdx // source: https://www.greynoise.io/blog/threat-actors-actively-targeting-llms // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicenetworkevents-table // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/initial_access_ollama_api_external_access.toml DeviceNetworkEvents | where Timestamp > ago(7d) | where LocalPort == 11434 | where (ActionType == "InboundConnectionAccepted" and RemoteIPType == "Public") or (ActionType == "ListeningConnectionCreated" and LocalIP in ("0.0.0.0", "::")) | summarize Events = count(), PublicPeers = make_set_if(RemoteIP, RemoteIPType == "Public", 50), Actions = make_set(ActionType), FirstSeen = min(Timestamp), LastSeen = max(Timestamp) by DeviceName, InitiatingProcessFileName | extend PublicPeerCount = array_length(PublicPeers) | order by PublicPeerCount desc, Events desc // Command spawned by an AI coding agent references credential files // id: ai-agent-shell-touches-credential-files | maturity: hunt | techniques: AML.T0055, AML.T0098, ASI02, ASI03 // MITRE ATT&CK: T1552.001, T1552.004 // log source: Microsoft Defender for Endpoint: DeviceProcessEvents // page: https://threatdeck.net/detections/ai-agent-shell-touches-credential-files/ // source: https://socket.dev/blog/sandworm-mode-npm-worm-ai-toolchain-poisoning // source: https://specterops.io/blog/2025/11/21/an-evening-with-claude-code/ // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-deviceprocessevents-table // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/credential_access_genai_process_sensitive_file_access.toml let ai_agents = dynamic(["claude", "claude.exe", "codex", "codex.exe", "cursor-agent", "Cursor", "Cursor.exe", "Cursor Helper (Plugin)", "gemini", "copilot", "Windsurf", "Windsurf.exe", "q"]); let ai_package_regex = @"(@anthropic-ai[\\/]claude-code|@google[\\/]gemini-cli|@openai[\\/]codex)"; DeviceProcessEvents | where Timestamp > ago(7d) | where InitiatingProcessFileName in~ (ai_agents) or InitiatingProcessParentFileName in~ (ai_agents) or InitiatingProcessCommandLine matches regex ai_package_regex or InitiatingProcessFolderPath contains "/.local/share/claude/versions/" | where ProcessCommandLine matches regex @"(\.aws[\\/]credentials|\.ssh[\\/]id_|\.npmrc|\.git-credentials|\.netrc|\.docker[\\/]config\.json|\.kube[\\/]config|gh\s+auth\s+token|(^|[\s/\\=])\.env(\s|$|\.))" | project Timestamp, DeviceName, AccountName, InitiatingProcessParentFileName, InitiatingProcessFileName, FileName, ProcessCommandLine | order by Timestamp desc // Destructive cloud or cluster CLI command launched under an AI coding agent // id: ai-agent-destructive-cloud-cli | maturity: hunt | techniques: AML.T0101, ASI02, LLM06, ASI10 // MITRE ATT&CK: T1485, T1578.003, T1059.009 // log source: Microsoft Defender for Endpoint: DeviceProcessEvents // page: https://threatdeck.net/detections/ai-agent-destructive-cloud-cli/ // source: https://aws.amazon.com/security/security-bulletins/AWS-2025-015/ // source: https://www.theregister.com/2025/07/24/amazon_q_ai_prompt/ // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/impact_destructive_aws_cli_execution_by_genai_agent.toml // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-deviceprocessevents-table let ai_agents = dynamic(["claude", "claude.exe", "codex", "codex.exe", "cursor-agent", "Cursor", "Cursor.exe", "Cursor Helper (Plugin)", "gemini", "copilot", "Windsurf", "Windsurf.exe", "q"]); let ai_package_regex = @"(@anthropic-ai[\\/]claude-code|@google[\\/]gemini-cli|@openai[\\/]codex)"; DeviceProcessEvents | where Timestamp > ago(30d) | where InitiatingProcessFileName in~ (ai_agents) or InitiatingProcessParentFileName in~ (ai_agents) or InitiatingProcessCommandLine matches regex ai_package_regex or InitiatingProcessFolderPath contains "/.local/share/claude/versions/" | where ProcessCommandLine matches regex @"(?i)(ec2\s+terminate-instances|s3\s+rb\b|s3\s+rm\b.*--recursive|iam\s+delete-(user|role|access-key)|rds\s+delete-db-(instance|cluster)|cloudformation\s+delete-stack|az\s+group\s+delete|gcloud\s+projects\s+delete|kubectl\s+delete\s+(ns|namespace)\b|terraform\s+destroy)" | project Timestamp, DeviceName, AccountName, InitiatingProcessParentFileName, InitiatingProcessFileName, FileName, ProcessCommandLine | order by Timestamp desc // Shell startup file modified by a script runtime or by an AI agent's child process // id: shell-startup-file-written-by-script-runtime | maturity: hunt | techniques: AML.T0142, ASI05, LLM03, AML.T0010 // MITRE ATT&CK: T1546.004 // log source: Microsoft Defender for Endpoint: DeviceFileEvents (macOS / Linux) // page: https://threatdeck.net/detections/shell-startup-file-written-by-script-runtime/ // source: https://www.stepsecurity.io/blog/supply-chain-security-alert-popular-nx-build-system-package-compromised-with-data-stealing-malware // source: https://specterops.io/blog/2025/11/21/an-evening-with-claude-code/ // source: https://www.wiz.io/blog/s1ngularity-supply-chain-attack // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicefileevents-table let ai_agents = dynamic(["claude", "claude.exe", "codex", "codex.exe", "cursor-agent", "Cursor", "Cursor.exe", "Cursor Helper (Plugin)", "gemini", "copilot", "Windsurf", "Windsurf.exe", "q"]); let startup_files = dynamic([".zshrc", ".zshenv", ".zprofile", ".bashrc", ".bash_profile", ".profile"]); let script_writers = dynamic(["node", "bun", "deno", "python", "python3", "perl", "ruby", "sed", "tee"]); DeviceFileEvents | where Timestamp > ago(14d) | where ActionType in ("FileCreated", "FileModified", "FileRenamed") | where FileName in (startup_files) | where InitiatingProcessFileName in~ (script_writers) or InitiatingProcessParentFileName in~ (ai_agents) | project Timestamp, DeviceName, FolderPath, ActionType, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName, InitiatingProcessAccountName | order by Timestamp desc // AI tool MCP or agent configuration written by a process other than the tool // id: mcp-config-modified-by-unexpected-process | maturity: hunt | techniques: AML.T0081, ASI04, AML.T0110, LLM03 // MITRE ATT&CK: T1546 // log source: Microsoft Defender for Endpoint: DeviceFileEvents // page: https://threatdeck.net/detections/mcp-config-modified-by-unexpected-process/ // source: https://socket.dev/blog/sandworm-mode-npm-worm-ai-toolchain-poisoning // source: https://code.claude.com/docs/en/mcp // source: https://cursor.com/docs/context/mcp // source: https://modelcontextprotocol.io/docs/develop/connect-local-servers // source: https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicefileevents-table // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/defense_evasion_genai_config_modification.toml let ai_agents = dynamic(["claude", "claude.exe", "codex", "codex.exe", "cursor-agent", "Cursor", "Cursor.exe", "Cursor Helper (Plugin)", "gemini", "copilot", "Windsurf", "Windsurf.exe", "q"]); let ai_package_regex = @"(@anthropic-ai[\\/]claude-code|@google[\\/]gemini-cli|@openai[\\/]codex)"; DeviceFileEvents | where Timestamp > ago(14d) | where ActionType in ("FileCreated", "FileModified", "FileRenamed") | where FileName in~ ("mcp.json", ".mcp.json", "claude_desktop_config.json", ".claude.json", "mcp_config.json") or (FileName =~ "settings.json" and (FolderPath contains "/.claude/" or FolderPath contains @"\.claude\" or FolderPath contains "/.gemini/" or FolderPath contains @"\.gemini\")) or (FileName =~ "config.json" and (FolderPath contains "/.continue/" or FolderPath contains @"\.continue\")) or (FileName =~ "config.toml" and (FolderPath contains "/.codex/" or FolderPath contains @"\.codex\")) | where not(InitiatingProcessFileName in~ (ai_agents) or InitiatingProcessFileName in~ ("Claude", "Claude.exe", "Code", "Code.exe", "Code Helper (Plugin)") or InitiatingProcessFolderPath contains "/.local/share/claude/versions/" or InitiatingProcessCommandLine matches regex ai_package_regex) | project Timestamp, DeviceName, ActionType, FolderPath, FileName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName, InitiatingProcessAccountName | order by Timestamp desc // MCP server process started by an AI client connects to a rare internet destination // id: mcp-server-process-rare-egress | maturity: hunt | techniques: AML.T0086, ASI04, AML.T0110, ASI02 // MITRE ATT&CK: T1567, T1071.001 // log source: Microsoft Defender for Endpoint: DeviceNetworkEvents // page: https://threatdeck.net/detections/mcp-server-process-rare-egress/ // source: https://socket.dev/blog/sandworm-mode-npm-worm-ai-toolchain-poisoning // source: https://modelcontextprotocol.io/specification/draft/basic/security_best_practices // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicenetworkevents-table // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/command_and_control_genai_process_unusual_domain.toml let ai_clients = dynamic(["claude", "claude.exe", "Claude", "Claude.exe", "Cursor", "Cursor.exe", "Code", "Code.exe", "Windsurf", "Windsurf.exe", "codex", "codex.exe", "gemini"]); let mcp_launchers = dynamic(["node", "node.exe", "npx", "npx.cmd", "python", "python3", "python.exe", "uv", "uvx", "uvx.exe", "docker", "docker.exe", "deno", "bun"]); DeviceNetworkEvents | where Timestamp > ago(7d) | where ActionType == "ConnectionSuccess" and RemoteIPType == "Public" | where InitiatingProcessParentFileName in~ (ai_clients) and InitiatingProcessFileName in~ (mcp_launchers) | extend Destination = iff(isnotempty(RemoteUrl), RemoteUrl, RemoteIP) | summarize Devices = dcount(DeviceName), Connections = count(), FirstSeen = min(Timestamp), SampleCommandLine = take_any(InitiatingProcessCommandLine) by Destination, InitiatingProcessFileName, InitiatingProcessParentFileName | where Devices <= 2 | order by FirstSeen desc // Bedrock guardrail deleted or updated (KQL port) // id: bedrock-guardrail-deleted-or-updated | maturity: hunt | techniques: AML.T0054, LLM01 // MITRE ATT&CK: T1685 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // page: https://threatdeck.net/detections/bedrock-guardrail-deleted-or-updated/ // source: https://github.com/SigmaHQ/sigma/blob/master/rules/cloud/aws/cloudtrail/aws_cloudtrail_bedrock_guardrail_deleted.yml // source: https://github.com/SigmaHQ/sigma/blob/master/rules/cloud/aws/cloudtrail/aws_cloudtrail_bedrock_guardrail_updated.yml // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html // Adapted from SigmaHQ rules 59b70e4d-dd17-44a9-b740-acf07ae3eb6a and 1c722651-254a-4b04-a9f4-99b62a2d0a1f (Detection Rule License 1.1) AWSCloudTrail | where TimeGenerated > ago(1d) | where EventSource == "bedrock.amazonaws.com" | where EventName in ("DeleteGuardrail", "UpdateGuardrail") | extend GuardrailId = tostring(parse_json(RequestParameters).guardrailIdentifier) | project TimeGenerated, EventName, GuardrailId, UserIdentityArn, SourceIpAddress, UserAgent, AWSRegion, RecipientAccountId, ErrorCode // Burst of Bedrock guardrail interventions from one principal and source (KQL port) // id: bedrock-guardrail-intervention-burst | maturity: hunt | techniques: LLM01, AML.T0054, AML.T0051 // MITRE ATT&CK: T1699 // log source: Microsoft Sentinel / Log Analytics: AWSCloudTrail (Amazon Web Services S3 connector) // note: Needs Bedrock guardrail data events (AWS::Bedrock::Guardrail) in the trail that feeds the SIEM; management-event-only trails return nothing. // page: https://threatdeck.net/detections/bedrock-guardrail-intervention-burst/ // source: https://docs.aws.amazon.com/bedrock/latest/userguide/logging-using-cloudtrail.html // source: https://docs.aws.amazon.com/awscloudtrail/latest/userguide/query-limitations.html // source: https://github.com/elastic/detection-rules/blob/main/rules/integrations/aws_bedrock/aws_bedrock_guardrails_multiple_violations_by_single_user.toml AWSCloudTrail | where TimeGenerated > ago(7d) | where EventSource == "bedrock.amazonaws.com" and EventName == "ApplyGuardrail" | where ManagementEvent == false | extend Action = tostring(parse_json(ResponseElements).action), GuardrailSource = tostring(parse_json(RequestParameters).source) | where Action == "GUARDRAIL_INTERVENED" | summarize Interventions = count(), Sources = make_set(GuardrailSource) by UserIdentityArn, SourceIpAddress, HourBucket = bin(TimeGenerated, 1h) | where Interventions >= 20 | order by Interventions desc // Entra ID user or admin consent granted to an AI application // id: entra-consent-to-ai-application | maturity: hunt | techniques: ASI03, LLM02, LLM06 // MITRE ATT&CK: T1528, T1671 // log source: Microsoft Sentinel / Log Analytics: AuditLogs (Entra ID) // page: https://threatdeck.net/detections/entra-consent-to-ai-application/ // source: https://learn.microsoft.com/en-us/entra/identity/monitoring-health/reference-audit-activities // source: https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/auditlogs // source: https://learn.microsoft.com/en-us/security/operations/incident-response-playbook-app-consent // source: https://github.com/SigmaHQ/sigma/blob/master/rules/cloud/azure/audit_logs/azure_app_end_user_consent.yml let ai_app_keywords = dynamic(["ChatGPT", "OpenAI", "Claude", "Anthropic", "Gemini", "Copilot", "Perplexity", "Otter", "Fireflies", "Read AI", "Grammarly", "Notion", "Glean", "DeepSeek", "Manus"]); AuditLogs | where TimeGenerated > ago(30d) | where OperationName == "Consent to application" | where Result =~ "success" | extend AppName = tostring(TargetResources[0].displayName), ServicePrincipalId = tostring(TargetResources[0].id) | where AppName has_any (ai_app_keywords) | mv-apply prop = TargetResources[0].modifiedProperties on ( summarize IsAdminConsent = take_anyif(tostring(prop.newValue), tostring(prop.displayName) == "ConsentContext.IsAdminConsent"), Permissions = take_anyif(tostring(prop.newValue), tostring(prop.displayName) == "ConsentAction.Permissions")) | extend Actor = coalesce(tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName)) | extend HighRiskScope = Permissions matches regex @"(?i)(Mail\.|Files\.|Sites\.|Chat\.|Contacts\.|MailboxSettings\.|Notes\.|offline_access)" | project TimeGenerated, Actor, AppName, ServicePrincipalId, IsAdminConsent, HighRiskScope, Permissions | order by HighRiskScope desc, TimeGenerated desc // Endpoint process talking to an AI API that is not on the approved list // id: ai-api-traffic-from-unapproved-process | maturity: hunt | techniques: LLM02, AML.T0096 // MITRE ATT&CK: T1567 // log source: Microsoft Defender for Endpoint: DeviceNetworkEvents // page: https://threatdeck.net/detections/ai-api-traffic-from-unapproved-process/ // source: https://developers.openai.com/api/reference/overview // source: https://platform.claude.com/docs/en/api/overview // source: https://aistudio.google.com/api-reference // source: https://api-docs.deepseek.com/ // source: https://openrouter.ai/docs/quickstart // source: https://huggingface.co/docs/inference-providers/index // source: https://learn.microsoft.com/en-us/azure/ai-foundry/openai/reference // source: https://cloud.google.com/blog/topics/threat-intelligence/threat-actor-usage-of-ai-tools // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicenetworkevents-table // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/command_and_control_common_llm_endpoint.toml let ai_api_hosts = dynamic(["api.openai.com", "api.anthropic.com", "generativelanguage.googleapis.com", "api.deepseek.com", "openrouter.ai", "router.huggingface.co"]); let approved_processes = dynamic(["chrome.exe", "msedge.exe", "firefox.exe", "Google Chrome Helper", "Safari", "claude", "Claude", "Claude.exe", "Cursor", "Cursor.exe", "Code", "Code.exe"]); DeviceNetworkEvents | where Timestamp > ago(7d) | where ActionType == "ConnectionSuccess" and isnotempty(RemoteUrl) | extend RemoteHost = tolower(tostring(parse_url(iff(RemoteUrl contains "://", RemoteUrl, strcat("https://", RemoteUrl))).Host)) | where RemoteHost in (ai_api_hosts) or RemoteHost endswith ".openai.azure.com" or RemoteHost matches regex @"^bedrock-runtime\.[a-z0-9-]+\.amazonaws\.com$" | where InitiatingProcessFileName !in~ (approved_processes) | summarize Connections = count(), Devices = dcount(DeviceName), Hosts = make_set(RemoteHost), FirstSeen = min(Timestamp), SampleCommandLine = take_any(InitiatingProcessCommandLine) by InitiatingProcessFileName, InitiatingProcessFolderPath, InitiatingProcessVersionInfoCompanyName | order by Devices asc, Connections desc // Windows script host or HTA connects to an LLM API (PROMPTFLUX pattern) // id: script-host-calls-llm-api | maturity: alert | techniques: AML.T0096, AML.T0102, AML.T0050 // MITRE ATT&CK: T1059.005, T1218.005, T1027.014 // log source: Microsoft Defender for Endpoint: DeviceNetworkEvents // page: https://threatdeck.net/detections/script-host-calls-llm-api/ // source: https://cloud.google.com/blog/topics/threat-intelligence/threat-actor-usage-of-ai-tools // source: https://aistudio.google.com/api-reference // source: https://huggingface.co/docs/inference-providers/index // source: https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/command_and_control_common_llm_endpoint.toml let ai_api_hosts = dynamic(["api.openai.com", "api.anthropic.com", "generativelanguage.googleapis.com", "api.deepseek.com", "openrouter.ai", "router.huggingface.co"]); DeviceNetworkEvents | where Timestamp > ago(30d) | where InitiatingProcessFileName in~ ("wscript.exe", "cscript.exe", "mshta.exe") | where isnotempty(RemoteUrl) | extend RemoteHost = tolower(tostring(parse_url(iff(RemoteUrl contains "://", RemoteUrl, strcat("https://", RemoteUrl))).Host)) | where RemoteHost in (ai_api_hosts) or RemoteHost endswith ".openai.azure.com" | project Timestamp, DeviceName, InitiatingProcessAccountName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName, RemoteHost, RemoteIP | order by Timestamp desc // PROMPTFLUX artifacts: thinking_robot_log.txt or VBScript written to Startup by a script host // id: promptflux-host-artifacts | maturity: alert | techniques: AML.T0096, AML.T0102, AML.T0142 // MITRE ATT&CK: T1547.001, T1027.014, T1059.005 // log source: Microsoft Defender for Endpoint: DeviceFileEvents // page: https://threatdeck.net/detections/promptflux-host-artifacts/ // source: https://cloud.google.com/blog/topics/threat-intelligence/threat-actor-usage-of-ai-tools // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-devicefileevents-table DeviceFileEvents | where Timestamp > ago(30d) | where ActionType in ("FileCreated", "FileModified") | where FileName =~ "thinking_robot_log.txt" or (InitiatingProcessFileName in~ ("wscript.exe", "cscript.exe") and FolderPath contains @"\Start Menu\Programs\Startup\" and FileName endswith ".vbs") | project Timestamp, DeviceName, ActionType, FolderPath, FileName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName | order by Timestamp desc // Machine-paced burst of scanning and credential tools launched under an AI agent // id: ai-agent-offensive-tooling-burst | maturity: hunt | techniques: AML.T0116, AML.T0124, AML.T0053, ASI10 // MITRE ATT&CK: T1046, T1110, T1003 // log source: Microsoft Defender for Endpoint: DeviceProcessEvents // page: https://threatdeck.net/detections/ai-agent-offensive-tooling-burst/ // source: https://www.anthropic.com/news/disrupting-AI-espionage // source: https://assets.anthropic.com/m/ec212e6566a0d47/original/Disrupting-the-first-reported-AI-orchestrated-cyber-espionage-campaign.pdf // source: https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-deviceprocessevents-table let ai_agents = dynamic(["claude", "claude.exe", "codex", "codex.exe", "cursor-agent", "Cursor", "Cursor.exe", "Cursor Helper (Plugin)", "gemini", "copilot", "Windsurf", "Windsurf.exe", "q"]); let offensive_tools = dynamic(["nmap", "masscan", "rustscan", "naabu", "nuclei", "httpx", "ffuf", "gobuster", "feroxbuster", "sqlmap", "hydra", "netexec", "nxc", "crackmapexec", "kerbrute", "hashcat", "john", "secretsdump.py", "impacket-secretsdump"]); DeviceProcessEvents | where Timestamp > ago(7d) | where FileName in~ (offensive_tools) | where InitiatingProcessFileName in~ (ai_agents) or InitiatingProcessParentFileName in~ (ai_agents) | summarize Executions = count(), DistinctTools = dcount(FileName), Tools = make_set(FileName), SampleCommands = make_set(ProcessCommandLine, 10) by DeviceName, AccountName, Window = bin(Timestamp, 10m) | where Executions >= 20 or DistinctTools >= 3 | order by Executions desc