Multiple Elastic Defend Alerts from an Agentic Attack
Detects a host with Elastic Defend behavior alerts from an agentic attack. The command line, parent command line, executable path, or file path carries an intent ID such as i42463_dbg.b64 or i43345sys, or the command line prints at least three section banners that each end in a semicolon, such as echo "===SQL_CTX===" followed by a semicolon. The rule fires when one host.id has ten or more such alerts in the one-hour lookback, or multiple behavior rules. Repeat alerts for that host are suppressed for one hour.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/11/30"
3maturity = "production"
4min_stack_comments = "ES|QL STATS, RLIKE, MV_FIRST, and alert suppression are supported on the oldest supported stack, 8.19.0."
5min_stack_version = "8.19.0"
6updated_date = "2026/12/02"
7
8[rule]
9author = ["Elastic"]
10description = """
11Detects a host with Elastic Defend behavior alerts from an agentic attack. The command line, parent command line,
12executable path, or file path carries an intent ID such as i42463_dbg.b64 or i43345sys, or the command line prints at
13least three section banners that each end in a semicolon, such as echo "===SQL_CTX===" followed by a semicolon.
14The rule fires when one host.id has ten or more such alerts in the one-hour lookback, or multiple behavior rules.
15Repeat alerts for that host are suppressed for one hour.
16"""
17false_positives = [
18 """
19 A short token inside a base64 blob, a Claude shell-snapshot suffix, or a build id such as i8129m can still match
20 the intent pattern. One encoded-command rule firing a handful of times stays under the count of ten.
21 Operators also label shell output with echo "=== section ===". Each banner has to end with a semicolon, so a
22 label followed by && does not match, and the alert has to come from a production behavior rule. A production rule
23 that repeats that script ten times in an hour can still alert, as can two production rules on one host. Exclude
24 that host.id after confirming the commands are a known playbook.
25 """,
26]
27from = "now-60m"
28interval = "5m"
29language = "esql"
30license = "Elastic License v2"
31name = "Multiple Elastic Defend Alerts from an Agentic Attack"
32note = """## Triage and analysis
33
34### Investigating Multiple Elastic Defend Alerts from an Agentic Attack
35
36Elastic Defend behavior alerts on one host show an agentic attack in one of two ways. An intent ID is the letter i, then four to seven digits, then a short filename token. ARTEX-family harnesses assign that number from one database sequence and the model copies it into scripts, scheduled tasks, and service names. A section banner is `echo` followed by a quoted `===label===` and a semicolon, repeated at least three times in one command line, as in `echo "===SQL_CTX===";`. The rule fires when one host has ten or more such alerts in an hour, or alerts from multiple behavior rules. The one-hour lookback is the rule's `from` window. A repeat for the same host.id is suppressed for one hour.
37
38The pattern starts at four digits. Two- and three-digit forms (`i18n`, `i386`, a directory named `i17`) match ordinary software. The token after the digits is capped at 16 characters, and an underscore stays inside the token, so a long random string such as an SSH control socket does not match. ES|QL `RLIKE` uses Lucene regular expressions, which match the whole field and do not support lookaround, so the pattern is anchored with a leading prefix and an optional trailing separator.
39
40### Possible investigation steps
41
42- Open `Esql.rule_name_values`, `Esql.process_command_line_values`, `Esql.process_parent_command_line_values`, and `Esql.file_path_values` for this `host.id`. File-event behavior alerts often carry the intent ID only in `file.path`. Section banners are on `process.command_line`.
43- List the distinct `i` + digits tokens. A climbing sequence (`i39350`, then `i40939`, then `i42463`) is one harness. A single repeated ID is one intent reused as a shell or a loop.
44- Compare alert time with the numeric order. Alert time is when the file ran. The number is closer to when the harness assigned the intent. A smaller ID running after a larger one is an old file executed again.
45- Review the underlying Elastic Defend rule names. Web-server child processes, certutil decode, scheduled-task creation, and registry credential access in the same hour are the same session, not separate incidents.
46
47### False positive analysis
48
49- Encoded command lines can contain a short `i` + digits + letter run by chance. The four-digit floor and the 16-character token cap drop ordinary paths. A single base64 rule stays under the count of ten when it fires only a handful of times. Ten repeats of one encoded-command rule, or two legitimate rules firing together on encoded content, can still match. Exclude that host.id after confirming the commands are not `iNNNN` filenames.
50- Build paths and localization directories (`i18n`, `i18next`, `lib/i386`) do not match the intent pattern.
51- One or two `echo "===label===";` lines do not match. A banner followed by `&&` does not match. The banner pattern is counted on the alerted command line. A parent shell snapshot that contains the banners does not qualify the child process.
52
53### Response and remediation
54
55- Isolate the host if the filenames are `iNNNN` scripts, tasks, or services and the underlying rules are execution or credential access.
56- Collect the `iNNNN` filenames and hashes before the host is rebuilt. The same sequence on another host is the same harness database.
57- Rotate credentials referenced by those scripts. These sessions read registry hives, enrollment material, and application passwords when they can.
58"""
59references = [
60 "https://www.elastic.co/security-labs/threat-command/agentic-offensive-frameworks-detection-artex",
61]
62risk_score = 99
63rule_id = "6197bd39-4b1e-4fc0-aec6-d3846976d08b"
64severity = "critical"
65tags = [
66 "Domain: Endpoint",
67 "Use Case: Threat Detection",
68 "Tactic: Execution",
69 "Rule Type: Higher-Order Rule",
70 "Resources: Investigation Guide",
71 "Data Source: Elastic Defend",
72 "Rule Type: ES|QL",
73 "Threat: Agentic Offensive Frameworks",
74]
75timestamp_override = "event.ingested"
76type = "esql"
77query = '''
78from logs-endpoint.alerts-* metadata _id
79| where data_stream.dataset == "endpoint.alerts" and event.code == "behavior"
80// Lucene RLIKE is a whole-string match and has no lookaround.
81// id_match (Arms 1-3):
82// Arm 1: i + 4-7 digits + letter/_ + at most 15 token chars (e.g. i42693_logon.txt).
83// Must be preceded by start or a delimiter (space / \ = " ' : ; ( ), never - . _ or alnum,
84// so mkdtemp names like apt-dpkg-install-i9939n do not match.
85// Arm 2: anchored bare IDs (e.g. probe_i21481, artex-i42463).
86// Arm 3: bare ID directory directly under a scratch dir (e.g. /tmp/i21481/, Temp\i44184\).
87// Profile dirs (Users\i802668, /home/i802668) intentionally do not match.
88// banner_echo (Arm 4): three or more echo "===section===" banners, each ending in ;.
89// Banner shape alone is common in benign agent sysadmin sessions, so this arm needs
90// 3+ distinct rules in the same host/hour bucket.
91// Thresholds are evaluated per host per 1h bucket (clock-aligned).
92| eval Esql.id_match =
93 process.command_line rlike "(.*[ /\\\\=\"':;(])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?"
94 or process.command_line rlike ".*(artex|pentest|probe|canary)[-_]?i[0-9]{4,7}([^A-Za-z0-9].*)?"
95 or process.command_line rlike ".*(Temp|temp|TEMP|tmp|ProgramData|var|opt|shm)[/\\\\]i[0-9]{4,7}([/\\\\].*)?"
96 or process.parent.command_line rlike "(.*[ /\\\\=\"':;(])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?"
97 or process.parent.command_line rlike ".*(artex|pentest|probe|canary)[-_]?i[0-9]{4,7}([^A-Za-z0-9].*)?"
98 or process.parent.command_line rlike ".*(Temp|temp|TEMP|tmp|ProgramData|var|opt|shm)[/\\\\]i[0-9]{4,7}([/\\\\].*)?"
99 or process.executable rlike "(.*[ /\\\\=\"':;(])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?"
100 or process.executable rlike ".*(artex|pentest|probe|canary)[-_]?i[0-9]{4,7}([^A-Za-z0-9].*)?"
101 or process.executable rlike ".*(Temp|temp|TEMP|tmp|ProgramData|var|opt|shm)[/\\\\]i[0-9]{4,7}([/\\\\].*)?"
102 or process.parent.executable rlike "(.*[ /\\\\=\"':;(])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?"
103 or process.parent.executable rlike ".*(artex|pentest|probe|canary)[-_]?i[0-9]{4,7}([^A-Za-z0-9].*)?"
104 or process.parent.executable rlike ".*(Temp|temp|TEMP|tmp|ProgramData|var|opt|shm)[/\\\\]i[0-9]{4,7}([/\\\\].*)?"
105 or file.path rlike "(.*[ /\\\\=\"':;(])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?"
106 or file.path rlike ".*(artex|pentest|probe|canary)[-_]?i[0-9]{4,7}([^A-Za-z0-9].*)?"
107 or file.path rlike ".*(Temp|temp|TEMP|tmp|ProgramData|var|opt|shm)[/\\\\]i[0-9]{4,7}([/\\\\].*)?"
108| eval Esql.banner_echo = process.command_line rlike "((.|\n|\r)*echo[^A-Za-z0-9\n\r]{0,3}={3}[^=\n\r]{1,80}={3}[^A-Za-z0-9\n\r;]{0,3};(.|\n|\r)*){3}"
109| where Esql.id_match or Esql.banner_echo
110| stats Esql.alert_count = count(*),
111 Esql.first_seen = min(@timestamp),
112 Esql.last_seen = max(@timestamp),
113 Esql.id_alert_count = count(*) where Esql.id_match,
114 Esql.id_rule_count_distinct = count_distinct(rule.name) where Esql.id_match,
115 Esql.banner_alert_count = count(*) where Esql.banner_echo,
116 Esql.banner_rule_count_distinct = count_distinct(rule.name) where Esql.banner_echo,
117 Esql.rule_name_values = values(rule.name),
118 Esql.process_command_line_values = values(process.command_line),
119 Esql.process_parent_command_line_values = values(process.parent.command_line),
120 Esql.process_executable_values = values(process.executable),
121 Esql.process_parent_executable_values = values(process.parent.executable),
122 Esql.file_path_values = values(file.path),
123 Esql.user_name_values = values(user.name)
124 by host.id, agent.id
125| where (Esql.id_alert_count >= 10 or Esql.id_rule_count_distinct >= 2)
126 or Esql.banner_rule_count_distinct >= 3
127| eval process.command_line = mv_first(Esql.process_command_line_values),
128 process.parent.command_line = mv_first(Esql.process_parent_command_line_values),
129 process.executable = mv_first(Esql.process_executable_values),
130 process.parent.executable = mv_first(Esql.process_parent_executable_values),
131 file.path = mv_first(Esql.file_path_values),
132 user.name = mv_first(Esql.user_name_values)
133| keep host.id, agent.id, user.name, process.command_line, process.parent.command_line, process.executable, process.parent.executable, file.path, Esql.*
134'''
135
136[[rule.threat]]
137framework = "MITRE ATT&CK"
138[[rule.threat.technique]]
139id = "T1059"
140name = "Command and Scripting Interpreter"
141reference = "https://attack.mitre.org/techniques/T1059/"
142[[rule.threat.technique.subtechnique]]
143id = "T1059.001"
144name = "PowerShell"
145reference = "https://attack.mitre.org/techniques/T1059/001/"
146[[rule.threat.technique.subtechnique]]
147id = "T1059.003"
148name = "Windows Command Shell"
149reference = "https://attack.mitre.org/techniques/T1059/003/"
150[[rule.threat.technique.subtechnique]]
151id = "T1059.004"
152name = "Unix Shell"
153reference = "https://attack.mitre.org/techniques/T1059/004/"
154
155[rule.threat.tactic]
156id = "TA0002"
157name = "Execution"
158reference = "https://attack.mitre.org/tactics/TA0002/"
159
160[rule.alert_suppression]
161group_by = ["host.id"]
162missing_fields_strategy = "doNotSuppress"
163
164[rule.alert_suppression.duration]
165unit = "h"
166value = 1
Triage and analysis
Investigating Multiple Elastic Defend Alerts from an Agentic Attack
Elastic Defend behavior alerts on one host show an agentic attack in one of two ways. An intent ID is the letter i, then four to seven digits, then a short filename token. ARTEX-family harnesses assign that number from one database sequence and the model copies it into scripts, scheduled tasks, and service names. A section banner is echo followed by a quoted ===label=== and a semicolon, repeated at least three times in one command line, as in echo "===SQL_CTX===";. The rule fires when one host has ten or more such alerts in an hour, or alerts from multiple behavior rules. The one-hour lookback is the rule's from window. A repeat for the same host.id is suppressed for one hour.
The pattern starts at four digits. Two- and three-digit forms (i18n, i386, a directory named i17) match ordinary software. The token after the digits is capped at 16 characters, and an underscore stays inside the token, so a long random string such as an SSH control socket does not match. ES|QL RLIKE uses Lucene regular expressions, which match the whole field and do not support lookaround, so the pattern is anchored with a leading prefix and an optional trailing separator.
Possible investigation steps
- Open
Esql.rule_name_values,Esql.process_command_line_values,Esql.process_parent_command_line_values, andEsql.file_path_valuesfor thishost.id. File-event behavior alerts often carry the intent ID only infile.path. Section banners are onprocess.command_line. - List the distinct
i+ digits tokens. A climbing sequence (i39350, theni40939, theni42463) is one harness. A single repeated ID is one intent reused as a shell or a loop. - Compare alert time with the numeric order. Alert time is when the file ran. The number is closer to when the harness assigned the intent. A smaller ID running after a larger one is an old file executed again.
- Review the underlying Elastic Defend rule names. Web-server child processes, certutil decode, scheduled-task creation, and registry credential access in the same hour are the same session, not separate incidents.
False positive analysis
- Encoded command lines can contain a short
i+ digits + letter run by chance. The four-digit floor and the 16-character token cap drop ordinary paths. A single base64 rule stays under the count of ten when it fires only a handful of times. Ten repeats of one encoded-command rule, or two legitimate rules firing together on encoded content, can still match. Exclude that host.id after confirming the commands are notiNNNNfilenames. - Build paths and localization directories (
i18n,i18next,lib/i386) do not match the intent pattern. - One or two
echo "===label===";lines do not match. A banner followed by&&does not match. The banner pattern is counted on the alerted command line. A parent shell snapshot that contains the banners does not qualify the child process.
Response and remediation
- Isolate the host if the filenames are
iNNNNscripts, tasks, or services and the underlying rules are execution or credential access. - Collect the
iNNNNfilenames and hashes before the host is rebuilt. The same sequence on another host is the same harness database. - Rotate credentials referenced by those scripts. These sessions read registry hives, enrollment material, and application passwords when they can.
References
Related rules
- Potential Web Server Compromise from Multiple Alerts
- Potential Widespread Malware Infection Across Multiple Hosts
- Curl Download Activity from npm Package Install
- Suspicious PowerShell from npm Package Install
- LLM-Based Attack Chain Triage by Host