Repository navigation
[New] Multiple Elastic Defend Alerts with Agentic Intent IDs #7251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Samirbous
wants to merge
10
commits into
main
Choose a base branch
from
art26nov
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+140
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
94b8cc9
[New] Multiple Elastic Defend Alerts with Agentic Intent IDs
Samirbous e4172d6
Update minimum stack version and comments
Samirbous b3cb064
++
Samirbous 423b47f
Merge branch 'art26nov' of https://github.com/elastic/detection-rules…
Samirbous a1a45ed
Update execution_multiple_endpoint_alerts_agentic_intent_id.toml
Samirbous 5684068
Keep intent-id underscores inside the 16-character token cap.
Samirbous 08da0b4
Merge branch 'main' into art26nov
Samirbous e82b37d
Count agentic section banners as well as intent IDs.
Samirbous e6af887
Require each agentic section banner to end with a semicolon.
Samirbous 5cf8cd4
Update execution_multiple_endpoint_alerts_agentic_intent_id.toml
Samirbous File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
140 changes: 140 additions & 0 deletions
140
rules/cross-platform/execution_multiple_endpoint_alerts_agentic_intent_id.toml
This file contains hidden or 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,140 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [metadata] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| creation_date = "2026/11/26" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| maturity = "production" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_stack_comments = "ES|QL STATS, RLIKE, MV_FIRST, and alert suppression are supported on the oldest supported stack, 8.19.0." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| min_stack_version = "8.19.0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updated_date = "2026/11/30" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [rule] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| author = ["Elastic"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description = """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Diagnostic behavior rules are ignored. A single match is too common. The rule fires when one host.id has ten or more | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| such alerts in the one-hour lookback, or alerts from at least two behavior rules. Repeat alerts for that host are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| suppressed for one hour. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| false_positives = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| A short token inside a base64 blob, a Claude shell-snapshot suffix, or a build id such as i8129m can still match | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| the intent pattern. One encoded-command rule firing a handful of times stays under the count of ten. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Operators also label shell output with echo "=== section ===". Each banner has to end with a semicolon, so a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label followed by && does not match, and the alert has to come from a production behavior rule. A production rule | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| that repeats that script ten times in an hour can still alert, as can two production rules on one host. Exclude | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| that host.id after confirming the commands are a known playbook. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from = "now-60m" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| interval = "5m" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language = "esql" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| license = "Elastic License v2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "Multiple Elastic Defend Alerts from an Agentic Attack" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| note = """## 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===";`. Diagnostic behavior rules are ignored. The rule fires when one host has ten or more such alerts in an hour, or alerts from at least two 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`, 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`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 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. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 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 not `iNNNN` filenames. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 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 `iNNNN` scripts, tasks, or services and the underlying rules are execution or credential access. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - Collect the `iNNNN` filenames 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 = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "https://www.elastic.co/security-labs/threat-command/agentic-offensive-frameworks-detection-artex", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| risk_score = 99 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rule_id = "6197bd39-4b1e-4fc0-aec6-d3846976d08b" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| severity = "critical" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tags = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Domain: Endpoint", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Use Case: Threat Detection", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Tactic: Execution", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Rule Type: Higher-Order Rule", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Resources: Investigation Guide", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Data Source: Elastic Defend", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Rule Type: ES|QL", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Threat: Agentic Offensive Frameworks", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timestamp_override = "event.ingested" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type = "esql" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| query = ''' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from logs-endpoint.alerts-* metadata _id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | where data_stream.dataset == "endpoint.alerts" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Lucene RLIKE is a whole-string match and has no lookaround. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // i + 4-7 digits + at most 16 token characters. Underscore stays inside the token. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Three or more echo "===section===" banners, each ending in ;. A label followed by && does not match. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | where process.command_line rlike "(.*[^A-Za-z0-9])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or process.parent.command_line rlike "(.*[^A-Za-z0-9])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or process.executable rlike "(.*[^A-Za-z0-9])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or process.parent.executable rlike "(.*[^A-Za-z0-9])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or file.path rlike "(.*[^A-Za-z0-9])?i[0-9]{4,7}[A-Za-z_][A-Za-z0-9_]{0,15}([^A-Za-z0-9_].*)?" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| or 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}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+81
to
+89
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
wdyt? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | stats Esql.alert_count = count(*), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.rule_name_count_distinct = count_distinct(rule.name), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.rule_name_values = values(rule.name), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.process_command_line_values = values(process.command_line), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.process_parent_command_line_values = values(process.parent.command_line), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.process_executable_values = values(process.executable), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.process_parent_executable_values = values(process.parent.executable), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.file_path_values = values(file.path), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Esql.user_name_values = values(user.name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| by host.id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | where Esql.alert_count >= 10 or Esql.rule_name_count_distinct >= 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just double checking, I expect we want these numbers rather than the ones in the PR summary? |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | eval process.command_line = mv_first(Esql.process_command_line_values), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| process.parent.command_line = mv_first(Esql.process_parent_command_line_values), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| process.executable = mv_first(Esql.process_executable_values), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| process.parent.executable = mv_first(Esql.process_parent_executable_values), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| file.path = mv_first(Esql.file_path_values), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| user.name = mv_first(Esql.user_name_values) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| | keep host.id, user.name, process.command_line, process.parent.command_line, process.executable, process.parent.executable, file.path, Esql.* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ''' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[rule.threat]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| framework = "MITRE ATT&CK" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[rule.threat.technique]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id = "T1059" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "Command and Scripting Interpreter" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference = "https://attack.mitre.org/techniques/T1059/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[rule.threat.technique.subtechnique]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id = "T1059.001" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "PowerShell" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference = "https://attack.mitre.org/techniques/T1059/001/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[rule.threat.technique.subtechnique]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id = "T1059.003" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "Windows Command Shell" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference = "https://attack.mitre.org/techniques/T1059/003/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[rule.threat.technique.subtechnique]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id = "T1059.004" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "Unix Shell" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference = "https://attack.mitre.org/techniques/T1059/004/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [rule.threat.tactic] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id = "TA0002" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "Execution" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reference = "https://attack.mitre.org/tactics/TA0002/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [rule.alert_suppression] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| group_by = ["host.id"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| missing_fields_strategy = "doNotSuppress" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [rule.alert_suppression.duration] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| unit = "h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| value = 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.