Detection rules › Elastic
Elastic rules: 2u
AWS IAM Sensitive Operations via Lambda Execution Role
#Detects successful IAM API calls that create or empower IAM users and roles, attach or embed policies, or wire roles to instance profiles when the caller is an assumed role session associated with AWS Lambda. Serverless execution roles are often over-permissioned; an adversary who can run or compromise function code can abuse these APIs for privilege escalation and persistence—for example creating users or roles, issuing keys, attaching managed or inline policies, or preparing EC2 instance profiles for lateral movement.
Known False Positives
- Some organizations intentionally use Lambda functions to provision IAM principals, bootstrap accounts, or run identity automation (including roles and instance profiles). Confirm the function name in `user_identity.arn`, deployment pipelines, and change records. Exclude known automation roles or specific `session_context.session_issuer.arn` values after validation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- AWS Compromised IAM Key Quarantine (Panther)
- AWS IAM AdministratorAccess Policy Attached to Group (Elastic)
- AWS IAM AdministratorAccess Policy Attached to Role (Elastic)
- AWS IAM AdministratorAccess Policy Attached to User (Elastic)
- AWS IAM Backdoor Users Keys (Sigma)
- AWS IAM Create User via Assumed Role on EC2 Instance (Elastic)
- AWS IAM Credentials Added to a Bedrock API Key Phantom User (Elastic)
- AWS IAM Customer-Managed Policy Attached to Role by Rare User (Elastic)
Rule Body
[metadata]
creation_date = "2026/04/04"
integration = ["aws"]
maturity = "production"
updated_date = "2026/04/04"
[rule]
author = ["Elastic"]
description = """
Detects successful IAM API calls that create or empower IAM users and roles, attach or embed policies, or wire roles to
instance profiles when the caller is an assumed role session associated with AWS Lambda. Serverless execution roles are
often over-permissioned; an adversary who can run or compromise function code can abuse these APIs for privilege
escalation and persistence—for example creating users or roles, issuing keys, attaching managed or inline policies, or
preparing EC2 instance profiles for lateral movement.
"""
false_positives = [
"""
Some organizations intentionally use Lambda functions to provision IAM principals, bootstrap accounts, or run
identity automation (including roles and instance profiles). Confirm the function name in `user_identity.arn`,
deployment pipelines, and change records. Exclude known automation roles or specific
`session_context.session_issuer.arn` values after validation.
""",
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
interval = "5m"
language = "kuery"
license = "Elastic License v2"
name = "AWS IAM Sensitive Operations via Lambda Execution Role"
note = """## Triage and analysis
### Investigating AWS IAM Sensitive Operations via Lambda Execution Role
Lambda functions run under an **execution role**. When that role calls sensitive IAM control-plane APIs—user and group
changes (`CreateUser`, `AddUserToGroup`, …), user or role policies (`AttachUserPolicy`, `PutUserPolicy`,
`AttachRolePolicy`, `PutRolePolicy`), role and instance-profile wiring (`CreateRole`, `CreateInstanceProfile`,
`AddRoleToInstanceProfile`), or `CreateAccessKey`—CloudTrail typically records `user_identity.type` as `AssumedRole` and
may set `user_identity.invoked_by` to `lambda.amazonaws.com`. The session issuer ARN often references the Lambda service
or the execution role.
#### Possible investigation steps
- Parse `aws.cloudtrail.user_identity.arn` for the assumed-role session (function name or request id) and map it to the
Lambda function and deployment path in the same account.
- Review `aws.cloudtrail.request_parameters` for targets such as `userName`, `groupName`, `roleName`, `policyArn`,
`instanceProfileName`, or access key subject.
- Compare `user_agent.original` and `source.ip` to expected Lambda service patterns; correlate with CloudWatch Logs for
the function around `@timestamp`.
- Hunt ±30 minutes for follow-on IAM, `sts:AssumeRole`, or data-plane access using any new credentials.
### False positive analysis
- Approved infrastructure-as-code or onboarding Lambdas may perform these calls. Tune on execution role ARN or tags.
### Response and remediation
- If unauthorized: disable the function, revoke or rotate the execution role credentials, remove rogue IAM users, roles,
instance profiles, or keys, detach or delete unintended policies, and review permission boundaries on the role.
### Additional information
- [IAM API reference](https://docs.aws.amazon.com/IAM/latest/APIReference/)
- [Lambda execution role](https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html)
"""
references = [
"https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html",
"https://hackingthe.cloud/aws/exploitation/iam_privilege_escalation/",
"https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateUser.html",
]
risk_score = 73
rule_id = "a8f3c2e1-4d5b-4e6f-8a9b-0c1d2e3f4a5b"
severity = "high"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: AWS",
"Data Source: Amazon Web Services",
"Data Source: AWS IAM",
"Data Source: AWS Lambda",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.dataset: "aws.cloudtrail"
and event.provider: "iam.amazonaws.com"
and event.outcome: "success"
and aws.cloudtrail.user_identity.type: "AssumedRole"
and (
aws.cloudtrail.user_identity.invoked_by: "lambda.amazonaws.com"
or user_agent.original : *AWS_Lambda*
)
and event.action: (
"AddRoleToInstanceProfile" or
"AddUserToGroup" or
"AttachGroupPolicy" or
"AttachRolePolicy" or
"AttachUserPolicy" or
"CreateAccessKey" or
"CreateInstanceProfile" or
"CreateRole" or
"CreateUser" or
"PutRolePolicy" or
"PutUserPolicy"
)
'''
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"aws.cloudtrail.user_identity.arn",
"aws.cloudtrail.user_identity.type",
"aws.cloudtrail.user_identity.invoked_by",
"aws.cloudtrail.user_identity.access_key_id",
"aws.cloudtrail.request_parameters",
"aws.cloudtrail.response_elements",
"event.action",
"event.outcome",
"cloud.account.id",
"cloud.region",
]
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1136"
name = "Create Account"
reference = "https://attack.mitre.org/techniques/T1136/"
[[rule.threat.technique.subtechnique]]
id = "T1136.003"
name = "Cloud Account"
reference = "https://attack.mitre.org/techniques/T1136/003/"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: query
event.dataset: "aws.cloudtrail"
and event.provider: "iam.amazonaws.com"
and event.outcome: "success"
and aws.cloudtrail.user_identity.type: "AssumedRole"
and (
aws.cloudtrail.user_identity.invoked_by: "lambda.amazonaws.com"
or user_agent.original : *AWS_Lambda*
)
and event.action: (
"AddRoleToInstanceProfile" or
"AddUserToGroup" or
"AttachGroupPolicy" or
"AttachRolePolicy" or
"AttachUserPolicy" or
"CreateAccessKey" or
"CreateInstanceProfile" or
"CreateRole" or
"CreateUser" or
"PutRolePolicy" or
"PutUserPolicy"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
aws.cloudtrail.user_identity.invoked_by | eq |
| field:"aws::userIdentity.invokedBy" kind:eq value:"lambda.amazonaws.com" |
aws.cloudtrail.user_identity.type | eq |
| field:"aws::userIdentity.type" kind:eq value:"AssumedRole" |
event.action | in |
| field:"EventType" kind:in |
event.dataset | eq |
| field:"event.dataset" kind:eq value:"aws.cloudtrail" |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"iam.amazonaws.com" |
user_agent.original | wildcard |
| field:"aws::userAgent" kind:wildcard value:"*AWS_Lambda*" |
Data Encrypted and Archived
#Identifies when data is encrypted and archived using common compression and encryption tools. This activity can indicate an attempt to collect sensitive data and stage it for exfiltration.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Collection |
Rule Body
[rule]
description = """
Identifies when data is encrypted and archived using common compression and encryption tools. This activity can indicate
an attempt to collect sensitive data and stage it for exfiltration.
"""
id = "2454d6fc-1ff8-4a59-8bcf-d6e8c4bb2c09"
license = "Elastic License v2"
name = "Data Encrypted and Archived"
os_list = ["linux", "windows"]
reference = [
"https://futuresearch.ai/blog/litellm-pypi-supply-chain-attack/",
"https://www.virustotal.com/gui/file/71e35aef03099cd1f2d6446734273025a163597de93912df321ef118bf135238",
]
version = "1.0.4"
query = '''
sequence by process.parent.entity_id with maxspan=10s
[process where event.type == "start" and event.action in ("exec", "start") and process.name : ("openssl", "openssl.exe") and
process.args : ("enc", "pkeyutl", "cms", "smime")]
[process where event.type == "start" and event.action in ("exec", "start") and
process.name : (
"tar", "zip", "gzip", "xz", "7z", "7za", "7zr", "bzip2", "zstd",
"tar.exe", "zip.exe", "gzip.exe", "7z.exe", "7za.exe", "7zr.exe", "bzip2.exe", "zstd.exe", "zstd64.exe"
) and
not (
process.parent.args in (
"/opt/rudder/share/commands/agent-run", "/usr/sbin/backup_orbini", "/usr/local/bin/mariadb-backup.sh",
"/usr/local/bin/drupal-per-site-backup.sh"
) or
process.parent.args like "mariabackup*db_backup*" or
process.parent.command_line like (
"*mysqldump*localhost*/storage/backup*", "*/etc/pve*prox_backup*", "*/home/*/.local/bin/authd*"
) or
process.parent.executable == "/opt/rudder/bin/rudder" or
process.working_directory like "/mnt/vstk/queue/*" or
process.args like "/var/rudder/tmp/reports/*" or
(process.name == "tar" and process.working_directory like "/u/sysdat/*") or
(
(process.parent.executable == "/home/backup/backup.sh" or process.parent.args == "/backup/backup_temp") and
process.working_directory like "/storage/*"
)
)]
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique.subtechnique]]
id = "T1027.013"
name = "Encrypted/Encoded File"
reference = "https://attack.mitre.org/techniques/T1027/013/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1074"
name = "Data Staged"
reference = "https://attack.mitre.org/techniques/T1074/"
[[threat.technique.subtechnique]]
id = "T1074.001"
name = "Local Data Staging"
reference = "https://attack.mitre.org/techniques/T1074/001/"
[threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 10s, correlated by process.parent.entity_id.
Stage 1: process
[process where event.type == "start" and event.action in ("exec", "start") and process.name : ("openssl", "openssl.exe") and
process.args : ("enc", "pkeyutl", "cms", "smime")]
Stage 2: process
[process where event.type == "start" and event.action in ("exec", "start") and
process.name : (
"tar", "zip", "gzip", "xz", "7z", "7za", "7zr", "bzip2", "zstd",
"tar.exe", "zip.exe", "gzip.exe", "7z.exe", "7za.exe", "7zr.exe", "bzip2.exe", "zstd.exe", "zstd64.exe"
) and
not (
process.parent.args in (
"/opt/rudder/share/commands/agent-run", "/usr/sbin/backup_orbini", "/usr/local/bin/mariadb-backup.sh",
"/usr/local/bin/drupal-per-site-backup.sh"
) or
process.parent.args like "mariabackup*db_backup*" or
process.parent.command_line like (
"*mysqldump*localhost*/storage/backup*", "*/etc/pve*prox_backup*", "*/home/*/.local/bin/authd*"
) or
process.parent.executable == "/opt/rudder/bin/rudder" or
process.working_directory like "/mnt/vstk/queue/*" or
process.args like "/var/rudder/tmp/reports/*" or
(process.name == "tar" and process.working_directory like "/u/sysdat/*") or
(
(process.parent.executable == "/home/backup/backup.sh" or process.parent.args == "/backup/backup_temp") and
process.working_directory like "/storage/*"
)
)]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
Entra ID Microsoft Authentication Broker DRS Sign-In from Suspicious ASN
#Detects Microsoft Entra ID sign-in activity where the Microsoft Authentication Broker requests the Device Registration Service from a source autonomous system number (ASN) associated with VPN, residential proxy, or hosting egress commonly observed in OAuth phishing and adversary-in-the-middle device registration flows. This pattern can indicate device join or primary refresh token acquisition staged from attacker-controlled infrastructure after a user completes authentication.
Known False Positives
- Users enrolling or joining devices while on corporate VPNs, consumer VPNs, or cloud egress that map to the listed ASNs may match. Legitimate mobile device management or bulk provisioning that uses the broker against Device Registration Service from the same networks can also trigger alerts. Baseline `source.as.organization.name` and successful broker-to-DRS sign-ins before tuning exclusions for approved ASNs or user groups.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Persistence | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2026/05/26"
integration = ["azure"]
maturity = "production"
updated_date = "2026/05/26"
[rule]
author = ["Elastic"]
description = """
Detects Microsoft Entra ID sign-in activity where the Microsoft Authentication Broker requests the Device Registration
Service from a source autonomous system number (ASN) associated with VPN, residential proxy, or hosting egress commonly
observed in OAuth phishing and adversary-in-the-middle device registration flows. This pattern can indicate device join
or primary refresh token acquisition staged from attacker-controlled infrastructure after a user completes
authentication.
"""
false_positives = [
"""
Users enrolling or joining devices while on corporate VPNs, consumer VPNs, or cloud egress that map to the listed
ASNs may match. Legitimate mobile device management or bulk provisioning that uses the broker against Device
Registration Service from the same networks can also trigger alerts. Baseline `source.as.organization.name` and
successful broker-to-DRS sign-ins before tuning exclusions for approved ASNs or user groups.
""",
]
from = "now-9m"
index = ["logs-azure.signinlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID Microsoft Authentication Broker DRS Sign-In from Suspicious ASN"
note = """## Triage and analysis
### Investigating Entra ID Microsoft Authentication Broker DRS Sign-In from Suspicious ASN
Review `azure.signinlogs.properties.user_principal_name`, `azure.signinlogs.properties.app_display_name`,
`azure.signinlogs.properties.resource_display_name`, `azure.signinlogs.properties.session_id`, `source.ip`,
`source.as.number`, `source.as.organization.name`, and `user_agent.original`.
Confirm whether the user intentionally registered or joined a device and whether the source ASN is expected for your
enrollment or remote-access programs.
### Possible investigation steps
- Correlate `azure.signinlogs.properties.session_id` with other sign-ins for the same user, especially multi-IP OAuth
flows or follow-on primary refresh token usage.
- Review Entra ID audit logs for device registration activity around the same timestamp.
- Compare `source.as.organization.name` against approved VPN, MDM, and automation egress in your environment.
- Hunt for additional users signing in from the same ASN with the same application pair in a short window.
### False positive analysis
- Corporate or consumer VPN exit nodes that use ASNs in the rule list are a common source of benign matches during
standard Windows or mobile device join.
- Cloud hosting or ISP NAT pools may intermittently map to listed ASNs without indicating compromise.
### Response and remediation
- If malicious, revoke refresh tokens for the user, disable suspicious registered devices, and reset credentials per
policy.
- Review conditional access for the Microsoft Authentication Broker and device registration requirements.
- Escalate per incident procedures when paired with identity protection alerts or impossible travel.
"""
references = [
"https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
"https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/",
]
risk_score = 73
rule_id = "3d086f43-5382-493d-a018-bce165c88f9f"
severity = "high"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Sign-In Logs",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Tactic: Persistence",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:"azure.signinlogs" and event.action:"Sign-in activity" and
source.as.number:(
399629 or 14061 or 136787 or 9009 or 45102 or 215540 or 29802 or 62240 or 204957 or 395092 or 393406 or 400940 or
59711 or 132203
) and
azure.signinlogs.properties.app_display_name:"Microsoft Authentication Broker" and
azure.signinlogs.properties.resource_display_name:"Device Registration Service"
'''
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user_agent.original",
"source.ip",
"source.as.number",
"source.as.organization.name",
"source.geo.country_name",
"event.outcome",
"azure.signinlogs.properties.user_principal_name",
"azure.signinlogs.properties.session_id",
"azure.signinlogs.properties.app_display_name",
"azure.signinlogs.properties.app_id",
"azure.signinlogs.properties.resource_display_name",
"azure.signinlogs.properties.resource_id",
"azure.signinlogs.properties.authentication_protocol",
"azure.tenant_id",
]
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"
[[rule.threat.technique.subtechnique]]
id = "T1098.005"
name = "Device Registration"
reference = "https://attack.mitre.org/techniques/T1098/005/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[rule.threat.technique.subtechnique]]
id = "T1566.002"
name = "Spearphishing Link"
reference = "https://attack.mitre.org/techniques/T1566/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
data_stream.dataset:"azure.signinlogs" and event.action:"Sign-in activity" and
source.as.number:(
399629 or 14061 or 136787 or 9009 or 45102 or 215540 or 29802 or 62240 or 204957 or 395092 or 393406 or 400940 or
59711 or 132203
) and
azure.signinlogs.properties.app_display_name:"Microsoft Authentication Broker" and
azure.signinlogs.properties.resource_display_name:"Device Registration Service"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
azure.signinlogs.properties.app_display_name | eq |
| field:"azure_ad::app_display_name" kind:eq value:"Microsoft Authentication Broker" |
azure.signinlogs.properties.resource_display_name | eq |
| field:"azure_ad::resource_display_name" kind:eq value:"Device Registration Service" |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"azure.signinlogs" |
event.action | eq |
| field:"EventType" kind:eq value:"Sign-in activity" |
source.as.number | in |
| field:"source.as.number" kind:in |
Execution via MS VisualStudio Pre/Post Build Events
#Identifies the execution of a command via Microsoft Visual Studio Pre or Post build events. Adversaries may backdoor a trusted visual studio project to execute a malicious command during the project build process.
MITRE ATT&CK Coverage
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2023/09/26"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Identifies the execution of a command via Microsoft Visual Studio Pre or Post build events. Adversaries may backdoor a
trusted visual studio project to execute a malicious command during the project build process.
"""
from = "now-119m"
index = ["logs-endpoint.events.process-*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Execution via MS VisualStudio Pre/Post Build Events"
references = [
"https://docs.microsoft.com/en-us/visualstudio/ide/reference/pre-build-event-post-build-event-command-line-dialog-box?view=vs-2022",
"https://www.pwc.com/gx/en/issues/cybersecurity/cyber-threat-intelligence/threat-actor-of-in-tur-est.html",
"https://blog.google/threat-analysis-group/new-campaign-targeting-security-researchers/",
"https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES/blob/master/Execution/execution_evasion_visual_studio_prebuild_event.evtx",
]
risk_score = 21
rule_id = "fec7ccb7-6ed9-4f98-93ab-d6b366b063a0"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Tactic: Execution",
"Rule Type: BBR",
"Data Source: Elastic Defend",
]
type = "eql"
query = '''
sequence with maxspan=1m
[process where host.os.type == "windows" and event.action == "start" and
process.name : "cmd.exe" and process.parent.name : "MSBuild.exe" and
process.args : "?:\\Users\\*\\AppData\\Local\\Temp\\tmp*.exec.cmd"] by process.entity_id
[process where host.os.type == "windows" and event.action == "start" and
process.name : (
"cmd.exe", "powershell.exe",
"MSHTA.EXE", "CertUtil.exe",
"CertReq.exe", "rundll32.exe",
"regsvr32.exe", "MSbuild.exe",
"cscript.exe", "wscript.exe",
"installutil.exe"
) and
not
(
process.name : ("cmd.exe", "powershell.exe") and
process.args : (
"*\\vcpkg\\scripts\\buildsystems\\msbuild\\applocal.ps1",
"HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS?",
"process.versions.node*",
"?:\\Program Files\\nodejs\\node.exe",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\*",
"*Get-ChildItem*Tipasplus.css*",
"Build\\GenerateResourceScripts.ps1",
"Shared\\Common\\..\\..\\BuildTools\\ConfigBuilder.ps1\"",
"?:\\Projets\\*\\PostBuild\\MediaCache.ps1"
)
) and
not process.executable : "?:\\Program Files*\\Microsoft Visual Studio\\*\\MSBuild.exe" and
not (process.name : "cmd.exe" and
process.command_line :
("*vswhere.exe -property catalog_productSemanticVersion*",
"*git log --pretty=format*", "*\\.nuget\\packages\\vswhere\\*",
"*Common\\..\\..\\BuildTools\\*"))
] by process.parent.entity_id
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1127"
name = "Trusted Developer Utilities Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1127/"
[[rule.threat.technique.subtechnique]]
id = "T1127.001"
name = "MSBuild"
reference = "https://attack.mitre.org/techniques/T1127/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[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.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
Stages and Predicates
Ordered sequence: each step below must occur in order within 1m, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where host.os.type == "windows" and event.action == "start" and
process.name : "cmd.exe" and process.parent.name : "MSBuild.exe" and
process.args : "?:\\Users\\*\\AppData\\Local\\Temp\\tmp*.exec.cmd"] by process.entity_id
Stage 2: process
[process where host.os.type == "windows" and event.action == "start" and
process.name : (
"cmd.exe", "powershell.exe",
"MSHTA.EXE", "CertUtil.exe",
"CertReq.exe", "rundll32.exe",
"regsvr32.exe", "MSbuild.exe",
"cscript.exe", "wscript.exe",
"installutil.exe"
) and
not
(
process.name : ("cmd.exe", "powershell.exe") and
process.args : (
"*\\vcpkg\\scripts\\buildsystems\\msbuild\\applocal.ps1",
"HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS?",
"process.versions.node*",
"?:\\Program Files\\nodejs\\node.exe",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\*",
"*Get-ChildItem*Tipasplus.css*",
"Build\\GenerateResourceScripts.ps1",
"Shared\\Common\\..\\..\\BuildTools\\ConfigBuilder.ps1\"",
"?:\\Projets\\*\\PostBuild\\MediaCache.ps1"
)
) and
not process.executable : "?:\\Program Files*\\Microsoft Visual Studio\\*\\MSBuild.exe" and
not (process.name : "cmd.exe" and
process.command_line :
("*vswhere.exe -property catalog_productSemanticVersion*",
"*git log --pretty=format*", "*\\.nuget\\packages\\vswhere\\*",
"*Common\\..\\..\\BuildTools\\*"))
] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"?:\Users\*\AppData\Local\Temp\tmp*.exec.cmd" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"MSBuild.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | *\vcpkg\scripts\buildsystems\msbuild\applocal.ps1, HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS?, process.versions.node*, ?:\Program Files\nodejs\node.exe, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\*, *Get-ChildItem*Tipasplus.css*, Build\GenerateResourceScripts.ps1, Shared\Common\..\..\BuildTools\ConfigBuilder.ps1", ?:\Projets\*\PostBuild\MediaCache.ps1 | excludes:process.args |
process.name | eq | cmd.exe, powershell.exe | excludes:process.name field:"process.name" value:"cmd.exe" field:"process.name" value:"powershell.exe" |
process.command_line | match | vswhere.exe -property catalog_productSemanticVersion, git log --pretty=format, \.nuget\packages\vswhere\, Common\..\..\BuildTools\ | excludes:process.command_line |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.executable | wildcard | ?:\Program Files*\Microsoft Visual Studio\*\MSBuild.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files*\Microsoft Visual Studio\*\MSBuild.exe" |
First Time Seen Removable Device
#Identifies newly seen removable devices by device friendly name using registry modification events. While this activity is not inherently malicious, analysts can use those events to aid monitoring for data exfiltration over those devices.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Exfiltration |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2023/03/16"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies newly seen removable devices by device friendly name using registry modification events. While this activity
is not inherently malicious, analysts can use those events to aid monitoring for data exfiltration over those devices.
"""
from = "now-9m"
index = [
"logs-endpoint.events.registry-*",
"winlogbeat-*",
"logs-windows.sysmon_operational-*",
"endgame-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "kuery"
license = "Elastic License v2"
name = "First Time Seen Removable Device"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating First Time Seen Removable Device
Removable devices, like USB drives, are common in Windows environments for data transfer. Adversaries exploit these to introduce malware or exfiltrate data, leveraging their plug-and-play nature. The detection rule monitors registry changes for new device names, signaling potential unauthorized access. By focusing on first-time-seen devices, it helps identify suspicious activities linked to data exfiltration or initial access attempts.
### Possible investigation steps
- Review the registry event details to confirm the presence of a new device by checking the registry.value for "FriendlyName" and registry.path for USBSTOR.
- Correlate the timestamp of the registry event with user activity logs to identify which user was logged in at the time of the device connection.
- Check for any subsequent file access or transfer events involving the new device to assess potential data exfiltration.
- Investigate the device's history by searching for any previous connections to other systems within the network to determine if it has been used elsewhere.
- Analyze any related alerts or logs from data sources like Elastic Endgame, Sysmon, or Microsoft Defender XDR for additional context or suspicious activities linked to the device.
### False positive analysis
- Frequent use of company-issued USB drives for legitimate data transfer can trigger alerts. Maintain a list of approved devices and create exceptions for these in the monitoring system.
- Software updates or installations via USB drives may be flagged. Identify and whitelist known update devices or processes to prevent unnecessary alerts.
- IT department activities involving USB devices for maintenance or troubleshooting can appear suspicious. Coordinate with IT to log and exclude these routine operations from triggering alerts.
- Devices used for regular backups might be detected as new. Ensure backup devices are registered and excluded from the rule to avoid false positives.
- Personal USB devices used by employees for non-work-related purposes can cause alerts. Implement a policy for registering personal devices and exclude them if deemed non-threatening.
### Response and remediation
- Immediately isolate the affected host from the network to prevent potential data exfiltration or further spread of malware.
- Conduct a thorough scan of the isolated host using updated antivirus and anti-malware tools to identify and remove any malicious software introduced via the removable device.
- Review and analyze the registry changes logged by the detection rule to confirm the legitimacy of the device and assess any unauthorized access attempts.
- If malicious activity is confirmed, collect and preserve relevant logs and evidence for further forensic analysis and potential legal action.
- Notify the security team and relevant stakeholders about the incident, providing details of the device and any identified threats.
- Implement a temporary block on the use of removable devices across the network until the threat is fully contained and remediated.
- Enhance monitoring and detection capabilities by updating security tools and rules to better identify similar threats in the future, focusing on registry changes and device connections."""
references = [
"https://winreg-kb.readthedocs.io/en/latest/sources/system-keys/USB-storage.html",
"https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-device-specific-registry-settings",
]
risk_score = 21
rule_id = "0859355c-0f08-4b43-8ff5-7d2a4789fc08"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Initial Access",
"Tactic: Exfiltration",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category:"registry" and host.os.type:"windows" and registry.value:"FriendlyName" and registry.path:*USBSTOR*
'''
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Registry Events](https://ela.st/sysmon-event-reg-setup)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1091"
name = "Replication Through Removable Media"
reference = "https://attack.mitre.org/techniques/T1091/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1052"
name = "Exfiltration Over Physical Medium"
reference = "https://attack.mitre.org/techniques/T1052/"
[[rule.threat.technique.subtechnique]]
id = "T1052.001"
name = "Exfiltration over USB"
reference = "https://attack.mitre.org/techniques/T1052/001/"
[rule.threat.tactic]
id = "TA0010"
name = "Exfiltration"
reference = "https://attack.mitre.org/tactics/TA0010/"
[rule.new_terms]
field = "new_terms_fields"
value = ["registry.path"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"
Stages and Predicates
Stage 1: new_terms
event.category:"registry" and host.os.type:"windows" and registry.value:"FriendlyName" and registry.path:*USBSTOR*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"registry" |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard value:"*USBSTOR*" |
registry.value | eq |
| field:"registry_value_name" kind:eq value:"FriendlyName" |
LSASS Access Attempt from Unbacked Memory
#Identifies attempt to access the Local Security Authority Subsystem Service (LSASS) and from a call stack containing unbacked code. Adversaries may attempt to access credential material stored in the process memory of LSASS.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access |
Rule Body
[rule]
description = """
Identifies attempt to access the Local Security Authority Subsystem Service (LSASS) and from a call stack containing
unbacked code. Adversaries may attempt to access credential material stored in the process memory of LSASS.
"""
id = "03efdaab-72af-4714-83ce-3abc10cab8d5"
license = "Elastic License v2"
name = "LSASS Access Attempt from Unbacked Memory"
os_list = ["windows"]
version = "1.0.17"
query = '''
sequence by process.entity_id with maxspan=3m
[process where event.action == "start" and
process.parent.name != null and
(
process.executable : ("?:\\Windows\\system32\\*", "?:\\Windows\\SysWOW64\\*") or
process.parent.executable : "?:\\Windows\\system32\\wsmprovhost.exe" or
process.executable regex~ """c:\\windows\\[a-z0-9\-\_\.]+\.exe"""
) and
not (process.executable : "?:\\Windows\\system32\\svchost.exe" and process.parent.name : "services.exe") and
not (process.executable : "?:\\Windows\\System32\\MRT.exe" and process.parent.executable : "?:\\Windows\\SoftwareDistribution\\*.exe") and
process.Ext.protection != "PsProtectedSignerAntimalware-Light" and
not (process.executable : "?:\\Windows\\System32\\msiexec.exe" and process.args : "/V") and
not (process.parent.executable : "?:\\Windows\\System32\\msiexec.exe" and process.parent.args : "/V") and
not (process.executable : ("?:\\Windows\\System32\\wbem\\WmiPrvSE.exe", "?:\\Windows\\SysWOW64\\wbem\\WmiPrvSE.exe") and
process.args : "-Embedding" and process.parent.name : "svchost.exe") and
not (process.executable : "?:\\Windows\\system32\\netstat.exe" and user.id == "S-1-5-18" and process.args : ("-a", "/a")) and
not (process.executable : "?:\\Windows\\system32\\tasklist.exe" and process.args : "/M") and
not (process.name : "powershell.exe" and process.args : "'C:\\ProgramData\\CentraStage\\AEMAgent\\Temp\\*.ps1'" and
process.parent.executable : "C:\\ProgramData\\CentraStage\\AEMAgent\\AEMAgent.exe") and
not (user.id == "S-1-5-18" and process.executable : "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" and
process.parent.command_line : ("cmd /c \"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File -\"",
"cmd /d /c \"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File -\"") and
process.working_directory : ("C:\\Program Files (x86)\\Tanium\\Tanium Client\\extensions\\comply\\data\\results\\*", "c:\\Program Files\\Nodeware\\"))
]
[credential_access where
Target.process.name : "lsass.exe" and
process.thread.Ext.call_stack_contains_unbacked == true and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.module_path : ("?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"?:\\Windows\\assembly\\NativeImages*",
"?:\\Windows\\System32\\DriverStore*"))]
'''
min_endpoint_version = "8.7.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[threat.technique.subtechnique]]
id = "T1003.001"
name = "LSASS Memory"
reference = "https://attack.mitre.org/techniques/T1003/001/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 3m, correlated by process.entity_id.
Stage 1: process
[process where event.action == "start" and
process.parent.name != null and
(
process.executable : ("?:\\Windows\\system32\\*", "?:\\Windows\\SysWOW64\\*") or
process.parent.executable : "?:\\Windows\\system32\\wsmprovhost.exe" or
process.executable regex~ """c:\\windows\\[a-z0-9\-\_\.]+\.exe"""
) and
not (process.executable : "?:\\Windows\\system32\\svchost.exe" and process.parent.name : "services.exe") and
not (process.executable : "?:\\Windows\\System32\\MRT.exe" and process.parent.executable : "?:\\Windows\\SoftwareDistribution\\*.exe") and
process.Ext.protection != "PsProtectedSignerAntimalware-Light" and
not (process.executable : "?:\\Windows\\System32\\msiexec.exe" and process.args : "/V") and
not (process.parent.executable : "?:\\Windows\\System32\\msiexec.exe" and process.parent.args : "/V") and
not (process.executable : ("?:\\Windows\\System32\\wbem\\WmiPrvSE.exe", "?:\\Windows\\SysWOW64\\wbem\\WmiPrvSE.exe") and
process.args : "-Embedding" and process.parent.name : "svchost.exe") and
not (process.executable : "?:\\Windows\\system32\\netstat.exe" and user.id == "S-1-5-18" and process.args : ("-a", "/a")) and
not (process.executable : "?:\\Windows\\system32\\tasklist.exe" and process.args : "/M") and
not (process.name : "powershell.exe" and process.args : "'C:\\ProgramData\\CentraStage\\AEMAgent\\Temp\\*.ps1'" and
process.parent.executable : "C:\\ProgramData\\CentraStage\\AEMAgent\\AEMAgent.exe") and
not (user.id == "S-1-5-18" and process.executable : "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" and
process.parent.command_line : ("cmd /c \"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File -\"",
"cmd /d /c \"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File -\"") and
process.working_directory : ("C:\\Program Files (x86)\\Tanium\\Tanium Client\\extensions\\comply\\data\\results\\*", "c:\\Program Files\\Nodeware\\"))
]
Stage 2: credential_access
[credential_access where
Target.process.name : "lsass.exe" and
process.thread.Ext.call_stack_contains_unbacked == true and
not _arraysearch(process.thread.Ext.call_stack, $entry,
$entry.module_path : ("?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"?:\\Windows\\assembly\\NativeImages*",
"?:\\Windows\\System32\\DriverStore*"))]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Target.process.name | wildcard |
| field:"Target.process.name" kind:wildcard value:"lsass.exe" |
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.protection | ne |
| field:"process.Ext.protection" kind:ne value:"PsProtectedSignerAntimalware-Light" |
process.executable | regex_match |
| field:"Image" kind:regex_match value:"c:\windows\[a-z0-9\-\_.]+.exe" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard value:"?:\Windows\system32\wsmprovhost.exe" |
process.parent.name | is_not_null | field:"parent_process_basename" kind:is_not_null | |
process.thread.Ext.call_stack_contains_unbacked | eq |
| field:"process.thread.Ext.call_stack_contains_unbacked" kind:eq value:"true" |
Exclusions
The rule actively suppresses these predicates.
Newly Observed FortiGate Alert
#This rule detects FortiGate alerts that are observed for the first time in the previous 5 days of alert history. Analysts can use this to prioritize triage and response.
Rule Body
[metadata]
creation_date = "2026/01/21"
integration = ["fortinet_fortigate"]
maturity = "production"
updated_date = "2026/02/18"
[rule]
author = ["Elastic"]
description = """
This rule detects FortiGate alerts that are observed for the first time in the previous 5 days of alert history.
Analysts can use this to prioritize triage and response.
"""
from = "now-7205m"
interval = "5m"
language = "esql"
license = "Elastic License v2"
name = "Newly Observed FortiGate Alert"
risk_score = 99
rule_id = "2c40dfe2-c13e-48a8-8eff-fb9bfb2a7854"
severity = "critical"
tags = ["Use Case: Threat Detection", "Rule Type: Higher-Order Rule", "Resources: Investigation Guide", "Domain: Network", "Data Source: Fortinet"]
timestamp_override = "event.ingested"
type = "esql"
query = '''
FROM logs-fortinet_fortigate.*, filebeat-* metadata _id
| WHERE event.module == "fortinet_fortigate" and event.action in ("signature", "ssl-anomaly") and
message is not null and event.category != "authentication" and
message != "Connection Failed" and not message like "Web.Client: *" and
not message like "Network.Service: *" and not message like "General.Interest*" and not message like "Update: *" and
not message like "tcp_reassembler*" and not message like "a-ipdf*" and not message like "Video*" and not message like "nbss_decode*" and
not message like "name_server*" and not message like "misc*" and not message like "Collaboration*" and not message like "Business*" and
not message like "Cloud.IT*" and not message like "Mobile*"
| STATS Esql.alerts_count = count(*),
Esql.first_time_seen = MIN(@timestamp),
Esql.distinct_count_src_ip = COUNT_DISTINCT(source.ip),
Esql.distinct_count_dst_ip = COUNT_DISTINCT(destination.ip),
src_ip = VALUES(source.ip),
dst_ip = VALUES(destination.ip),
url_domain = VALUES(url.domain),
url_path = VALUES(url.path) by message, event.category, event.outcome
// first time seen is within 10m of the rule execution time
| eval Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, now())
| where Esql.recent <= 10 and Esql.alerts_count <= 5 and Esql.distinct_count_src_ip <= 2 and Esql.distinct_count_dst_ip <= 2
// move dynamic fields to ECS equivalent for rule exceptions
| eval source.ip = MV_FIRST(src_ip),
destination.ip = MV_FIRST(dst_ip),
url.domain = MV_FIRST(url_domain),
url.path = MV_FIRST(url_path)
| keep message, event.category, event.outcome, Esql.*, source.ip, destination.ip, url.domain, url.path
'''
note = """## Triage and analysis
### Investigating Newly Observed Fortigate Alert
This rule surfaces newly observed, low-frequency high severity FortiGate alerts within the last 5 days.
Because the alert has not been seen previously, it should be prioritized for validation to determine whether it represents a true compromise or rare benign activity.
### Investigation Steps
- Identify the source address, affected host and review the associated message to understand the alert.
- Validate the source address under which the activity occurred and assess whether it aligns with normal behavior.
- Refer to the specific alert details like event.original to get more context.
### False Positive Considerations
- Vulnerability scanners and pentesting.
- Administrative scripts or automation tools can trigger detections when first introduced.
- Development or testing environments may produce one-off behaviors that resemble malicious techniques.
### Response and Remediation
- If the activity is confirmed malicious, isolate the affected host to prevent further execution or lateral movement.
- Terminate malicious processes and remove any dropped files or persistence mechanisms.
- Collect forensic artifacts to understand initial access and execution flow.
- Patch or remediate any vulnerabilities or misconfigurations that enabled the behavior.
- If benign, document the finding and consider tuning or exception handling to reduce future noise.
- Continue monitoring the host and environment for recurrence of the behavior or related alerts."""
references = ["https://www.elastic.co/docs/reference/integrations/fortinet_fortigate"]
Stages and Predicates
Stage 1: from
FROM logs-fortinet_fortigate.*, filebeat-* metadata _id
Stage 2: where
| WHERE event.module == "fortinet_fortigate" and event.action in ("signature", "ssl-anomaly") and
message is not null and event.category != "authentication" and
message != "Connection Failed" and not message like "Web.Client: *" and
not message like "Network.Service: *" and not message like "General.Interest*" and not message like "Update: *" and
not message like "tcp_reassembler*" and not message like "a-ipdf*" and not message like "Video*" and not message like "nbss_decode*" and
not message like "name_server*" and not message like "misc*" and not message like "Collaboration*" and not message like "Business*" and
not message like "Cloud.IT*" and not message like "Mobile*"
Stage 3: stats
| STATS Esql.alerts_count = count(*),
Esql.first_time_seen = MIN(@timestamp),
Esql.distinct_count_src_ip = COUNT_DISTINCT(source.ip),
Esql.distinct_count_dst_ip = COUNT_DISTINCT(destination.ip),
src_ip = VALUES(source.ip),
dst_ip = VALUES(destination.ip),
url_domain = VALUES(url.domain),
url_path = VALUES(url.path) by message, event.category, event.outcome
Stage 4: eval
| eval Esql.recent = DATE_DIFF("minute", Esql.first_time_seen, now())
Stage 5: where
| where Esql.recent <= 10 and Esql.alerts_count <= 5 and Esql.distinct_count_src_ip <= 2 and Esql.distinct_count_dst_ip <= 2
Stage 6: eval
| eval source.ip = MV_FIRST(src_ip),
destination.ip = MV_FIRST(dst_ip),
url.domain = MV_FIRST(url_domain),
url.path = MV_FIRST(url_path)
Stage 7: keep
| keep message, event.category, event.outcome, Esql.*, source.ip, destination.ip, url.domain, url.path
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
message | KEEP message |
event.category | KEEP event.category |
event.outcome | KEEP event.outcome |
Esql.* | KEEP Esql.* |
source.ip | KEEP source.ip |
destination.ip | KEEP destination.ip |
url.domain | KEEP url.domain |
url.path | KEEP url.path |
NTDS Dump via Wbadmin
#Identifies the execution of wbadmin to access the NTDS.dit file in a domain controller. Attackers with privileges from groups like Backup Operators can abuse the utility to perform credential access and compromise the domain.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth | |
| Credential Access |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2024/06/05"
integration = ["windows", "endpoint", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies the execution of wbadmin to access the NTDS.dit file in a domain controller. Attackers with privileges from
groups like Backup Operators can abuse the utility to perform credential access and compromise the domain.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "NTDS Dump via Wbadmin"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating NTDS Dump via Wbadmin
Wbadmin is a Windows utility for backup and recovery, often used by administrators to safeguard critical data. However, adversaries with sufficient privileges, such as those in the Backup Operators group, can exploit it to access the NTDS.dit file on domain controllers, which contains sensitive credential information. The detection rule identifies suspicious use of wbadmin by monitoring for its execution with specific arguments related to NTDS.dit, helping to flag potential credential dumping activities.
### Possible investigation steps
- Review the process execution details to confirm the presence of wbadmin.exe with the specific arguments related to NTDS.dit, as indicated by the process.command_line field.
- Check the user account associated with the process execution to determine if it belongs to a privileged group such as Backup Operators, which could indicate potential misuse of privileges.
- Investigate the source host identified by host.os.type to determine if it is a domain controller, as this would be a critical factor in assessing the risk of the activity.
- Correlate the event with other security logs or alerts from data sources like Microsoft Defender XDR or Sysmon to identify any related suspicious activities or patterns.
- Examine recent changes or access attempts to the NTDS.dit file on the domain controller to identify any unauthorized access or modifications.
- Assess the risk score and severity level to prioritize the investigation and determine if immediate response actions are necessary.
### False positive analysis
- Scheduled backups by legitimate IT staff can trigger the rule. Verify the identity and role of the user executing wbadmin and consider excluding known backup schedules from detection.
- Automated recovery processes in disaster recovery plans might use wbadmin with similar arguments. Review and whitelist these processes if they are part of approved recovery procedures.
- Security audits or compliance checks may involve accessing NTDS.dit for validation purposes. Confirm the legitimacy of these activities and exclude them if they are part of regular audits.
- Test environments that mimic production setups might execute similar commands. Ensure these environments are properly documented and excluded from detection if they are used for testing purposes.
### Response and remediation
- Immediately isolate the affected domain controller from the network to prevent further unauthorized access or data exfiltration.
- Revoke any suspicious or unauthorized accounts from the Backup Operators group and review all accounts with elevated privileges for legitimacy.
- Conduct a thorough review of recent backup and recovery operations on the affected domain controller to identify any unauthorized access or data manipulation.
- Change all domain administrator and service account passwords to mitigate potential credential compromise.
- Restore the NTDS.dit file from a known good backup if any unauthorized modifications are detected.
- Implement enhanced monitoring and logging for wbadmin.exe usage across all domain controllers to detect future unauthorized access attempts.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to assess the potential impact on the broader network."""
references = ["https://medium.com/r3d-buck3t/windows-privesc-with-sebackupprivilege-65d2cd1eb960"]
risk_score = 47
rule_id = "d93e61db-82d6-4095-99aa-714988118064"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
(process.name : "wbadmin.exe" or ?process.pe.original_file_name : "wbadmin.exe") and
process.args : "recovery" and process.command_line : "*ntds.dit*"
'''
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
"""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1003"
name = "OS Credential Dumping"
reference = "https://attack.mitre.org/techniques/T1003/"
[[rule.threat.technique.subtechnique]]
id = "T1003.002"
name = "Security Account Manager"
reference = "https://attack.mitre.org/techniques/T1003/002/"
[[rule.threat.technique.subtechnique]]
id = "T1003.003"
name = "NTDS"
reference = "https://attack.mitre.org/techniques/T1003/003/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1006"
name = "Direct Volume Access"
reference = "https://attack.mitre.org/techniques/T1006/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
(process.name : "wbadmin.exe" or ?process.pe.original_file_name : "wbadmin.exe") and
process.args : "recovery" and process.command_line : "*ntds.dit*"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard value:"recovery" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard value:"*ntds.dit*" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"wbadmin.exe" |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard value:"wbadmin.exe" |
Pluggable Authentication Module (PAM) Version Discovery
#This rule detects PAM version discovery activity on Linux systems. PAM version discovery can be an indication of an attacker attempting to backdoor the authentication process through malicious PAM modules.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Credential Access | |
| Discovery |
Rule Body
[metadata]
creation_date = "2024/12/16"
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/06/17"
[rule]
author = ["Elastic"]
description = """
This rule detects PAM version discovery activity on Linux systems. PAM version discovery can be an indication of an
attacker attempting to backdoor the authentication process through malicious PAM modules.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Pluggable Authentication Module (PAM) Version Discovery"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Pluggable Authentication Module (PAM) Version Discovery
Pluggable Authentication Modules (PAM) provide a flexible mechanism for authenticating users on Linux systems. Adversaries may exploit PAM by discovering its version to identify vulnerabilities or backdoor the authentication process with malicious modules. The detection rule identifies suspicious processes querying PAM-related packages, indicating potential reconnaissance or tampering attempts, thus alerting security teams to possible threats.
### Possible investigation steps
- Review the process details to confirm the presence of suspicious activity, focusing on processes with names "dpkg", "dpkg-query", or "rpm" and their arguments "libpam-modules" or "pam".
- Check the user account associated with the process to determine if it is a legitimate user or potentially compromised.
- Investigate the parent process to understand the origin of the command execution and assess if it aligns with normal user behavior.
- Analyze recent login attempts and authentication logs to identify any unusual patterns or failed attempts that may indicate unauthorized access attempts.
- Correlate this activity with other alerts or logs from the same host to identify if there are additional indicators of compromise or related suspicious activities.
### False positive analysis
- Routine system updates or package management activities may trigger the rule when legitimate processes like dpkg or rpm query PAM-related packages. To manage this, consider creating exceptions for known maintenance windows or trusted administrative scripts.
- Automated configuration management tools, such as Ansible or Puppet, might execute commands that match the rule's criteria. Identify these tools and exclude their processes from triggering alerts by specifying their execution context.
- Security compliance checks or vulnerability assessments often involve querying system packages, including PAM. If these are regularly scheduled and verified, whitelist the associated processes to prevent unnecessary alerts.
- Developers or system administrators testing PAM configurations might inadvertently trigger the rule. Establish a protocol for notifying the security team of such activities in advance, allowing for temporary exceptions during testing periods.
- Custom scripts used for system monitoring or auditing may include commands that match the rule. Review these scripts and, if deemed safe, add them to an exclusion list to reduce false positives.
### Response and remediation
- Isolate the affected system from the network to prevent further unauthorized access or lateral movement by the adversary.
- Terminate any suspicious processes identified by the detection rule, specifically those involving 'dpkg', 'dpkg-query', or 'rpm' with arguments related to PAM.
- Conduct a thorough review of PAM configuration files and modules on the affected system to identify and remove any unauthorized or malicious modifications.
- Restore any compromised PAM modules from a known good backup to ensure the integrity of the authentication process.
- Monitor for any additional suspicious activity on the affected system and related systems, focusing on unusual authentication attempts or process executions.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected.
- Implement enhanced monitoring and logging for PAM-related activities across the network to detect similar threats in the future."""
references = [
"https://www.group-ib.com/blog/pluggable-authentication-module/",
"https://embracethered.com/blog/posts/2022/post-exploit-pam-ssh-password-grabbing/",
]
risk_score = 21
rule_id = "135abb91-dcf4-48aa-b81a-5ad036b67c68"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Discovery",
"Tactic: Persistence",
"Tactic: Credential Access",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and ?process.parent.name != null and
(
(process.name in ("dpkg", "dpkg-query") and process.args == "libpam-modules") or
(process.name == "rpm" and process.args == "pam")
) and
not (
?process.parent.name in ("dcservice", "inspectorssmplugin") or
?process.working_directory in ("/var/ossec", "/opt/msp-agent") or
?process.entry_leader.executable in("/usr/local/qualys/cloud-agent/bin/qualys-cloud-agent", "/usr/sbin/ScanAssistant") or
?process.parent.executable in (
"/opt/CyberCNSAgent/cybercnsagent_linux", "/usr/local/manageengine/uems_agent/bin/dcpatchscan",
"/usr/local/manageengine/uems_agent/bin/dcconfig", "/usr/share/vicarius/topiad",
"/etc/rc.d/init.d/sshd-chroot", "/var/ossec/bin/wazuh-modulesd",
"/usr/lib/venv-salt-minion/bin/python.original"
) or
(
process.executable == "/usr/bin/rpm" and
?process.parent.name == "systemd" and
?process.env_vars == "LD_LIBRARY_PATH=/usr/lib/venv-salt-minion/lib"
)
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"
[[rule.threat.technique]]
id = "T1518"
name = "Software Discovery"
reference = "https://attack.mitre.org/techniques/T1518/"
[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and ?process.parent.name != null and
(
(process.name in ("dpkg", "dpkg-query") and process.args == "libpam-modules") or
(process.name == "rpm" and process.args == "pam")
) and
not (
?process.parent.name in ("dcservice", "inspectorssmplugin") or
?process.working_directory in ("/var/ossec", "/opt/msp-agent") or
?process.entry_leader.executable in("/usr/local/qualys/cloud-agent/bin/qualys-cloud-agent", "/usr/sbin/ScanAssistant") or
?process.parent.executable in (
"/opt/CyberCNSAgent/cybercnsagent_linux", "/usr/local/manageengine/uems_agent/bin/dcpatchscan",
"/usr/local/manageengine/uems_agent/bin/dcconfig", "/usr/share/vicarius/topiad",
"/etc/rc.d/init.d/sshd-chroot", "/var/ossec/bin/wazuh-modulesd",
"/usr/lib/venv-salt-minion/bin/python.original"
) or
(
process.executable == "/usr/bin/rpm" and
?process.parent.name == "systemd" and
?process.env_vars == "LD_LIBRARY_PATH=/usr/lib/venv-salt-minion/lib"
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | eq |
| field:"process.args" kind:eq |
process.name | eq |
| field:"process_basename" kind:eq value:"rpm" |
process.name | in |
| field:"process_basename" kind:in |
process.parent.name | is_not_null | field:"parent_process_basename" kind:is_not_null |
Exclusions
The rule actively suppresses these predicates.
Potential AutoConfigURL Settings Hijack
#Identifies registry modification to modify the system internet proxy settings by an unusual process. This may indicate an attempt to hijack user internet traffic to certain websites.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Defense Impairment |
Rule Body
[rule]
description = """
Identifies registry modification to modify the system internet proxy settings by an unusual process. This may indicate
an attempt to hijack user internet traffic to certain websites.
"""
id = "6dd16a01-b779-4a39-b436-deed75f2c355"
license = "Elastic License v2"
name = "Potential AutoConfigURL Settings Hijack"
os_list = ["windows"]
version = "1.0.9"
query = '''
registry where
registry.path : "HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\AutoConfigURL" and
registry.data.strings : "*http*" and not registry.data.strings : "*127.0.0.1*" and process.executable != null and
(
process.code_signature.trusted == false or
process.code_signature.exists == false or
process.name : ("powershell.exe", "wscript.exe", "cscript.exe")
) and
not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "C:\\LexisNexis\\Shared\\RwEasyMAPI64.exe")
'''
min_endpoint_version = "8.4.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1112"
name = "Modify Registry"
reference = "https://attack.mitre.org/techniques/T1112/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Stage 1: registry
registry where
registry.path : "HKEY_USERS\\*\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\AutoConfigURL" and
registry.data.strings : "*http*" and not registry.data.strings : "*127.0.0.1*" and process.executable != null and
(
process.code_signature.trusted == false or
process.code_signature.exists == false or
process.name : ("powershell.exe", "wscript.exe", "cscript.exe")
) and
not process.executable : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*", "C:\\LexisNexis\\Shared\\RwEasyMAPI64.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
process.code_signature.exists | eq |
| field:"process.code_signature.exists" kind:eq value:"false" |
process.code_signature.trusted | eq |
| field:"process.code_signature.trusted" kind:eq value:"false" |
process.executable | is_not_null | field:"Image" kind:is_not_null | |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
registry.data.strings | wildcard |
| field:"Details" kind:wildcard value:"*http*" |
registry.path | wildcard |
| field:"TargetObject" kind:wildcard value:"HKEY_USERS\*\Software\Microsoft\Windows\CurrentVersion\Internet Settings\AutoConfigURL" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | wildcard | ?:\Program Files\*, ?:\Program Files (x86)\*, C:\LexisNexis\Shared\RwEasyMAPI64.exe | excludes:process.executable field:"process.executable" value:"?:\Program Files\*" field:"process.executable" value:"?:\Program Files (x86)\*" field:"process.executable" value:"C:\LexisNexis\Shared\RwEasyMAPI64.exe" |
registry.data.strings | match | 127.0.0.1 | excludes:registry.data.strings field:"registry.data.strings" value:"127.0.0.1" |
Potential Outgoing RDP Connection by Unusual Process
#Adversaries may attempt to connect to a remote system over Windows Remote Desktop Protocol (RDP) to achieve lateral movement. Adversaries may avoid using the Microsoft Terminal Services Client (mstsc.exe) binary to establish an RDP connection to evade detection.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Lateral Movement |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 3: Network connection |
Rule Body
[metadata]
creation_date = "2023/08/29"
integration = ["endpoint"]
maturity = "production"
updated_date = "2024/09/01"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = """
Adversaries may attempt to connect to a remote system over Windows Remote Desktop Protocol (RDP) to achieve lateral
movement. Adversaries may avoid using the Microsoft Terminal Services Client (mstsc.exe) binary to establish an RDP
connection to evade detection.
"""
from = "now-119m"
index = ["logs-endpoint.events.network-*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Potential Outgoing RDP Connection by Unusual Process"
risk_score = 21
rule_id = "8e39f54e-910b-4adb-a87e-494fbba5fb65"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Lateral Movement",
"Data Source: Elastic Defend",
"Rule Type: BBR"
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
network where host.os.type == "windows" and
event.action == "connection_attempted" and destination.port == 3389 and
destination.ip != "::1" and destination.ip != "127.0.0.1" and
not (
process.executable : (
"?:\\Windows\\System32\\mstsc.exe",
"?:\\Program Files (x86)\\mRemoteNG\\mRemoteNG.exe",
"?:\\Program Files (x86)\\PRTG Network Monitor\\PRTG Probe.exe",
"?:\\Program Files\\Azure Advanced Threat Protection Sensor\\*\\Microsoft.Tri.Sensor.exe",
"?:\\Program Files (x86)\\Microsoft\\Remote Desktop Connection Manager\\RDCMan.exe",
"?:\\Program Files\\SentinelOne\\Sentinel Agent*\\Ranger\\SentinelRanger.exe",
"?:\\Program Files\\Devolutions\\Remote Desktop Manager\\RemoteDesktopManager.exe",
"?:\\Program Files (x86)\\Devolutions\\Remote Desktop Manager\\RemoteDesktopManager.exe"
) and process.code_signature.trusted == true
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"
[[rule.threat.technique.subtechnique]]
id = "T1021.001"
name = "Remote Desktop Protocol"
reference = "https://attack.mitre.org/techniques/T1021/001/"
[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"
Stages and Predicates
Stage 1: network
network where host.os.type == "windows" and
event.action == "connection_attempted" and destination.port == 3389 and
destination.ip != "::1" and destination.ip != "127.0.0.1" and
not (
process.executable : (
"?:\\Windows\\System32\\mstsc.exe",
"?:\\Program Files (x86)\\mRemoteNG\\mRemoteNG.exe",
"?:\\Program Files (x86)\\PRTG Network Monitor\\PRTG Probe.exe",
"?:\\Program Files\\Azure Advanced Threat Protection Sensor\\*\\Microsoft.Tri.Sensor.exe",
"?:\\Program Files (x86)\\Microsoft\\Remote Desktop Connection Manager\\RDCMan.exe",
"?:\\Program Files\\SentinelOne\\Sentinel Agent*\\Ranger\\SentinelRanger.exe",
"?:\\Program Files\\Devolutions\\Remote Desktop Manager\\RemoteDesktopManager.exe",
"?:\\Program Files (x86)\\Devolutions\\Remote Desktop Manager\\RemoteDesktopManager.exe"
) and process.code_signature.trusted == true
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
destination.ip | ne |
| field:"dest_ip" kind:ne |
destination.port | eq |
| field:"DestinationPort" kind:eq value:"3389" |
event.action | eq |
| field:"EventType" kind:eq value:"connection_attempted" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | wildcard | ?:\Windows\System32\mstsc.exe, ?:\Program Files (x86)\mRemoteNG\mRemoteNG.exe, ?:\Program Files (x86)\PRTG Network Monitor\PRTG Probe.exe, ?:\Program Files\Azure Advanced Threat Protection Sensor\*\Microsoft.Tri.Sensor.exe, ?:\Program Files (x86)\Microsoft\Remote Desktop Connection Manager\RDCMan.exe, ?:\Program Files\SentinelOne\Sentinel Agent*\Ranger\SentinelRanger.exe, ?:\Program Files\Devolutions\Remote Desktop Manager\RemoteDesktopManager.exe, ?:\Program Files (x86)\Devolutions\Remote Desktop Manager\RemoteDesktopManager.exe | excludes:process.executable |
Potential Reverse Shell via Named Pipe
#This rule detects the creation of a reverse shell through the use of named pipes. Attackers may leverage named pipes to evade detection and establish persistence onto a target system.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Rule Body
[rule]
description = """
This rule detects the creation of a reverse shell through the use of named pipes. Attackers may leverage named pipes to
evade detection and establish persistence onto a target system.
"""
id = "40bec6eb-e93b-4d09-8265-66bba186e332"
license = "Elastic License v2"
name = "Potential Reverse Shell via Named Pipe"
os_list = ["linux"]
version = "1.0.17"
query = '''
process where event.type == "start" and event.action == "exec" and
process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and (
(process.name == "mknod" and process.args like ("/tmp/*", "/var/tmp/*", "/dev/shm/*") and process.args_count <= 5) or
(
process.name == "mkfifo" and
process.parent.args == "-c" and
process.parent.command_line like "*rm*" and
process.parent.command_line like "*|*" and
process.parent.command_line regex ".*[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}.*"
)
) and
not (
(process.name == "mknod" and process.args like ("/var/tmp/dracut*", "/tmp/dracut.*", "/var/tmp/portage/*", "/tmp/dib_build*", "/tmp/bootstrap-salt.logpipe")) or
(process.executable == "/usr/lib/cargo/bin/coreutils/mknod" and process.args like "/tmp/tmp.*/test-dev-null")
)
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and
process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and (
(process.name == "mknod" and process.args like ("/tmp/*", "/var/tmp/*", "/dev/shm/*") and process.args_count <= 5) or
(
process.name == "mkfifo" and
process.parent.args == "-c" and
process.parent.command_line like "*rm*" and
process.parent.command_line like "*|*" and
process.parent.command_line regex ".*[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}.*"
)
) and
not (
(process.name == "mknod" and process.args like ("/var/tmp/dracut*", "/tmp/dracut.*", "/var/tmp/portage/*", "/tmp/dib_build*", "/tmp/bootstrap-salt.logpipe")) or
(process.executable == "/usr/lib/cargo/bin/coreutils/mknod" and process.args like "/tmp/tmp.*/test-dev-null")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.args_count | le |
| field:"process.args_count" kind:le value:"5" |
process.name | eq |
| field:"process_basename" kind:eq |
process.parent.args | eq |
| field:"process.parent.args" kind:eq value:"-c" |
process.parent.command_line | regex_match |
| field:"ParentCommandLine" kind:regex_match value:".*[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.*" |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | wildcard | /tmp/tmp.*/test-dev-null | excludes:process.args field:"process.args" value:"/tmp/tmp.*/test-dev-null" |
process.executable | eq | /usr/lib/cargo/bin/coreutils/mknod | excludes:process.executable field:"process.executable" value:"/usr/lib/cargo/bin/coreutils/mknod" |
process.args | wildcard | /var/tmp/dracut*, /tmp/dracut.*, /var/tmp/portage/*, /tmp/dib_build*, /tmp/bootstrap-salt.logpipe | excludes:process.args |
process.name | eq | mknod | excludes:process.name field:"process.name" value:"mknod" |
PowerShell Script with Encryption/Decryption Capabilities
#Identifies PowerShell script block content that uses .NET cryptography APIs for file encryption or decryption. Attackers abuse these routines to encrypt data for impact or decrypt staged payloads to evade defenses.
Known False Positives
- Legitimate PowerShell Scripts which makes use of encryption.
MITRE ATT&CK Coverage
Rule Body
[metadata]
creation_date = "2023/01/23"
integration = ["windows"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies PowerShell script block content that uses .NET cryptography APIs for file encryption or decryption.
Attackers abuse these routines to encrypt data for impact or decrypt staged payloads to evade defenses.
"""
false_positives = ["Legitimate PowerShell Scripts which makes use of encryption."]
from = "now-9m"
index = ["winlogbeat-*", "logs-windows.powershell*"]
language = "kuery"
license = "Elastic License v2"
name = "PowerShell Script with Encryption/Decryption Capabilities"
note = """## Triage and analysis
> **Disclaimer**:
> This guide was created by humans with the assistance of generative AI. While its contents have been manually curated to include the most valuable information, always validate assumptions and adjust procedures to match your internal runbooks and incident triage and response policies.
### Investigating PowerShell Script with Encryption/Decryption Capabilities
This rule identifies PowerShell script block content that implements cryptographic encryption or decryption using .NET APIs. Matching script blocks commonly include symmetric cryptography classes (for example, AES/Rijndael or the SymmetricAlgorithm base type), key derivation helpers (for example, PasswordDeriveBytes or Rfc2898DeriveBytes), explicit cipher configuration (CipherMode and PaddingMode), and calls that create an encryptor or decryptor.
This behavior can be legitimate (protecting configuration values, packaging content, or controlled encryption for business workflows). It can also indicate malicious activity such as encrypting local data for impact or decrypting staged content to reduce static visibility before follow-on execution. Prioritize determining what data is being transformed, where outputs are written, and whether the user/host/script origin aligns with expected activity.
#### Key alert fields to review
- `user.name`, `user.domain`, `user.id`: Account execution context for correlation, prioritization, and scoping.
- `host.name`, `host.id`: Host execution context for correlation, prioritization, and scoping.
- `powershell.file.script_block_text`: Script block content that matched the detection logic.
- `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`: Script block metadata to pivot to other fragments or reconstruct full script content when split across multiple events.
- `file.path`, `file.directory`, `file.name`: File-origin context when the script block is sourced from an on-disk file.
- `powershell.file.script_block_length`: Script block length (size) context.
#### Possible investigation steps
- Review `powershell.file.script_block_text` to understand the cryptographic intent and data flow:
- Identify whether the logic is primarily encrypting, decrypting, or doing both.
- Note which cryptographic primitives are used (for example, AES/Rijndael, hashing helpers, and key derivation routines) and how keys/IVs are produced (hard-coded values, derived from passwords, generated randomly, or passed in).
- Identify the transformed data source and destination:
- File-oriented operations: look for path construction, directory traversal patterns, repeated read/write loops, file extension changes, renames, or deletion of originals.
- In-memory operations: look for large embedded blobs, byte arrays, stream usage, or logic that converts decrypted content into executable form or writes it to a new artifact.
- Extract and preserve any embedded secrets or deterministic derivation parameters (password strings, salts, iteration counts, static IVs, or key material), as these can be critical for impact assessment and recovery.
- Determine whether the alert contains the full implementation or only a fragment:
- Use `powershell.file.script_block_length` to gauge whether this is a complete routine (larger blocks) versus a wrapper or function invocation (smaller blocks).
- If the script appears incomplete, pivot on `powershell.file.script_block_id` and use `powershell.sequence` / `powershell.total` to retrieve and order all fragments before concluding intent.
- Validate execution context and provenance:
- Review `user.name`, `user.domain`, and `user.id` to determine whether this account typically performs encryption/decryption tasks and whether the account scope matches the host role.
- Review `host.name` and `host.id` to determine asset criticality and whether similar activity is expected on this system (for example, administrative hosts may have more automation than standard endpoints).
- If `file.path` / `file.name` is present, evaluate whether the script origin is expected:
- Compare the path and name to approved automation locations and naming conventions.
- Treat unexpected paths, user-writable directories, or newly observed script locations as higher risk.
- Scope the activity using alert fields:
- On the same host, search for additional script blocks tied to the same `powershell.file.script_block_id` to find related functions or setup code not visible in the initial alert fragment.
- Search across hosts for repeating patterns in `powershell.file.script_block_text` and for the same `file.name` to determine whether this is a widely deployed administrative script or isolated activity.
- Pivot on `user.id` to identify whether similar script blocks appear on multiple hosts, which may indicate coordinated activity.
- Correlate with adjacent telemetry around `@timestamp` for the same `host.id` and `user.id` (if available in your environment):
- Process execution telemetry to identify the PowerShell host process and what initiated it, helping distinguish interactive use from automation or remotely initiated activity.
- File activity telemetry to identify bursts of file modifications/creations consistent with bulk encryption/decryption and to determine which directories and file types were affected.
- Network telemetry to identify connections that could support retrieval of encrypted content, exchange of key material, or staging/downloading of additional payloads.
- Authentication telemetry to identify unusual logons or session types for the user preceding execution.
- Determine disposition and urgency:
- Treat as higher severity if the script indicates broad file processing, writes many outputs, modifies user data locations, or includes embedded key material/blobs associated with staged content.
- Treat as lower severity if the script is clearly tied to approved operations, originates from a known `file.path`, is executed by expected accounts, and shows consistent recurrence patterns with expected scope.
### False positive analysis
- Legitimate PowerShell automation may implement encryption/decryption for secure configuration handling, packaging, data protection, or interoperability with other systems.
- Benign activity is more likely to have consistent `file.path` / `file.name` values, execute under expected administrative accounts, and recur on appropriate hosts with stable script content.
- If the script is determined to be benign, document what data it protects, where it is expected to run, which accounts execute it, and what normal recurrence looks like to reduce future triage time.
### Response and remediation
- If the activity is suspicious or malicious:
- Contain the host to prevent further encryption/decryption activity and reduce the risk of spread or data impact.
- Preserve evidence from the alert, including the full `powershell.file.script_block_text` and any reconstructed fragments correlated via `powershell.file.script_block_id`.
- If `file.path` is present, collect the referenced script from disk and preserve it for forensic review and scoping.
- Identify impacted systems and data:
- If file-impact is suspected, prioritize backup protection, incident response escalation, and recovery planning.
- If payload staging is suspected, prioritize identifying the decrypted output or follow-on execution artifacts.
- Scope and hunt across the environment for related activity using `user.id`, `host.id`, recurring `file.name`, and distinctive fragments of `powershell.file.script_block_text`.
- Remediate the associated account and access path: validate legitimacy, reset credentials if compromise is suspected, and apply least-privilege controls where appropriate.
- Remove or block the identified script and any related artifacts discovered during analysis, and monitor for recurrence.
- If the activity is confirmed benign:
- Record the expected `file.path` / `file.name`, the responsible `user.id`, and normal execution patterns to support consistent future triage and tuning decisions.
"""
setup = """## Setup
PowerShell Script Block Logging must be enabled to generate the events used by this rule (e.g., 4104).
Setup instructions: https://ela.st/powershell-logging-setup
"""
risk_score = 47
rule_id = "1d9aeb0b-9549-46f6-a32d-05e2a001b7fd"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: PowerShell Logs",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
event.category:process and host.os.type:windows and
powershell.file.script_block_text : (
(
"Cryptography.AESManaged" or
"Cryptography.RijndaelManaged" or
"Cryptography.SHA1Managed" or
"Cryptography.SHA256Managed" or
"Cryptography.SHA384Managed" or
"Cryptography.SHA512Managed" or
"Cryptography.SymmetricAlgorithm" or
"PasswordDeriveBytes" or
"Rfc2898DeriveBytes"
) and
(
CipherMode and PaddingMode
) and
(
".CreateEncryptor" or
".CreateDecryptor"
)
) and
not user.id : "S-1-5-18" and
not (
file.name : "Bootstrap.Octopus.FunctionAppenderContext.ps1" and
powershell.file.script_block_text : ("function Decrypt-Variables" or "github.com/OctopusDeploy")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[rule.threat.technique.subtechnique]]
id = "T1027.013"
name = "Encrypted/Encoded File"
reference = "https://attack.mitre.org/techniques/T1027/013/"
[[rule.threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1486"
name = "Data Encrypted for Impact"
reference = "https://attack.mitre.org/techniques/T1486/"
[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.name",
"user.id",
"user.domain",
"powershell.file.script_block_text",
"powershell.file.script_block_id",
"powershell.sequence",
"powershell.total",
"file.path",
"file.directory",
"file.name",
"process.pid",
"host.name",
"host.id",
"powershell.file.script_block_length"
]
Stages and Predicates
Stage 1: query
event.category:process and host.os.type:windows and
powershell.file.script_block_text : (
(
"Cryptography.AESManaged" or
"Cryptography.RijndaelManaged" or
"Cryptography.SHA1Managed" or
"Cryptography.SHA256Managed" or
"Cryptography.SHA384Managed" or
"Cryptography.SHA512Managed" or
"Cryptography.SymmetricAlgorithm" or
"PasswordDeriveBytes" or
"Rfc2898DeriveBytes"
) and
(
CipherMode and PaddingMode
) and
(
".CreateEncryptor" or
".CreateDecryptor"
)
) and
not user.id : "S-1-5-18" and
not (
file.name : "Bootstrap.Octopus.FunctionAppenderContext.ps1" and
powershell.file.script_block_text : ("function Decrypt-Variables" or "github.com/OctopusDeploy")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.category | eq |
| field:"event.category" kind:eq value:"process" |
powershell.file.script_block_text | eq |
| field:"ScriptBlockText" kind:eq |
powershell.file.script_block_text | in |
| field:"ScriptBlockText" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.name | eq | Bootstrap.Octopus.FunctionAppenderContext.ps1 | excludes:file.name field:"file.name" value:"Bootstrap.Octopus.FunctionAppenderContext.ps1" |
powershell.file.script_block_text | in | function Decrypt-Variables, github.com/OctopusDeploy | excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"function Decrypt-Variables" field:"powershell.file.script_block_text" value:"github.com/OctopusDeploy" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Shell History Clearing via Environment Variables
#This rule detects the clearing of the shell history via environment variables. Attackers may clear the shell history to hide their activities from being tracked. By leveraging environment variables such as HISTSIZE, HISTFILESIZE, HISTCONTROL, and HISTFILE, attackers can clear the shell history by setting them to 0, ignoring spaces, or redirecting the history to /dev/null, effectively erasing the command history.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[metadata]
creation_date = "2026/04/09"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/04/09"
[rule]
author = ["Elastic"]
description = """
This rule detects the clearing of the shell history via environment variables. Attackers may clear the shell history
to hide their activities from being tracked. By leveraging environment variables such as HISTSIZE, HISTFILESIZE,
HISTCONTROL, and HISTFILE, attackers can clear the shell history by setting them to 0, ignoring spaces, or redirecting
the history to /dev/null, effectively erasing the command history.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Shell History Clearing via Environment Variables"
note = """
## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Shell History Clearing via Environment Variables
This rule detects Linux processes that start with shell history controls set to disable or discard command logging, a common defense-evasion tactic that removes evidence of hands-on-keyboard activity. An attacker who gains a shell may launch bash with HISTFILE=/dev/null and HISTSIZE=0, then run discovery, credential access, or privilege-escalation commands knowing their interactive history will not be written to disk.
### Possible investigation steps
- Reconstruct the full process ancestry and login context to determine whether the shell was launched from a legitimate admin session, a remote access channel such as SSH or a web shell, or an unexpected parent process.
- Review all commands and child processes executed by the same user and terminal session immediately before and after the history suppression event for signs of discovery, credential access, lateral movement, privilege escalation, or log tampering.
- Correlate with authentication, sudo, PAM, and SSH logs on the host to verify who initiated the session, from where, and whether the activity aligns with approved maintenance or change windows.
- Examine concurrent file, network, and process telemetry for follow-on actions such as downloading tools, touching sensitive files, modifying startup scripts, or making outbound connections that would indicate the shell was used for malicious objectives.
- If the activity is not clearly benign, capture volatile evidence and inspect shell startup files and account profiles for persistent history-disabling settings or aliases that could mask repeated interactive activity.
### False positive analysis
- Administrators may intentionally launch a temporary shell with HISTFILE=/dev/null or HISTSIZE=0 during sensitive maintenance to avoid saving secrets entered at the prompt; verify the user, change timing, parent process, and nearby commands align with approved administrative work on the host.
- A user's shell startup files may legitimately set HISTCONTROL=ignorespace or redirect HISTFILE for noninteractive, ephemeral, or test sessions as part of local shell customization; confirm the same settings exist in the account or system shell profiles and appear consistently across the user's normal sessions without other suspicious behavior.
### Response and remediation
- Isolate the affected Linux host from the network while preserving forensic access, stop the malicious shell and any spawned tools, and collect copies of the user’s shell startup files, current crontabs, and recently modified scripts before cleanup.
- Remove attacker footholds by deleting unauthorized changes in ~/.bashrc, ~/.profile, /etc/profile, /etc/bash.bashrc, ~/.ssh/authorized_keys, systemd service or timer units, cron jobs, and any backdoor binaries or web shells dropped during the session.
- Reset credentials and secrets exposed on or from the host, including the compromised local account, any sudo-capable accounts, SSH keys, and application tokens, and review sudoers files and group membership for malicious privilege changes.
- Restore the system to a known-good state by rebuilding from a trusted image or validated backup and verifying core packages, shell configuration files, scheduled tasks, and remote access settings match the approved baseline before reconnecting it.
- Escalate to incident response immediately if the history-suppression shell was followed by privilege escalation, credential access, outbound tool downloads, lateral movement over SSH, or the same behavior is identified on multiple hosts, and expand scoping to related accounts and systems.
- Harden against recurrence by enforcing centralized command and session logging, restricting interactive shell access to managed administration paths, monitoring for shell profiles that set HISTFILE=/dev/null or HISTSIZE=0, and tightening change control for user and system startup files.
"""
references = ["https://www.rapid7.com/blog/post/tr-new-whitepaper-stealthy-bpfdoor-variants/"]
risk_score = 73
rule_id = "a68da7d6-7eab-45bd-97c5-93b469c0706e"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
Elastic Defend integration does not collect environment variable logging by default.
In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the Elastic Defend integration.
#### To set up environment variable capture for an Elastic Agent policy:
- Go to “Security → Manage → Policies”.
- Select an “Elastic Agent policy”.
- Click “Show advanced settings”.
- Scroll down or search for “linux.advanced.capture_env_vars”.
- Enter the names of environment variables you want to capture, separated by commas.
- For this rule the linux.advanced.capture_env_vars variable should be set to "HISTSIZE, HISTFILESIZE, HISTCONTROL, HISTFILE".
- Click “Save”.
After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.
For more information on capturing environment variables refer to the [helper guide](https://www.elastic.co/guide/en/security/current/environment-variable-capture.html).
"""
severity = "high"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.env_vars like~ (
"HISTSIZE=0", "HISTFILESIZE=0", "HISTCONTROL=ignorespace", "HISTFILE=/dev/null"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[rule.threat.tactic]
name = "Defense Evasion"
id = "TA0005"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[rule.threat.technique]]
name = "Indicator Removal"
id = "T1070"
reference = "https://attack.mitre.org/techniques/T1070/"
[[rule.threat.technique.subtechnique]]
name = "Clear Command History"
id = "T1070.003"
reference = "https://attack.mitre.org/techniques/T1070/003/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.env_vars like~ (
"HISTSIZE=0", "HISTFILESIZE=0", "HISTCONTROL=ignorespace", "HISTFILE=/dev/null"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.env_vars | wildcard |
| field:"process.env_vars" kind:wildcard |
SMB (Windows File Sharing) Activity from the Internet
#This rule detects network events that may indicate inbound Windows file sharing (SMB or CIFS) traffic originating from the Internet. SMB should never be directly reachable from the Internet, as it is a primary target for exploitation by threat actors seeking initial access. Inbound SMB from a public IP is a direct precondition for attacks such as EternalBlue (MS17-010) and related SMB remote code execution vulnerabilities.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access |
Rule Body
[metadata]
creation_date = "2026/06/10"
integration = ["corelight", "network_traffic", "panw", "fortinet_fortigate", "pfsense", "zeek"]
maturity = "production"
updated_date = "2026/08/26"
[rule]
author = ["Elastic"]
description = """
This rule detects network events that may indicate inbound Windows file sharing (SMB or CIFS) traffic originating from
the Internet. SMB should never be directly reachable from the Internet, as it is a primary target for exploitation by
threat actors seeking initial access. Inbound SMB from a public IP is a direct precondition for attacks such as
EternalBlue (MS17-010) and related SMB remote code execution vulnerabilities.
"""
from = "now-9m"
index = ["logs-corelight.*", "logs-network_traffic.*", "logs-panw.panos*", "logs-fortinet_fortigate.log-*", "logs-pfsense.log-*", "logs-zeek.*"]
language = "kuery"
license = "Elastic License v2"
name = "SMB (Windows File Sharing) Activity from the Internet"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating SMB (Windows File Sharing) Activity from the Internet
Inbound SMB from a public IP is one of the highest-signal perimeter events observable at a network boundary. SMB (ports 139/445) should never be reachable from the Internet. When it is, it is almost always either a deliberate exposure (misconfiguration) or active exploitation, both of which warrant investigation. Classic attacks in this category include EternalBlue (MS17-010), WannaCry, NotPetya, and subsequent SMB RCE chains.
This rule uses `new_terms` to suppress repeat scans from the same source, surfacing only the first time each external IP reaches an internal host on SMB ports.
### Possible investigation steps
- Identify the destination IP. Determine whether this host has a legitimate reason to expose SMB to the Internet (nearly always: no). Check whether the port was reachable externally due to a misconfigured NAT rule or security group.
- Review firewall allow/deny context alongside the alert. If the session was blocked, the immediate risk is lower, but the exposure is still worth addressing.
- Check the source IP against threat intelligence. Mass-Internet SMB scanning is common and source IPs are frequently tracked in public feeds.
- Correlate with endpoint telemetry on the destination host: look for process creation events, new services, or lateral movement activity that might indicate exploitation succeeded.
- Review patch status of the destination host for MS17-010 and subsequent SMB vulnerabilities.
- Check whether this external IP has been seen targeting other internal hosts or ports in the same timeframe, which would indicate a broader scan or intrusion campaign.
### False positive analysis
- Hosts with public IPs that explicitly expose SMB (rare, but occurs in some lab or legacy setups): this is the intended detection; the exposure is itself the finding. Add a per-host exception only after confirming the exposure is authorized and risk-accepted.
- Site-to-site VPN or MPLS setups where a remote office segment routes through a public IP and appears as an external source: confirm with network architecture and add the IP range to the exclusion list if legitimate.
### Response and remediation
- If the destination host is reachable from the Internet on port 139 or 445, immediately close the exposure at the firewall or security group level. This is the single most impactful remediation step.
- Isolate the destination host if any signs of compromise exist (unexpected processes, new scheduled tasks, lateral movement alerts).
- Patch the host for MS17-010 and related SMB vulnerabilities if not already current.
- Audit NAT and firewall rules to ensure no other hosts have inadvertent Internet-facing SMB exposure.
- Review the pfSense / network perimeter ruleset to confirm that inbound TCP 139/445 is explicitly denied at the border.
## Setup
This rule requires network flow or firewall log data that captures inbound TCP connections with 5-tuple information (source IP, destination IP, destination port). Compatible data sources include:
- **Elastic Network Traffic** integration (Packetbeat)
- **Corelight** integration (network and SMB telemetry)
- **Fortinet FortiGate** integration (firewall traffic logs)
- **PAN-OS** integration (Palo Alto Networks firewall logs)
- **pfSense** integration (syslog-based firewall flow logs; requires pfSense syslog forwarding enabled)
- **Zeek** integration (SMB-specific log types: `smb_cmd`, `smb_files`, `smb_mapping`)
For pfSense, ensure the firewall logging rules are configured to log connection events and that the Elastic pfSense integration is forwarding logs to the `logs-pfsense.log-*` data stream."""
references = [
"https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml",
"https://msrc.microsoft.com/update-guide/vulnerability/CVE-2017-0144",
]
risk_score = 73
rule_id = "0ffc3d78-44ce-4a55-b2be-98219e0eed05"
severity = "high"
tags = [
"Tactic: Initial Access",
"Domain: Network",
"Use Case: Threat Detection",
"Data Source: Corelight",
"Data Source: Fortinet",
"Data Source: PAN-OS",
"Data Source: Network Traffic",
"Data Source: pfSense",
"Data Source: Zeek",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
(data_stream.dataset:(fortinet_fortigate.log or network_traffic.flow or pfsense.log or zeek.smb_cmd or zeek.smb_files or zeek.smb_mapping) or event.category:(network or network_traffic))
and network.transport:tcp and destination.port:(139 or 445)
and destination.ip:(10.0.0.0/8 or 172.16.0.0/12 or 192.168.0.0/16)
and not source.ip:(
10.0.0.0/8
or 100.64.0.0/10
or 127.0.0.0/8
or 169.254.0.0/16
or 172.16.0.0/12
or 192.0.0.0/24
or 192.0.0.0/29
or 192.0.0.10/32
or 192.0.0.170/32
or 192.0.0.171/32
or 192.0.0.8/32
or 192.0.0.9/32
or 192.0.2.0/24
or 192.168.0.0/16
or 192.175.48.0/24
or 192.31.196.0/24
or 192.52.193.0/24
or 192.88.99.0/24
or 198.18.0.0/15
or 198.51.100.0/24
or 203.0.113.0/24
or 224.0.0.0/4
or 240.0.0.0/4
or "::1"
or "FE80::/10"
or "FF00::/8"
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1133"
name = "External Remote Services"
reference = "https://attack.mitre.org/techniques/T1133/"
[[rule.threat.technique]]
id = "T1190"
name = "Exploit Public-Facing Application"
reference = "https://attack.mitre.org/techniques/T1190/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[rule.new_terms]
field = "new_terms_fields"
value = ["source.ip"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
(data_stream.dataset:(fortinet_fortigate.log or network_traffic.flow or pfsense.log or zeek.smb_cmd or zeek.smb_files or zeek.smb_mapping) or event.category:(network or network_traffic))
and network.transport:tcp and destination.port:(139 or 445)
and destination.ip:(10.0.0.0/8 or 172.16.0.0/12 or 192.168.0.0/16)
and not source.ip:(
10.0.0.0/8
or 100.64.0.0/10
or 127.0.0.0/8
or 169.254.0.0/16
or 172.16.0.0/12
or 192.0.0.0/24
or 192.0.0.0/29
or 192.0.0.10/32
or 192.0.0.170/32
or 192.0.0.171/32
or 192.0.0.8/32
or 192.0.0.9/32
or 192.0.2.0/24
or 192.168.0.0/16
or 192.175.48.0/24
or 192.31.196.0/24
or 192.52.193.0/24
or 192.88.99.0/24
or 198.18.0.0/15
or 198.51.100.0/24
or 203.0.113.0/24
or 224.0.0.0/4
or 240.0.0.0/4
or "::1"
or "FE80::/10"
or "FF00::/8"
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | in |
| field:"data_stream.dataset" kind:in |
destination.ip | in |
| field:"dest_ip" kind:in |
destination.port | in |
| field:"DestinationPort" kind:in |
event.category | in |
| field:"event.category" kind:in |
network.transport | eq |
| field:"Protocol" kind:eq value:"tcp" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
source.ip | in | 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.0.8/32, 192.0.0.9/32, 192.0.2.0/24, 192.168.0.0/16, 192.175.48.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 240.0.0.0/4, ::1, FE80::/10, FF00::/8 | excludes:source.ip |
Suspicious Scheduled Task Creation
#Identifies the creation of a scheduled task with suspicious argument such as task path or parent process. This behavior is consistent with an adversary attempting to establish persistence.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[rule]
description = """
Identifies the creation of a scheduled task with suspicious argument such as task path or parent process. This behavior
is consistent with an adversary attempting to establish persistence.
"""
id = "beebd95c-93f4-46d2-a902-053bfe78686b"
license = "Elastic License v2"
name = "Suspicious Scheduled Task Creation"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/taskschd"]
version = "1.0.34"
query = '''
process where event.action == "start" and
process.pe.original_file_name : "schtasks.exe" and
not process.Ext.token.integrity_level_name == "system" and
process.args : ("/create", "-create") and process.args : "/tr" and
not process.command_line : ("*:\\Program Files\\*", "*:\\Program Files (x86)\\*") and
not process.Ext.token.integrity_level_name == "system" and
(
process.args : ("*Users\\Public\\*", "*:\\Windows\\Tasks\\*", "*:\\Windows\\system32\\Tasks\\*") or
(process.args : "minute" and process.args : "/mo" and
process.args : ("*\\AppData\\*", "*\\ProgramData\\*", "*Users\\Public\\*")) or
(process.args : "HIGHEST" and process.args : "ONLOGON" and
process.parent.name : ("wmiprvse.exe", "rundll32.exe", "regsvr32.exe") and
not process.parent.command_line : "*rundll32*zzzzInvokeManagedCustomActionOutOfProc*") or
(process.args : ("onlogon", "minute", "onstart", "daily", "once") and
process.parent.name : "cmd.exe" and process.parent.command_line : "*schtasks*" and
descendant of [process where event.action == "start" and not process.code_signature.trusted == true]) or
(process.args : ("SYSTEM", "NT AUTHORITY\\SYSTEM") and process.args : "/ru" and
process.command_line : ("*vssadmin*Delete*Shadows*", "*wmic*shadowcopy*", "*regsvr32*-s*")) or
process.command_line : ("*comspec*", "*cmd.exe*/c*", "*^*^*^*", "*powershell*", "*http*://*", "*mshta*", "* curl.exe*")
) and
not process.command_line : ("*\\bmx\\* shutdown.exe *", "*powershell.exe*Task*rubrik_vmware*") and
not (process.parent.args : "C:\\ProgramData\\Prognos_Scripts\\OneDriveMapper\\OneDriveMapper.ps1" and process.command_line : "*powershell*") and
not process.args : ("'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe' -NonInteractive -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File C:\\Windows\\TEMP\\rubrik_vmware*\\post-restore.ps1 ",
"'C:\\ProWin22\\32bit\\ProSeriesBackgroundUpdater.exe' -p 'C:\\ProWin22' -y 22 -s Core",
"C:\\ModentoBridge\\ModentoPowershellProxy\\schedulePSP.bat",
"C:\\ModentoBridge\\ModentoPowershellProxy\\startProxy.bat",
"C:\\ModentoBridge_1\\ModentoPowershellProxy\\startProxy.bat",
"C:\\PROGRA~2\\*\\EXAQUA~1\\DEVELO~1\\EQPERF~1\\Config\\EQPERF~1.BAT",
"c:\\dona_adm\\admin\\*.exe") and
not (process.parent.name : "powershell.exe" and process.args : "Rubrik Post Restore Task") and
not process.command_line : "*\\ProgramData\\Atos\\custom-scanner\\scan_sox.cmd*" and
not (process.parent.name : "wsmprovhost.exe" and process.command_line : "*TempGPUpdate*" and process.command_line : "*gpupdate*") and
not (process.args : "& \"\\\\*" and process.args : "powershell") and
not (process.parent.name : "cmd.exe" and (process.parent.args : "\\\\*" or process.parent.command_line : "\"C:\\WINDOWS\\system32\\cmd.exe\""))
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[threat.technique.subtechnique]]
id = "T1053.005"
name = "Scheduled Task"
reference = "https://attack.mitre.org/techniques/T1053/005/"
[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.pe.original_file_name : "schtasks.exe" and
not process.Ext.token.integrity_level_name == "system" and
process.args : ("/create", "-create") and process.args : "/tr" and
not process.command_line : ("*:\\Program Files\\*", "*:\\Program Files (x86)\\*") and
not process.Ext.token.integrity_level_name == "system" and
(
process.args : ("*Users\\Public\\*", "*:\\Windows\\Tasks\\*", "*:\\Windows\\system32\\Tasks\\*") or
(process.args : "minute" and process.args : "/mo" and
process.args : ("*\\AppData\\*", "*\\ProgramData\\*", "*Users\\Public\\*")) or
(process.args : "HIGHEST" and process.args : "ONLOGON" and
process.parent.name : ("wmiprvse.exe", "rundll32.exe", "regsvr32.exe") and
not process.parent.command_line : "*rundll32*zzzzInvokeManagedCustomActionOutOfProc*") or
(process.args : ("onlogon", "minute", "onstart", "daily", "once") and
process.parent.name : "cmd.exe" and process.parent.command_line : "*schtasks*" and
descendant of [process where event.action == "start" and not process.code_signature.trusted == true]) or
(process.args : ("SYSTEM", "NT AUTHORITY\\SYSTEM") and process.args : "/ru" and
process.command_line : ("*vssadmin*Delete*Shadows*", "*wmic*shadowcopy*", "*regsvr32*-s*")) or
process.command_line : ("*comspec*", "*cmd.exe*/c*", "*^*^*^*", "*powershell*", "*http*://*", "*mshta*", "* curl.exe*")
) and
not process.command_line : ("*\\bmx\\* shutdown.exe *", "*powershell.exe*Task*rubrik_vmware*") and
not (process.parent.args : "C:\\ProgramData\\Prognos_Scripts\\OneDriveMapper\\OneDriveMapper.ps1" and process.command_line : "*powershell*") and
not process.args : ("'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe' -NonInteractive -WindowStyle Hidden -ExecutionPolicy RemoteSigned -File C:\\Windows\\TEMP\\rubrik_vmware*\\post-restore.ps1 ",
"'C:\\ProWin22\\32bit\\ProSeriesBackgroundUpdater.exe' -p 'C:\\ProWin22' -y 22 -s Core",
"C:\\ModentoBridge\\ModentoPowershellProxy\\schedulePSP.bat",
"C:\\ModentoBridge\\ModentoPowershellProxy\\startProxy.bat",
"C:\\ModentoBridge_1\\ModentoPowershellProxy\\startProxy.bat",
"C:\\PROGRA~2\\*\\EXAQUA~1\\DEVELO~1\\EQPERF~1\\Config\\EQPERF~1.BAT",
"c:\\dona_adm\\admin\\*.exe") and
not (process.parent.name : "powershell.exe" and process.args : "Rubrik Post Restore Task") and
not process.command_line : "*\\ProgramData\\Atos\\custom-scanner\\scan_sox.cmd*" and
not (process.parent.name : "wsmprovhost.exe" and process.command_line : "*TempGPUpdate*" and process.command_line : "*gpupdate*") and
not (process.args : "& \"\\\\*" and process.args : "powershell") and
not (process.parent.name : "cmd.exe" and (process.parent.args : "\\\\*" or process.parent.command_line : "\"C:\\WINDOWS\\system32\\cmd.exe\""))
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"*schtasks*" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard |
process.pe.original_file_name | wildcard |
| field:"OriginalFileName" kind:wildcard value:"schtasks.exe" |
Exclusions
The rule actively suppresses these predicates.
Suspicious System Module Image Hollowing
#Identifies attempt to modify the content of a system module. This may indicate an attempt to inject code using module stomping or DLL hollowing via overwriting the content of a legit DLL with malicious code.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies attempt to modify the content of a system module. This may indicate an attempt to inject code using module
stomping or DLL hollowing via overwriting the content of a legit DLL with malicious code.
"""
id = "542a6a6c-1af2-4e51-a8a4-5406765f5642"
license = "Elastic License v2"
name = "Suspicious System Module Image Hollowing"
os_list = ["windows"]
version = "1.0.3"
query = '''
api where process.Ext.api.name == "VirtualProtect" and process.Ext.api.behaviors == "hollow_image" and
process.Ext.api.parameters.size >= 10000 and process.executable != null and
process.Ext.api.metadata.target_address_path regex """c:\\windows\\(system32|syswow64)\\[a-z]+.dll""" and
not process.thread.Ext.call_stack_final_user_module.name in ("Undetermined", "Unknown", "Kernel") and
not process.thread.Ext.call_stack_summary like "*Unknown*" and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Undetermined", "Unbacked", "Kernel*") and
/* ntdll, kernelbase and kernel32 are covered by other rules */
not process.Ext.api.metadata.target_address_name like ("ntdll.dll*", "kernel32.dll*", "kernelbase.dll*") and
_arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
not (process.Ext.api.name == "VirtualProtect" and _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("*kernelbase.dll!LoadLibrary*", "*kernel32.dll!ExitProcess*", "*kernelbase.dll!GetProcAddressForCaller*", "*ntdll.dll!LdrLoadDll*"))) and
not process.thread.Ext.call_stack_final_user_module.path like
("c:\\windows\\assembly\\nativeimages_*.dll",
"c:\\program files\\*",
"c:\\program files (x86)\\*",
"c:\\windows\\twain_32\\*.dll",
"c:\\windows\\system32\\umppc*.dll",
"c:\\windows\\system32\\spool\\drivers\\*") and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("b6e3adede9b0b9da89c3c6f68ce6a5eb77ab251b5c038cc620cafa48b1fe0037",
"2cd768547d07855533c32eab8210d17412c89bd53880a60dd78e231248cc579e",
"f80d5f5de3f7a82e684229028b946f6efa1682d27ec960ef18518542fd12a407",
"91e9f9606469f8bbd86c68c21e52742b0b1e4598cf44209b3dcc0f45036e42e6",
"7a1755d119563f58d3d4d0f0923e171907572935aafc4cf27f51a09aa7def754",
"f81d5f63dccf693fab3772d9600746221f082f4d48bb7987216629f2804263b6",
"4da2c4cc0a764ea6ee62277f8983afec648cb40785c8395ad6338acb22c2b564",
"c1807fd6bea0db55972bb8b51490d39226594028f5501c2f69ac62d53bfdc407",
"3c99abcc2f24c310a3b3fc15585918e970d6d7da688f3b1e1d8b28767e4aaae9",
"f239acaf38fe64972664f8591722da7c3d40b85c1673beacdbb0ce996a4b4e46",
"ee6ff9b28dffedaabb0cf13853e7ed0b196e72970d1c206fd9d3d3f84886af87",
"17f0f709fb7f6190c03b19b6198fd863b6f0d79f46ccfebac6064be747a4cb3e",
"2c154aeaad085e01361b967adfec84b63db76a82a45681b3e6cdfacb6088e369",
"7d97ced37fa657963c06ad08efa735d01f59f6b42fec5b4ee6a1d1a4f4ad0a6e",
"d1e1d111eff2d7d3e60e5ed47d1919a43fe5a44e45f75d4a33f7a6cbc39a4aac",
"4328398412fdc6eadf57c4e659a45a34716cbccea0f4c025ef7fcd6e27d8ca48",
"bd0d0b5eadc24168292ba5ac70366519ce96b2fb2bb17ea94062b029e79a6da7",
"b6454f1ae5fed546f699732b15135bc7baf993931ca8bc8e143fb9fe1df11c1e",
"8620e418276050cf1f44d9f0a1095649ab7306db790ff352bb9ee03fddd051c0",
"34eff33b6000a8ad3b3bd448e35bef037063689d996f7367ecf13b7f7fb4a34a",
"8095edd1ecf015f01d3642a93b62cdef7fedfc8c487e14fc32ab68245d037e7b",
"8095edd1ecf015f01d3642a93b62cdef7fedfc8c487e14fc32ab68245d037e7b")
'''
min_endpoint_version = "8.10.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.0"
Stages and Predicates
Stage 1: api
api where process.Ext.api.name == "VirtualProtect" and process.Ext.api.behaviors == "hollow_image" and
process.Ext.api.parameters.size >= 10000 and process.executable != null and
process.Ext.api.metadata.target_address_path regex """c:\\windows\\(system32|syswow64)\\[a-z]+.dll""" and
not process.thread.Ext.call_stack_final_user_module.name in ("Undetermined", "Unknown", "Kernel") and
not process.thread.Ext.call_stack_summary like "*Unknown*" and
not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Undetermined", "Unbacked", "Kernel*") and
not process.Ext.api.metadata.target_address_name like ("ntdll.dll*", "kernel32.dll*", "kernelbase.dll*") and
_arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
not (process.Ext.api.name == "VirtualProtect" and _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("*kernelbase.dll!LoadLibrary*", "*kernel32.dll!ExitProcess*", "*kernelbase.dll!GetProcAddressForCaller*", "*ntdll.dll!LdrLoadDll*"))) and
not process.thread.Ext.call_stack_final_user_module.path like
("c:\\windows\\assembly\\nativeimages_*.dll",
"c:\\program files\\*",
"c:\\program files (x86)\\*",
"c:\\windows\\twain_32\\*.dll",
"c:\\windows\\system32\\umppc*.dll",
"c:\\windows\\system32\\spool\\drivers\\*") and
process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
("b6e3adede9b0b9da89c3c6f68ce6a5eb77ab251b5c038cc620cafa48b1fe0037",
"2cd768547d07855533c32eab8210d17412c89bd53880a60dd78e231248cc579e",
"f80d5f5de3f7a82e684229028b946f6efa1682d27ec960ef18518542fd12a407",
"91e9f9606469f8bbd86c68c21e52742b0b1e4598cf44209b3dcc0f45036e42e6",
"7a1755d119563f58d3d4d0f0923e171907572935aafc4cf27f51a09aa7def754",
"f81d5f63dccf693fab3772d9600746221f082f4d48bb7987216629f2804263b6",
"4da2c4cc0a764ea6ee62277f8983afec648cb40785c8395ad6338acb22c2b564",
"c1807fd6bea0db55972bb8b51490d39226594028f5501c2f69ac62d53bfdc407",
"3c99abcc2f24c310a3b3fc15585918e970d6d7da688f3b1e1d8b28767e4aaae9",
"f239acaf38fe64972664f8591722da7c3d40b85c1673beacdbb0ce996a4b4e46",
"ee6ff9b28dffedaabb0cf13853e7ed0b196e72970d1c206fd9d3d3f84886af87",
"17f0f709fb7f6190c03b19b6198fd863b6f0d79f46ccfebac6064be747a4cb3e",
"2c154aeaad085e01361b967adfec84b63db76a82a45681b3e6cdfacb6088e369",
"7d97ced37fa657963c06ad08efa735d01f59f6b42fec5b4ee6a1d1a4f4ad0a6e",
"d1e1d111eff2d7d3e60e5ed47d1919a43fe5a44e45f75d4a33f7a6cbc39a4aac",
"4328398412fdc6eadf57c4e659a45a34716cbccea0f4c025ef7fcd6e27d8ca48",
"bd0d0b5eadc24168292ba5ac70366519ce96b2fb2bb17ea94062b029e79a6da7",
"b6454f1ae5fed546f699732b15135bc7baf993931ca8bc8e143fb9fe1df11c1e",
"8620e418276050cf1f44d9f0a1095649ab7306db790ff352bb9ee03fddd051c0",
"34eff33b6000a8ad3b3bd448e35bef037063689d996f7367ecf13b7f7fb4a34a",
"8095edd1ecf015f01d3642a93b62cdef7fedfc8c487e14fc32ab68245d037e7b",
"8095edd1ecf015f01d3642a93b62cdef7fedfc8c487e14fc32ab68245d037e7b")
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.thread.Ext.call_stack | array_any | excludes:process.thread.Ext.call_stack | |
process.Ext.api.name | eq | VirtualProtect | excludes:process.Ext.api.name field:"process.Ext.api.name" value:"VirtualProtect" |
process.thread.Ext.call_stack_final_user_module.code_signature | array_any | excludes:process.thread.Ext.call_stack_final_user_module.code_signature | |
process.Ext.api.metadata.target_address_name | starts_with | ntdll.dll, kernel32.dll, kernelbase.dll | excludes:process.Ext.api.metadata.target_address_name field:"process.Ext.api.metadata.target_address_name" value:"ntdll.dll" field:"process.Ext.api.metadata.target_address_name" value:"kernel32.dll" field:"process.Ext.api.metadata.target_address_name" value:"kernelbase.dll" |
process.thread.Ext.call_stack_final_user_module.hash.sha256 | in | 17f0f709fb7f6190c03b19b6198fd863b6f0d79f46ccfebac6064be747a4cb3e, 2c154aeaad085e01361b967adfec84b63db76a82a45681b3e6cdfacb6088e369, 2cd768547d07855533c32eab8210d17412c89bd53880a60dd78e231248cc579e, 34eff33b6000a8ad3b3bd448e35bef037063689d996f7367ecf13b7f7fb4a34a, 3c99abcc2f24c310a3b3fc15585918e970d6d7da688f3b1e1d8b28767e4aaae9, 4328398412fdc6eadf57c4e659a45a34716cbccea0f4c025ef7fcd6e27d8ca48, 4da2c4cc0a764ea6ee62277f8983afec648cb40785c8395ad6338acb22c2b564, 7a1755d119563f58d3d4d0f0923e171907572935aafc4cf27f51a09aa7def754, 7d97ced37fa657963c06ad08efa735d01f59f6b42fec5b4ee6a1d1a4f4ad0a6e, 8095edd1ecf015f01d3642a93b62cdef7fedfc8c487e14fc32ab68245d037e7b, 8620e418276050cf1f44d9f0a1095649ab7306db790ff352bb9ee03fddd051c0, 91e9f9606469f8bbd86c68c21e52742b0b1e4598cf44209b3dcc0f45036e42e6, b6454f1ae5fed546f699732b15135bc7baf993931ca8bc8e143fb9fe1df11c1e, b6e3adede9b0b9da89c3c6f68ce6a5eb77ab251b5c038cc620cafa48b1fe0037, bd0d0b5eadc24168292ba5ac70366519ce96b2fb2bb17ea94062b029e79a6da7, c1807fd6bea0db55972bb8b51490d39226594028f5501c2f69ac62d53bfdc407, d1e1d111eff2d7d3e60e5ed47d1919a43fe5a44e45f75d4a33f7a6cbc39a4aac, ee6ff9b28dffedaabb0cf13853e7ed0b196e72970d1c206fd9d3d3f84886af87, f239acaf38fe64972664f8591722da7c3d40b85c1673beacdbb0ce996a4b4e46, f80d5f5de3f7a82e684229028b946f6efa1682d27ec960ef18518542fd12a407, f81d5f63dccf693fab3772d9600746221f082f4d48bb7987216629f2804263b6 | excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256 |
process.thread.Ext.call_stack_final_user_module.name | in | Kernel, Undetermined, Unknown | excludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Kernel" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown" |
process.thread.Ext.call_stack_final_user_module.path | wildcard | c:\windows\assembly\nativeimages_*.dll, c:\program files\*, c:\program files (x86)\*, c:\windows\twain_32\*.dll, c:\windows\system32\umppc*.dll, c:\windows\system32\spool\drivers\* | excludes:process.thread.Ext.call_stack_final_user_module.path |
process.thread.Ext.call_stack_final_user_module.protection_provenance | wildcard | Undetermined, Unbacked, Kernel* | excludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Undetermined" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Unbacked" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Kernel*" |
process.thread.Ext.call_stack_summary | match | Unknown | excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"Unknown" |
Suspicious Windows Script Downloaded from the Internet
#Identifies execution of a Windows script that was downloaded from the internet followed by spawning a child process or performing an outgoing network connection to the internet.
MITRE ATT&CK Coverage
Rule Body
[rule]
description = """
Identifies execution of a Windows script that was downloaded from the internet followed by spawning a child process or
performing an outgoing network connection to the internet.
"""
id = "8a450438-9413-414b-9d71-cdacd01791b4"
license = "Elastic License v2"
name = "Suspicious Windows Script Downloaded from the Internet"
os_list = ["windows"]
version = "1.0.4"
query = '''
sequence with maxspan=5m
[file where event.action == "creation" and user.id != "S-1-5-18" and
file.Ext.windows.zone_identifier == 3 and
file.extension in~ ("js", "jse", "vbs", "vbe", "wsh", "hta", "chm", "msc") and
(file.origin_url != null or file.origin_referrer_url != null) and file.path : "?:\\Users\\*"] as event0
[process where event.action == "start" and
process.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and
(
/* substring used to remove Zone.Identifier from file.name */
stringcontains~(process.command_line, substring(event0.file.name, 0, length(event0.file.name) - 16)) or
stringcontains~(process.command_line, event0.file.name) or
startswith~(event0.file.path, process.working_directory)
)] as event1
[any where
/* script utility spawn a child process */
(event.category == "process" and event.action == "start" and
process.parent.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and process.parent.entity_id == event1.process.entity_id) or
/* script registry modification */
(event.category == "registry" and event.action == "modification" and
process.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and
process.entity_id == event1.process.entity_id and registry.data.strings != null and
registry.path :
("HKEY_USERS\\*Classes\\*",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows NT\\CurrentVersion\\*")) or
/* script utility perform an egress conn to the internet */
(event.category == "network" and event.action in ("disconnect_received", "connection_attempted") and
process.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and
process.entity_id == event1.process.entity_id and
not cidrmatch(destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24",
"192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
"192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
"100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1",
"FE80::/10", "FF00::/8"))]
'''
min_endpoint_version = "8.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
tree = true
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.001"
name = "Compiled HTML File"
reference = "https://attack.mitre.org/techniques/T1218/001/"
[[threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.15.0"
Stages and Predicates
Stage 1: file
[file where event.action == "creation" and user.id != "S-1-5-18" and
file.Ext.windows.zone_identifier == 3 and
file.extension in~ ("js", "jse", "vbs", "vbe", "wsh", "hta", "chm", "msc") and
(file.origin_url != null or file.origin_referrer_url != null) and file.path : "?:\\Users\\*"] as event0
Stage 2: process
[process where event.action == "start" and
process.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and
(
stringcontains~(process.command_line, substring(event0.file.name, 0, length(event0.file.name) - 16)) or
stringcontains~(process.command_line, event0.file.name) or
startswith~(event0.file.path, process.working_directory)
)] as event1
Stage 3: any
[any where
(event.category == "process" and event.action == "start" and
process.parent.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and process.parent.entity_id == event1.process.entity_id) or
(event.category == "registry" and event.action == "modification" and
process.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and
process.entity_id == event1.process.entity_id and registry.data.strings != null and
registry.path :
("HKEY_USERS\\*Classes\\*",
"HKEY_USERS\\*\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\*",
"HKEY_USERS\\*\\Software\\Microsoft\\Windows NT\\CurrentVersion\\*")) or
(event.category == "network" and event.action in ("disconnect_received", "connection_attempted") and
process.name in~ ("wscript.exe", "mshta.exe", "hh.exe", "mmc.exe") and
process.entity_id == event1.process.entity_id and
not cidrmatch(destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24",
"192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
"192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
"100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1",
"FE80::/10", "FF00::/8"))]
Indicators
These rows show field, operator, and value matches.
UAC Bypass Attempt via DCCW DLL Search Order Hijacking
#Identifies attempts to bypass User Account Control (UAC) via Display Color Calibration DLL search order hijacking. Attackers may attempt to bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Privilege Escalation | |
| Stealth |
Rule Body
[rule]
description = """
Identifies attempts to bypass User Account Control (UAC) via Display Color Calibration DLL search order hijacking.
Attackers may attempt to bypass UAC to stealthily execute code with elevated permissions.
"""
id = "093bd845-b59f-4868-a7dd-62d48b737bf6"
license = "Elastic License v2"
name = "UAC Bypass Attempt via DCCW DLL Search Order Hijacking"
os_list = ["windows"]
reference = [
"https://github.com/hfiref0x/UACME",
"https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-redirection",
]
version = "1.0.32"
query = '''
sequence with maxspan=60s
[file where event.action : "rename" and
process.name : ("dllhost.exe", "wusa.exe") and
file.path : ("?:\\*\\dccw.exe.*\\*.dll", "?:\\*\\dccw.exe.*\\*.dll")]
[process where event.action == "start" and
process.parent.name : "dccw.exe" and process.Ext.token.integrity_level_name == "high" and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\cttune.exe",
"?:\\Windows\\SysWOW64\\cttune.exe")]
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 1
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1129"
name = "Shared Modules"
reference = "https://attack.mitre.org/techniques/T1129/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.001"
name = "DLL"
reference = "https://attack.mitre.org/techniques/T1574/001/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: file
[file where event.action : "rename" and
process.name : ("dllhost.exe", "wusa.exe") and
file.path : ("?:\\*\\dccw.exe.*\\*.dll", "?:\\*\\dccw.exe.*\\*.dll")]
Stage 2: process
[process where event.action == "start" and
process.parent.name : "dccw.exe" and process.Ext.token.integrity_level_name == "high" and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\cttune.exe",
"?:\\Windows\\SysWOW64\\cttune.exe")]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | wildcard |
| field:"EventType" kind:wildcard value:"rename" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard value:"?:\*\dccw.exe.*\*.dll" |
process.Ext.token.integrity_level_name | eq |
| field:"process.Ext.token.integrity_level_name" kind:eq value:"high" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"dccw.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\System32\cttune.exe, ?:\Windows\SysWOW64\cttune.exe | excludes:process.executable |
UAC Bypass Attempt with IEditionUpgradeManager Elevated COM Interface
#Identifies attempts to bypass User Account Control (UAC) by abusing an elevated COM interface to launch a rogue Windows ClipUp program. Attackers may attempt to bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies attempts to bypass User Account Control (UAC) by abusing an elevated COM interface to launch a rogue Windows
ClipUp program. Attackers may attempt to bypass UAC to stealthily execute code with elevated permissions.
"""
id = "f1008eeb-bc85-4d5e-91ac-e99aaba08ecf"
license = "Elastic License v2"
name = "UAC Bypass Attempt with IEditionUpgradeManager Elevated COM Interface"
os_list = ["windows"]
reference = ["https://github.com/hfiref0x/UACME"]
version = "1.0.31"
query = '''
process where event.action == "start" and
process.parent.name : "dllhost.exe" and
process.Ext.token.integrity_level_name == "high" and
process.parent.command_line : "*BD54C901-076B-434E-B6C7-17C531F4AB41*" and
process.executable : ("?:\\*\\System32\\*.exe", "?:\\*\\SysWOW64\\*.exe") and
not process.executable : ("?:\\Windows\\System32\\*.exe", "?:\\Windows\\SysWOW64\\*.exe") and
not (process.executable : "?:\\Users\\*\\AppData\\Local\\Temp\\*\\dismhost.exe" and
process.code_signature.subject_name : "Microsoft*" and process.code_signature.trusted == true)
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.name : "dllhost.exe" and
process.Ext.token.integrity_level_name == "high" and
process.parent.command_line : "*BD54C901-076B-434E-B6C7-17C531F4AB41*" and
process.executable : ("?:\\*\\System32\\*.exe", "?:\\*\\SysWOW64\\*.exe") and
not process.executable : ("?:\\Windows\\System32\\*.exe", "?:\\Windows\\SysWOW64\\*.exe") and
not (process.executable : "?:\\Users\\*\\AppData\\Local\\Temp\\*\\dismhost.exe" and
process.code_signature.subject_name : "Microsoft*" and process.code_signature.trusted == true)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.Ext.token.integrity_level_name | eq |
| field:"process.Ext.token.integrity_level_name" kind:eq value:"high" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"*BD54C901-076B-434E-B6C7-17C531F4AB41*" |
process.parent.name | wildcard |
| field:"parent_process_basename" kind:wildcard value:"dllhost.exe" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.code_signature.subject_name | starts_with | Microsoft | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.executable | wildcard | ?:\Users\*\AppData\Local\Temp\*\dismhost.exe | excludes:process.executable field:"process.executable" value:"?:\Users\*\AppData\Local\Temp\*\dismhost.exe" |
process.executable | wildcard | ?:\Windows\System32\*.exe, ?:\Windows\SysWOW64\*.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\*.exe" field:"process.executable" value:"?:\Windows\SysWOW64\*.exe" |
Unexpected Child Process of macOS Screensaver Engine
#Identifies when a child process is spawned by the screensaver engine process, which is consistent with an attacker's malicious payload being executed after the screensaver activated on the endpoint. An adversary can maintain persistence on a macOS endpoint by creating a malicious screensaver (.saver) file and configuring the screensaver plist file to execute code each time the screensaver is activated.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence |
Rule Body
[metadata]
creation_date = "2021/10/05"
integration = ["endpoint"]
maturity = "production"
updated_date = "2025/02/04"
[rule]
author = ["Elastic"]
description = """
Identifies when a child process is spawned by the screensaver engine process, which is consistent with an attacker's
malicious payload being executed after the screensaver activated on the endpoint. An adversary can maintain persistence
on a macOS endpoint by creating a malicious screensaver (.saver) file and configuring the screensaver plist file to
execute code each time the screensaver is activated.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Unexpected Child Process of macOS Screensaver Engine"
note = """## Triage and analysis
- Analyze the descendant processes of the ScreenSaverEngine process for malicious code and suspicious behavior such
as a download of a payload from a server.
- Review the installed and activated screensaver on the host. Triage the screensaver (.saver) file that was triggered to
identify whether the file is malicious or not.
"""
references = [
"https://posts.specterops.io/saving-your-access-d562bf5bf90b",
"https://github.com/D00MFist/PersistentJXA",
]
risk_score = 47
rule_id = "48d7f54d-c29e-4430-93a9-9db6b5892270"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a macOS System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, for MacOS it is recommended to select "Traditional Endpoints".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "macos" and event.type == "start" and process.parent.name == "ScreenSaverEngine"
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.002"
name = "Screensaver"
reference = "https://attack.mitre.org/techniques/T1546/002/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
Stages and Predicates
Stage 1: process
process where host.os.type == "macos" and event.type == "start" and process.parent.name == "ScreenSaverEngine"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.parent.name | eq |
| field:"parent_process_basename" kind:eq value:"ScreenSaverEngine" |
Windows Installer Execution via Explorer
#Identifies execution from an Msiexec installer in quiet mode and where the parent process is Explorer.exe. This may indicate execution via a malicious Windows shortcut file.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Identifies execution from an Msiexec installer in quiet mode and where the parent process is Explorer.exe. This may
indicate execution via a malicious Windows shortcut file.
"""
id = "65a7fb56-6f18-43d2-b799-a5b7359c8a3b"
license = "Elastic License v2"
name = "Windows Installer Execution via Explorer"
os_list = ["windows"]
reference = ["https://lolbas-project.github.io/lolbas/Binaries/Msiexec/"]
version = "1.0.2"
query = '''
process where event.action == "start" and
process.name : "msiexec.exe" and process.args :("/i", "-i") and process.args : ("/qn", "-qn", "-q", "/q", "/quiet") and
process.parent.executable : "?:\\Windows\\explorer.exe"
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.007"
name = "Msiexec"
reference = "https://attack.mitre.org/techniques/T1218/007/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.name : "msiexec.exe" and process.args :("/i", "-i") and process.args : ("/qn", "-qn", "-q", "/q", "/quiet") and
process.parent.executable : "?:\\Windows\\explorer.exe"
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"msiexec.exe" |
process.parent.executable | wildcard |
| field:"ParentImage" kind:wildcard value:"?:\Windows\explorer.exe" |