Detection rules › Elastic

Elastic rules: 1p

Abnormally Large DNS Response

#
Status
production
Severity
medium
Author
Elastic
Source
github.com/elastic/detection-rules

Specially crafted DNS requests can manipulate a known overflow vulnerability in some Windows DNS servers, resulting in Remote Code Execution (RCE) or a Denial of Service (DoS) from crashing the service.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2020/07/16"
integration = ["network_traffic", "panw", "zeek", "corelight"]
maturity = "production"
updated_date = "2026/09/03"

[rule]
author = ["Elastic"]
description = """
Specially crafted DNS requests can manipulate a known overflow vulnerability in some Windows DNS servers, resulting in
Remote Code Execution (RCE) or a Denial of Service (DoS) from crashing the service.
"""
index = ["logs-network_traffic.*", "logs-panw.panos*", "logs-zeek.*", "logs-corelight.*"]
language = "kuery"
license = "Elastic License v2"
name = "Abnormally Large DNS Response"
note = """## Triage and analysis

### Investigating Abnormally Large DNS Response

Detection alerts from this rule indicate possible anomalous activity around large byte DNS responses from a Windows DNS server. This detection rule was created based on activity represented in exploitation of vulnerability (CVE-2020-1350) also known as [SigRed](https://www.elastic.co/blog/detection-rules-for-sigred-vulnerability) during July 2020.

### Possible investigation steps

- This specific rule is sourced from network log activity such as DNS or network level data. It's important to validate the source of the incoming traffic and determine if this activity has been observed previously within an environment.
- Activity can be further investigated and validated by reviewing any associated Intrusion Detection Signatures (IDS) alerts.
- Further examination can include a review of the `dns.question_type` network fieldset with a protocol analyzer, such as Zeek, Packetbeat, or Suricata, for `SIG` or `RRSIG` data.
- Validate the patch level and OS of the targeted DNS server to validate the observed activity was not large-scale internet vulnerability scanning.
- Validate that the source of the network activity was not from an authorized vulnerability scan or compromise assessment.

### False positive analysis

- Based on this rule, which looks for a threshold of 65k bytes, activity below this value is expected to be legitimate. In packet capture files received by the [SANS Internet Storm Center](https://isc.sans.edu/forums/diary/PATCH+NOW+SIGRed+CVE20201350+Microsoft+DNS+Server+Vulnerability/26356/), byte responses in observed attacks were all greater than 65k bytes.
- This activity can be triggered by compliance/vulnerability scanning or compromise assessment; it's important to determine the source of the activity and potentially allowlist the source host.
- Network security devices such as PAN-OS firewalls, Fortinet, and NetFlow exporters, as well as Zeek/Corelight connection summary records, record `destination.bytes` as the total bytes across an entire session rather than a single DNS response. Long-lived flow or connection records (`event.duration` > 60 seconds) are excluded to reduce this noise. Duration is used rather than packet count because a genuine SigRed TCP exchange completes in seconds and cannot be made to exceed 60 seconds by an attacker continuing to use the connection.

### Related rules

- Unusual Child Process of dns.exe - 8c37dc0e-e3ac-4c97-8aa0-cf6a9122de45
- Unusual File Modification by dns.exe - c7ce36c0-32ff-4f9a-bfc2-dcb242bf99f9

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Ensure that you have deployed the latest Microsoft [Security Update](https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1350) (Monthly Rollup or Security Only) and restarted the patched machines. If unable to patch immediately, Microsoft [released](https://support.microsoft.com/en-us/help/4569509/windows-dns-server-remote-code-execution-vulnerability) a registry-based workaround that doesn’t require a restart. This can be used as a temporary solution before the patch is applied.
- Maintain backups of your critical systems to aid in quick recovery.
- Perform routine vulnerability scans of your systems, monitor [CISA advisories](https://us-cert.cisa.gov/ncas/current-activity) and patch identified vulnerabilities.
- If you observe a true positive, implement a remediation plan and monitor host-based artifacts for additional post-exploitation behavior.
"""
references = [
    "https://research.checkpoint.com/2020/resolving-your-way-into-domain-admin-exploiting-a-17-year-old-bug-in-windows-dns-servers/",
    "https://msrc-blog.microsoft.com/2020/07/14/july-2020-security-update-cve-2020-1350-vulnerability-in-windows-domain-name-system-dns-server/",
    "https://github.com/maxpl0it/CVE-2020-1350-DoS",
    "https://www.elastic.co/security-labs/detection-rules-for-sigred-vulnerability",
]
risk_score = 47
rule_id = "11013227-0301-4a8c-b150-4db924484475"
severity = "medium"
tags = [
    "Use Case: Threat Detection",
    "Tactic: Lateral Movement",
    "Tactic: Impact",
    "Resources: Investigation Guide",
    "Use Case: Vulnerability",
    "Data Source: Corelight",
    "Data Source: PAN-OS",
    "Data Source: Network Traffic",
    "Data Source: Zeek",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
((event.category:(network or network_traffic) and destination.port:53) 
      or network.protocol:"dns" 
      or data_stream.dataset:(network_traffic.dns or zeek.dns)
      or (event.module:corelight and event.dataset:dns))
    and destination.bytes >= 65000
    and event.type:("allowed" or "end" or "protocol" or "start")
and not (
  event.duration > 60000000000
  and (
    event.action:("flow_terminated" or "network_flow")
    or data_stream.dataset:zeek.connection
    or (event.module:corelight and event.dataset:conn)
  )
)
'''


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1210"
name = "Exploitation of Remote Services"
reference = "https://attack.mitre.org/techniques/T1210/"

[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1499"
name = "Endpoint Denial of Service"
reference = "https://attack.mitre.org/techniques/T1499/"

[[rule.threat.technique.subtechnique]]
id = "T1499.004"
name = "Application or System Exploitation"
reference = "https://attack.mitre.org/techniques/T1499/004/"

[rule.threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"

[rule.alert_suppression]
group_by = ["source.ip", "destination.ip"]
missing_fields_strategy = "doNotSuppress"

[rule.alert_suppression.duration]
unit = "h"
value = 1

Stages and Predicates

Stage 1: query

((event.category:(network or network_traffic) and destination.port:53) 
      or network.protocol:"dns" 
      or data_stream.dataset:(network_traffic.dns or zeek.dns)
      or (event.module:corelight and event.dataset:dns))
    and destination.bytes >= 65000
    and event.type:("allowed" or "end" or "protocol" or "start")
and not (
  event.duration > 60000000000
  and (
    event.action:("flow_terminated" or "network_flow")
    or data_stream.dataset:zeek.connection
    or (event.module:corelight and event.dataset:conn)
  )
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

API Call via Timer Callback Event

#
Source
github.com/elastic/protections-artifacts

Identifies API calls via timeSetEvent callback function. This may indicate an attempt to proxy API call via callback.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = "Identifies API calls via timeSetEvent callback function. This may indicate an attempt to proxy API call via callback."
id = "2842dbe3-4ce7-4e4d-b18b-c5eefdaf1fae"
license = "Elastic License v2"
name = "API Call via Timer Callback Event"
os_list = ["windows"]
reference = ["https://learn.microsoft.com/en-us/previous-versions/dd757634(v=vs.85)"]
version = "1.0.4"

query = '''
api where
  process.Ext.api.name in ("VirtualAlloc", "VirtualProtect", "WriteProcessMemory", "VirtualProtectEx", "VirtualAllocEx",
                             "MapViewOfFile", "MapViewOfFile2", "SetThreadContext", "SuspendThread", "ReadProcessMemory", "connect") and
  process.thread.Ext.call_stack_final_user_module.name == "winmm.dll" and
  _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*winmm.dll!timeSetEvent*") and
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.symbol_info: ("*winmm.dll!mciExecute*", "*winmm.dll!timeGetTime*", "*winmm.dll!PlaySoundW*", "*winmm.dll+0x*", "*ntdll.dll!RtlInitializeExceptionChain*")) and
  not (process.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\WakeOnLan.exe" and
       process.parent.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dcwol.exe") and
  not (process.Ext.api.name == "connect" and
       process.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\meaap.exe" and
       process.parent.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\dcconfig.exe")
'''

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 in ("VirtualAlloc", "VirtualProtect", "WriteProcessMemory", "VirtualProtectEx", "VirtualAllocEx",
                             "MapViewOfFile", "MapViewOfFile2", "SetThreadContext", "SuspendThread", "ReadProcessMemory", "connect") and
  process.thread.Ext.call_stack_final_user_module.name == "winmm.dll" and
  _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "*winmm.dll!timeSetEvent*") and
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.symbol_info: ("*winmm.dll!mciExecute*", "*winmm.dll!timeGetTime*", "*winmm.dll!PlaySoundW*", "*winmm.dll+0x*", "*ntdll.dll!RtlInitializeExceptionChain*")) and
  not (process.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\WakeOnLan.exe" and
       process.parent.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\dcwol.exe") and
  not (process.Ext.api.name == "connect" and
       process.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\bin\\meaap.exe" and
       process.parent.executable : "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\dcconfig.exe")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.namein
  • MapViewOfFile corpus 24 (elastic 24)
  • MapViewOfFile2 corpus 24 (elastic 24)
  • ReadProcessMemory corpus 9 (elastic 9)
  • SetThreadContext corpus 14 (elastic 14)
  • SuspendThread corpus 12 (elastic 12)
  • VirtualAlloc corpus 27 (elastic 27)
  • VirtualAllocEx corpus 22 (elastic 22)
  • VirtualProtect corpus 35 (elastic 35)
  • VirtualProtectEx corpus 29 (elastic 29)
  • WriteProcessMemory corpus 23 (elastic 23)
  • connect corpus 8 (elastic 8)
field:"process.Ext.api.name" kind:in
process.thread.Ext.call_stack_final_user_module.nameeq
  • winmm.dll
field:"process.thread.Ext.call_stack_final_user_module.name" kind:eq value:"winmm.dll"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.api.nameeqconnectexcludes:process.Ext.api.name field:"process.Ext.api.name" value:"connect"
process.executableeqC:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\meaap.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\meaap.exe"
process.parent.executableeqC:\Program Files (x86)\ManageEngine\UEMS_Agent\dcconfig.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\ManageEngine\UEMS_Agent\dcconfig.exe"
process.executableeqC:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\WakeOnLan.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\WakeOnLan.exe"
process.parent.executableeqC:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\dcwol.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\ManageEngine\UEMS_Agent\bin\dcwol.exe"
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack

Creation of Hidden Shared Object File

#
Source
github.com/elastic/protections-artifacts

Identifies the creation of a hidden shared object (.so) file. Users can mark specific files as hidden simply by putting a "." as the first character in the file or folder name. Adversaries can use this to their advantage to hide files and folders on the system for persistence and defense evasion.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the creation of a hidden shared object (.so) file. Users can mark specific files as hidden simply by putting
a "." as the first character in the file or folder name. Adversaries can use this to their advantage to hide files and
folders on the system for persistence and defense evasion.
"""
id = "61b20f0f-d342-4b32-bc77-195037b0dc82"
license = "Elastic License v2"
name = "Creation of Hidden Shared Object File"
os_list = ["linux"]
version = "1.0.5"

query = '''
file where event.type == "creation" and file.name like~ ".*.so" and (
  process.name in (
    "sudo", "link", "find", "xargs", "install", "coreutils", "gzip", "bzip2", "mv", "ln", "busybox",
    "bash", "zsh", "sh", "tcsh", "csh", "ksh", "fish", "mksh", "touch", "curl", "wget"
  ) or
  process.name like ".*" or
  process.executable like (
    "./*", "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
    "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/root/*", "/home/*"
  )
) and
not (
  process.executable like (
    "/home/*/.opencode/bin/opencode", "/home/*/.nvm/*/bin/kilo", "/home/*/.vscode-server/*/server/node",
    "/home/*/.local/share/containers/storage/overlay/*/opencode", "./usr/bin/podman",
    "/usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode", "/home/*/.aimee-code/bin/opencode",
    "/root/.opencode/bin/opencode", "/home/*/.opencode/bin/.nfs*",
    "/home/*/.vscode/extensions/kilocode.kilo-code-*/bin/kilo",
    "/home/*/.vscode-server/extensions/kilocode.kilo-code-*/bin/kilo",
    "/root/.vscode-server/extensions/kilocode.kilo-code-*/bin/kilo"
  ) or
  file.name like ("._*", ".*-00000000.so") or
  file.path like ("/home/*/.local/share/containers/storage/overlay/*", "/scratch/user/*/ZEBULON/CODE/.files-libLocal.so") or
  process.executable like (
    "*/node_modules/opencode-ai/bin/opencode*",
    "*/.opencode/bin/opencode*",
    "*/node_modules/@kilocode/cli/bin/.kilo"
  )
)
'''

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 = "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 = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[threat.technique.subtechnique]]
id = "T1564.001"
name = "Hidden Files and Directories"
reference = "https://attack.mitre.org/techniques/T1564/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.type == "creation" and file.name like~ ".*.so" and (
  process.name in (
    "sudo", "link", "find", "xargs", "install", "coreutils", "gzip", "bzip2", "mv", "ln", "busybox",
    "bash", "zsh", "sh", "tcsh", "csh", "ksh", "fish", "mksh", "touch", "curl", "wget"
  ) or
  process.name like ".*" or
  process.executable like (
    "./*", "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
    "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/root/*", "/home/*"
  )
) and
not (
  process.executable like (
    "/home/*/.opencode/bin/opencode", "/home/*/.nvm/*/bin/kilo", "/home/*/.vscode-server/*/server/node",
    "/home/*/.local/share/containers/storage/overlay/*/opencode", "./usr/bin/podman",
    "/usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode", "/home/*/.aimee-code/bin/opencode",
    "/root/.opencode/bin/opencode", "/home/*/.opencode/bin/.nfs*",
    "/home/*/.vscode/extensions/kilocode.kilo-code-*/bin/kilo",
    "/home/*/.vscode-server/extensions/kilocode.kilo-code-*/bin/kilo",
    "/root/.vscode-server/extensions/kilocode.kilo-code-*/bin/kilo"
  ) or
  file.name like ("._*", ".*-00000000.so") or
  file.path like ("/home/*/.local/share/containers/storage/overlay/*", "/scratch/user/*/ZEBULON/CODE/.files-libLocal.so") or
  process.executable like (
    "*/node_modules/opencode-ai/bin/opencode*",
    "*/.opencode/bin/opencode*",
    "*/node_modules/@kilocode/cli/bin/.kilo"
  )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • creation
field:"event.type" kind:eq value:"creation"
file.namewildcard
  • .*.so
field:"file.name" kind:wildcard value:".*.so"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /home/*
  • /lost+found/*
  • /proc/*
  • /root/*
  • /run/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namein
  • bash
  • busybox
  • bzip2
  • coreutils
  • csh
  • curl
  • find
  • fish
  • gzip
  • install
  • ksh
  • link
  • ln
  • mksh
  • mv
  • sh
  • sudo
  • tcsh
  • touch
  • wget
  • xargs
  • zsh
field:"process_basename" kind:in
process.namewildcard
  • .*
field:"process_basename" kind:wildcard value:".*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.namewildcard._*, .*-00000000.soexcludes:file.name field:"file.name" value:"._*" field:"file.name" value:".*-00000000.so"
file.pathwildcard/home/*/.local/share/containers/storage/overlay/*, /scratch/user/*/ZEBULON/CODE/.files-libLocal.soexcludes:file.path field:"file.path" value:"/home/*/.local/share/containers/storage/overlay/*" field:"file.path" value:"/scratch/user/*/ZEBULON/CODE/.files-libLocal.so"
process.executablewildcard*/node_modules/opencode-ai/bin/opencode*, */.opencode/bin/opencode*, */node_modules/@kilocode/cli/bin/.kiloexcludes:process.executable field:"process.executable" value:"*/node_modules/opencode-ai/bin/opencode*" field:"process.executable" value:"*/.opencode/bin/opencode*" field:"process.executable" value:"*/node_modules/@kilocode/cli/bin/.kilo"
process.executablewildcard/home/*/.opencode/bin/opencode, /home/*/.nvm/*/bin/kilo, /home/*/.vscode-server/*/server/node, /home/*/.local/share/containers/storage/overlay/*/opencode, ./usr/bin/podman, /usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode, /home/*/.aimee-code/bin/opencode, /root/.opencode/bin/opencode, /home/*/.opencode/bin/.nfs*, /home/*/.vscode/extensions/kilocode.kilo-code-*/bin/kilo, /home/*/.vscode-server/extensions/kilocode.kilo-code-*/bin/kilo, /root/.vscode-server/extensions/kilocode.kilo-code-*/bin/kiloexcludes:process.executable

Domain Computers Enumeration via LDAP Search

#
Source
github.com/elastic/protections-artifacts

Identifies a list of suspicious LDAP queries often used by reconnaissance tools to enumerate domain computers.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = "Identifies a list of suspicious LDAP queries often used by reconnaissance tools to enumerate domain computers."
id = "0380d8b9-e643-40b9-a763-67ab52021bb4"
license = "Elastic License v2"
name = "Domain Computers Enumeration via LDAP Search"
os_list = ["windows"]
reference = ["https://attack.mitre.org/techniques/T1087/002/"]
version = "1.0.4"

query = '''
api where process.Ext.api.name == "ldap_search" and user.id != "S-1-5-18" and
 not process.executable :
             ("?:\\Program Files\\Azure Advanced Threat Protection Sensor\\*\\Microsoft.Tri.Sensor.exe",
              "?:\\Windows\\ADFS\\Microsoft.IdentityServer.ServiceHost.exe") and
 process.Ext.api.parameters.search_filter : (
  "(&(objectCategory=computer)(operatingSystem=?server?))",
  "(&(sAMAccountType=805306369)(dnshostname=?))",
  "(&(objectCategory=computer)(lastLogon>=*)(operatingSystem=*windows*))",
  "(&(objectCategory=computer)(lastLogonTimestamp<=133000000000000000))",
  "(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288))",
  "(&(objectCategory=Computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))",
  "*(&(objectclass=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))*",
  "(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192)",
  "(&(objectclass=computer)(userAccountControl&8192))",
  "(&(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server?))))",
  "(&(objectCategory=computer)(operatingSystem=?server?)(!(userAccountControl:1.2.840.113556.1.4.803:=8192)))"
 ) and 
 not (process.code_signature.subject_name in ("Specops Software Inc.", "Azul Systems, Inc.") and process.code_signature.trusted == true)
'''

min_endpoint_version = "9.1.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"

[[threat.technique]]
id = "T1087"
name = "Account Discovery"
reference = "https://attack.mitre.org/techniques/T1087/"
[[threat.technique.subtechnique]]
id = "T1087.002"
name = "Domain Account"
reference = "https://attack.mitre.org/techniques/T1087/002/"



[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

[internal]
min_endpoint_version = "9.1.0"

Stages and Predicates

Stage 1: api

api where process.Ext.api.name == "ldap_search" and user.id != "S-1-5-18" and
 not process.executable :
             ("?:\\Program Files\\Azure Advanced Threat Protection Sensor\\*\\Microsoft.Tri.Sensor.exe",
              "?:\\Windows\\ADFS\\Microsoft.IdentityServer.ServiceHost.exe") and
 process.Ext.api.parameters.search_filter : (
  "(&(objectCategory=computer)(operatingSystem=?server?))",
  "(&(sAMAccountType=805306369)(dnshostname=?))",
  "(&(objectCategory=computer)(lastLogon>=*)(operatingSystem=*windows*))",
  "(&(objectCategory=computer)(lastLogonTimestamp<=133000000000000000))",
  "(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288))",
  "(&(objectCategory=Computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))",
  "*(&(objectclass=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))*",
  "(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192)",
  "(&(objectclass=computer)(userAccountControl&8192))",
  "(&(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server?))))",
  "(&(objectCategory=computer)(operatingSystem=?server?)(!(userAccountControl:1.2.840.113556.1.4.803:=8192)))"
 ) and 
 not (process.code_signature.subject_name in ("Specops Software Inc.", "Azul Systems, Inc.") and process.code_signature.trusted == true)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.nameeq
  • ldap_search corpus 14 (elastic 14)
field:"process.Ext.api.name" kind:eq value:"ldap_search"
process.Ext.api.parameters.search_filterwildcard
  • (&(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server?))))
  • (&(objectCategory=Computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))
  • (&(objectCategory=computer)(lastLogon>=*)(operatingSystem=*windows*))
  • (&(objectCategory=computer)(lastLogonTimestamp<=133000000000000000))
  • (&(objectCategory=computer)(operatingSystem=?server?)(!(userAccountControl:1.2.840.113556.1.4.803:=8192)))
  • (&(objectCategory=computer)(operatingSystem=?server?))
  • (&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288))
  • (&(objectclass=computer)(userAccountControl&8192))
  • (&(sAMAccountType=805306369)(dnshostname=?))
  • (objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192)
  • *(&(objectclass=computer)(userAccountControl:1.2.840.113556.1.4.803:=8192))*
field:"process.Ext.api.parameters.search_filter" kind:wildcard
user.idne
  • S-1-5-18 corpus 37 (elastic 37)
field:"user.id" kind:ne value:"S-1-5-18"

Exclusions

The rule actively suppresses these predicates.

Entra ID Temporary Access Pass Created for User

#
Status
production
Severity
high
Time window
9m
Author
Elastic, descambiado
Source
github.com/elastic/detection-rules

Identifies the creation of a Temporary Access Pass (TAP) for an Entra ID user account. A TAP is a time-limited passcode that allows passwordless authentication and bypasses existing MFA requirements, including phishing-resistant methods. An attacker with User Administrator or Authentication Administrator privileges can issue a TAP for a target account, sign in without the current password, and register new persistent authentication methods before the TAP expires.

Known False Positives

  • Help desk teams issuing TAPs for locked-out users or new employee onboarding workflows. Automated identity lifecycle systems that provision TAPs during device enrollment.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/05/20"
integration = ["azure"]
maturity = "production"
updated_date = "2026/06/05"

[rule]
author = ["Elastic", "descambiado"]
description = """
Identifies the creation of a Temporary Access Pass (TAP) for an Entra ID user account. A TAP
is a time-limited passcode that allows passwordless authentication and bypasses existing MFA
requirements, including phishing-resistant methods. An attacker with User Administrator or
Authentication Administrator privileges can issue a TAP for a target account, sign in without
the current password, and register new persistent authentication methods before the TAP expires.
"""
false_positives = [
    """
    Help desk teams issuing TAPs for locked-out users or new employee onboarding workflows. Automated
    identity lifecycle systems that provision TAPs during device enrollment.
    """,
]
from = "now-9m"
index = ["logs-azure.auditlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID Temporary Access Pass Created for User"
note = """## Triage and analysis

### Investigating Entra ID Temporary Access Pass Created for User

A Temporary Access Pass is a time-limited credential that bypasses all existing MFA factors for the
target account. In a steady-state tenant, TAP creation is rare and should be correlated against help
desk records or onboarding workflows.

#### Possible investigation steps

- Identify the administrator who created the TAP (`azure.auditlogs.properties.initiated_by`) and verify
  whether the action was authorized by a help desk ticket or change management record.
- Identify the target account and assess its privilege level -- TAPs issued for Global Administrators,
  Application Administrators, or accounts with high-value data access are highest risk.
- Check for sign-ins by the target account using the TAP credential: look for sign-ins where
  `azure.signinlogs.properties.authentication_details` contains "Temporary Access Pass" shortly after
  the TAP creation event.
- If the TAP was used to sign in, review what authentication methods were registered during or after
  the session -- an attacker will use the TAP window to add a persistent authenticator.
- Check whether the creating administrator's account shows anomalous activity in the preceding 24 hours.

### False positive analysis

- TAP creation by your identity team for locked-out users is a legitimate workflow. Confirm via help
  desk ticket correlation.
- New employee onboarding that provisions TAPs as part of passwordless enrollment is expected behavior.

### Response and remediation

- Revoke the TAP immediately if unauthorized: Entra ID > Users > Authentication methods.
- Audit all authentication methods registered by the target account after TAP creation and remove any
  that were not previously present.
- Reset the target account's password and revoke all active sessions.
- Review the creating administrator's recent actions for signs of compromise.
"""
references = [
    "https://learn.microsoft.com/en-us/entra/identity/authentication/howto-authentication-temporary-access-pass",
    "https://dirkjanm.io/lateral-movement-and-hash-dumping-with-temporary-access-passes-microsoft-entra/",
    "https://specterops.io/blog/2023/03/29/id-tap-that-pass/",
]
risk_score = 73
rule_id = "d0088204-675b-4175-bf07-1665da2d4810"
severity = "high"
tags = [
    "Domain: Cloud",
    "Domain: Identity",
    "Data Source: Azure",
    "Data Source: Microsoft Entra ID",
    "Data Source: Microsoft Entra ID Audit Logs",
    "Use Case: Identity and Access Audit",
    "Tactic: Initial Access",
    "Tactic: Lateral Movement",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset: "azure.auditlogs" and
(
    (
        azure.auditlogs.operation_name: "User registered security info" and
        azure.auditlogs.properties.result_reason: "User registered temporary access pass method"
    ) or (
        azure.auditlogs.operation_name: "Create Temporary Access Pass method for user"
    ) or (
        azure.auditlogs.operation_name: "Admin registered security info" and
        azure.auditlogs.properties.target_resources.*.modified_properties.*.display_name: *TemporaryAccessPass*
    )
) and
event.outcome: ("Success" or "success")
'''

[[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 = "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.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"

Stages and Predicates

Stage 1: query

data_stream.dataset: "azure.auditlogs" and
(
    (
        azure.auditlogs.operation_name: "User registered security info" and
        azure.auditlogs.properties.result_reason: "User registered temporary access pass method"
    ) or (
        azure.auditlogs.operation_name: "Create Temporary Access Pass method for user"
    ) or (
        azure.auditlogs.operation_name: "Admin registered security info" and
        azure.auditlogs.properties.target_resources.*.modified_properties.*.display_name: *TemporaryAccessPass*
    )
) and
event.outcome: ("Success" or "success")

Indicators

These rows show field, operator, and value matches.

Evasion via File Name Masquerading

#
Source
github.com/elastic/protections-artifacts

Adversaries may abuse a double extension or unicode right-to-left override (RTLO or RLO) character (U+202E) or multiple spaces in the filename as a means of masquerading the true file type. A file name may include a secondary file type extension that may cause only the first extension to be displayed which maximize user execution likelihood.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Adversaries may abuse a double extension or unicode right-to-left override (RTLO or RLO) character (U+202E) or multiple
spaces in the filename as a means of masquerading the true file type. A file name may include a secondary file type
extension that may cause only the first extension to be displayed which maximize user execution likelihood.
"""
id = "ccfca0c7-c975-4735-82bd-954ffbafd00b"
license = "Elastic License v2"
name = "Evasion via File Name Masquerading"
os_list = ["windows"]
reference = ["https://www.pcmag.com/encyclopedia/term/double-extension"]
version = "1.0.31"

query = '''
process where event.action == "start" and
 (
  /* double extension in process.name */
  process.name regex~ """.+(\.|\,|\_|\-)(pdf|doc|docx|xls|xlsx|png|jpg|html|txt|rar|ppt|pptx|htm|GIF)\.(scr|exe|com|pif)""" or

  process.name : ("*   pdf.exe", "*_pdf.exe", "*_PO_N.*PDF.exe") or

  /* multiple spaces */
  process.name regex """.+\s{10,}\.(exe|pif|com|scr)""" or
  process.name : "*                    .exe" or 

  /* fake extension via Unicode Right-To-Left-Override technique */
  process.name : "*\u{202E}*"
 ) and

 /* False Positives */
 not process.hash.sha256 : 
             ("1211cb4a560586d4ffb4b1bfd268a8146318af09587a9d5e33703575d5178e77", 
              "582ae3540ba32e7100fe20c0b01d14d1d85167cdb7ee512f596544d7351a2d5e", 
              "b59ac9390d9026ec3b552ebd6f3438c05aab2880d5e17616c13c5d42b6b34c65",
              "a781c337575da892e6c1b2ac26a6272085a127c554dfd68729deb146eca6b837",
              "96234bb98b3266e49ef74ac7accd4644b709355057d5a34b2966e9fa56aadcf3",
              "38473e19af02cb5e6f386f41238da862df72bbc1d7a1e94d838c4b93d6f56e72",
              "5d62d79f6555d7a7edaf3b175312b326df779f9ae8c893e2182e4159f44c9d34",
              "8d0434610280c8f94a0e9c29e4c33b97804fab4ab6fc29531ba76acebd2f5518",
              "7e59dec861a2a9ad68bd2758407c256dedb233cab225683db677ab2d2fbec258",
              "fbd43f9a3567a19427894e61052d1b46f70b7474357ef50de9dc8749fc950509",
              "96234bb98b3266e49ef74ac7accd4644b709355057d5a34b2966e9fa56aadcf3",
              "0ec0ebc7c71ee139ee29fca1e2447b5cc5ec79cb797deb8b560cb05fee3ca3a6",
              "f4e3e2798fe830eac6990d83f568f6cfbba3a194a7787fe224aa1ba90976eaa7",
              "3abbe0ab12a1baa4c0492c5dba9901f3176f23d35998e8f9a1f753880617523c",
              "13fda552b026d0ecba34fbb488a57dbd29187ebef012874eda115ba5c876dade",
              "3e562ff6f8616c623c82b25a6ab2fff7b2832ec2c53ce5c242d047a525f563ff",
              "d0d177839db17d9f30aebe61594dde7e9e8ab82473f3947892cc88ad58939669") and
 not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and process.code_signature.trusted == true) and
 not (process.code_signature.subject_name : ("AVANQUEST SOFTWARE S.A.S", "Jernej Simončič") and process.code_signature.trusted == true) and 
 not process.executable :
             ("?:\\Program Files (x86)\\PlotSoft\\PDFill_PDF_Tools\\PlotSoft_PDF.exe",
              "?:\\Program Files\\Ab Initio\\Ab Initio GDE 4.1.4.0\\Program Files\\ab_zip.exe",
              "C:\\Program Files\\GIMP 3\\lib\\gimp\\3.0\\plug-ins\\file-png\\file-png.exe",
              "C:\\Users\\*\\AppData\\Local\\Programs\\GIMP 3\\lib\\gimp\\3.0\\plug-ins\\file-png\\file-png.exe",
              "\\Device\\Mup\\*\\file-png.exe") and
 not process.parent.executable : ("C:\\Program Files (x86)\\Visionet Systems Inc\\Visionet.DocVu.KofaxExtractionService\\Visionet.DocVu.KofaxExtractionService.exe",
                                  "C:\\Program Files (x86)\\Visionet System Inc\\DocVuOcrService-NPF\\Visionet.DocVu.OCRService.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 = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[threat.technique.subtechnique]]
id = "T1036.002"
name = "Right-to-Left Override"
reference = "https://attack.mitre.org/techniques/T1036/002/"

[[threat.technique.subtechnique]]
id = "T1036.007"
name = "Double File Extension"
reference = "https://attack.mitre.org/techniques/T1036/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 regex~ """.+(\.|\,|\_|\-)(pdf|doc|docx|xls|xlsx|png|jpg|html|txt|rar|ppt|pptx|htm|GIF)\.(scr|exe|com|pif)""" or
  process.name : ("*   pdf.exe", "*_pdf.exe", "*_PO_N.*PDF.exe") or
  process.name regex """.+\s{10,}\.(exe|pif|com|scr)""" or
  process.name : "*                    .exe" or
  process.name : "*\u{202E}*"
 ) and
 not process.hash.sha256 :
             ("1211cb4a560586d4ffb4b1bfd268a8146318af09587a9d5e33703575d5178e77",
              "582ae3540ba32e7100fe20c0b01d14d1d85167cdb7ee512f596544d7351a2d5e",
              "b59ac9390d9026ec3b552ebd6f3438c05aab2880d5e17616c13c5d42b6b34c65",
              "a781c337575da892e6c1b2ac26a6272085a127c554dfd68729deb146eca6b837",
              "96234bb98b3266e49ef74ac7accd4644b709355057d5a34b2966e9fa56aadcf3",
              "38473e19af02cb5e6f386f41238da862df72bbc1d7a1e94d838c4b93d6f56e72",
              "5d62d79f6555d7a7edaf3b175312b326df779f9ae8c893e2182e4159f44c9d34",
              "8d0434610280c8f94a0e9c29e4c33b97804fab4ab6fc29531ba76acebd2f5518",
              "7e59dec861a2a9ad68bd2758407c256dedb233cab225683db677ab2d2fbec258",
              "fbd43f9a3567a19427894e61052d1b46f70b7474357ef50de9dc8749fc950509",
              "96234bb98b3266e49ef74ac7accd4644b709355057d5a34b2966e9fa56aadcf3",
              "0ec0ebc7c71ee139ee29fca1e2447b5cc5ec79cb797deb8b560cb05fee3ca3a6",
              "f4e3e2798fe830eac6990d83f568f6cfbba3a194a7787fe224aa1ba90976eaa7",
              "3abbe0ab12a1baa4c0492c5dba9901f3176f23d35998e8f9a1f753880617523c",
              "13fda552b026d0ecba34fbb488a57dbd29187ebef012874eda115ba5c876dade",
              "3e562ff6f8616c623c82b25a6ab2fff7b2832ec2c53ce5c242d047a525f563ff",
              "d0d177839db17d9f30aebe61594dde7e9e8ab82473f3947892cc88ad58939669") and
 not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and process.code_signature.trusted == true) and
 not (process.code_signature.subject_name : ("AVANQUEST SOFTWARE S.A.S", "Jernej Simončič") and process.code_signature.trusted == true) and
 not process.executable :
             ("?:\\Program Files (x86)\\PlotSoft\\PDFill_PDF_Tools\\PlotSoft_PDF.exe",
              "?:\\Program Files\\Ab Initio\\Ab Initio GDE 4.1.4.0\\Program Files\\ab_zip.exe",
              "C:\\Program Files\\GIMP 3\\lib\\gimp\\3.0\\plug-ins\\file-png\\file-png.exe",
              "C:\\Users\\*\\AppData\\Local\\Programs\\GIMP 3\\lib\\gimp\\3.0\\plug-ins\\file-png\\file-png.exe",
              "\\Device\\Mup\\*\\file-png.exe") and
 not process.parent.executable : ("C:\\Program Files (x86)\\Visionet Systems Inc\\Visionet.DocVu.KofaxExtractionService\\Visionet.DocVu.KofaxExtractionService.exe",
                                  "C:\\Program Files (x86)\\Visionet System Inc\\DocVuOcrService-NPF\\Visionet.DocVu.OCRService.exe")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.nameregex_match
  • .+(.|\,|\_|\-)(pdf|doc|docx|xls|xlsx|png|jpg|html|txt|rar|ppt|pptx|htm|GIF).(scr|exe|com|pif)
  • .+\s{10,}.(exe|pif|com|scr)
field:"process_basename" kind:regex_match
process.namewildcard
  • * .exe
  • * pdf.exe
  • *_PO_N.*PDF.exe
  • *_pdf.exe
  • *‮* corpus 2 (elastic 2)
field:"process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqAVANQUEST SOFTWARE S.A.S, Jernej Simončičexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"AVANQUEST SOFTWARE S.A.S" field:"process.code_signature.subject_name" value:"Jernej Simončič"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executablewildcard?:\Program Files\*.exe, ?:\Program Files (x86)\*.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files\*.exe" field:"process.executable" value:"?:\Program Files (x86)\*.exe"
process.executablewildcard?:\Program Files (x86)\PlotSoft\PDFill_PDF_Tools\PlotSoft_PDF.exe, ?:\Program Files\Ab Initio\Ab Initio GDE 4.1.4.0\Program Files\ab_zip.exe, C:\Program Files\GIMP 3\lib\gimp\3.0\plug-ins\file-png\file-png.exe, C:\Users\*\AppData\Local\Programs\GIMP 3\lib\gimp\3.0\plug-ins\file-png\file-png.exe, \Device\Mup\*\file-png.exeexcludes:process.executable
process.hash.sha256eq1211cb4a560586d4ffb4b1bfd268a8146318af09587a9d5e33703575d5178e77, 582ae3540ba32e7100fe20c0b01d14d1d85167cdb7ee512f596544d7351a2d5e, b59ac9390d9026ec3b552ebd6f3438c05aab2880d5e17616c13c5d42b6b34c65, a781c337575da892e6c1b2ac26a6272085a127c554dfd68729deb146eca6b837, 96234bb98b3266e49ef74ac7accd4644b709355057d5a34b2966e9fa56aadcf3, 38473e19af02cb5e6f386f41238da862df72bbc1d7a1e94d838c4b93d6f56e72, 5d62d79f6555d7a7edaf3b175312b326df779f9ae8c893e2182e4159f44c9d34, 8d0434610280c8f94a0e9c29e4c33b97804fab4ab6fc29531ba76acebd2f5518, 7e59dec861a2a9ad68bd2758407c256dedb233cab225683db677ab2d2fbec258, fbd43f9a3567a19427894e61052d1b46f70b7474357ef50de9dc8749fc950509, 96234bb98b3266e49ef74ac7accd4644b709355057d5a34b2966e9fa56aadcf3, 0ec0ebc7c71ee139ee29fca1e2447b5cc5ec79cb797deb8b560cb05fee3ca3a6, f4e3e2798fe830eac6990d83f568f6cfbba3a194a7787fe224aa1ba90976eaa7, 3abbe0ab12a1baa4c0492c5dba9901f3176f23d35998e8f9a1f753880617523c, 13fda552b026d0ecba34fbb488a57dbd29187ebef012874eda115ba5c876dade, 3e562ff6f8616c623c82b25a6ab2fff7b2832ec2c53ce5c242d047a525f563ff, d0d177839db17d9f30aebe61594dde7e9e8ab82473f3947892cc88ad58939669excludes:process.hash.sha256
process.parent.executableeqC:\Program Files (x86)\Visionet Systems Inc\Visionet.DocVu.KofaxExtractionService\Visionet.DocVu.KofaxExtractionService.exe, C:\Program Files (x86)\Visionet System Inc\DocVuOcrService-NPF\Visionet.DocVu.OCRService.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files (x86)\Visionet Systems Inc\Visionet.DocVu.KofaxExtractionService\Visionet.DocVu.KofaxExtractionService.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\Visionet System Inc\DocVuOcrService-NPF\Visionet.DocVu.OCRService.exe"

First Time Seen AWS Secret Value Accessed in Secrets Manager

#
Status
production
Severity
medium
Time window
6m
Group by
cloud.account.id, user.name
Author
Nick Jones, Elastic
Source
github.com/elastic/detection-rules

An adversary with access to a compromised AWS service such as an EC2 instance, Lambda function, or other service may attempt to leverage the compromised service to access secrets in AWS Secrets Manager. This rule looks for the first time a specific user identity has programmatically retrieved a secret value from Secrets Manager using the GetSecretValue action. This rule assumes that AWS services such as Lambda functions and EC2 instances are setup with IAM role's assigned that have the necessary permissions to access the secrets in Secrets Manager. An adversary with access to a compromised AWS service would rely on its' attached role to access the secrets in Secrets Manager.

Known False Positives

  • Verify whether the user identity, user agent, and/or hostname should be using GetSecretString API for the specified SecretId. If known behavior is causing false positives, it can be exempted from the rule.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2020/07/06"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/05"

[rule]
author = ["Nick Jones", "Elastic"]
description = """
An adversary with access to a compromised AWS service such as an EC2 instance, Lambda function, or other service may
attempt to leverage the compromised service to access secrets in AWS Secrets Manager. This rule looks for the first time
a specific user identity has programmatically retrieved a secret value from Secrets Manager using the GetSecretValue
action. This rule assumes that AWS services such as Lambda functions and EC2 instances are setup with IAM role's
assigned that have the necessary permissions to access the secrets in Secrets Manager. An adversary with access to a
compromised AWS service would rely on its' attached role to access the secrets in Secrets Manager.
"""
false_positives = [
    """
    Verify whether the user identity, user agent, and/or hostname should be using GetSecretString API for the specified
    SecretId. If known behavior is causing false positives, it can be exempted from the rule.
    """,
]
from = "now-6m"
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
language = "kuery"
license = "Elastic License v2"
name = "First Time Seen AWS Secret Value Accessed in Secrets Manager"
note = """## Triage and analysis

### Investigating First Time Seen AWS Secret Value Accessed in Secrets Manager

AWS Secrets Manager is a service that enables the replacement of hardcoded credentials in code, including passwords, with an API call to Secrets Manager to retrieve the secret programmatically.

This rule looks for the retrieval of credentials from Secrets Manager using `GetSecretValue` API calls. This is a [New Terms](https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule) rule indicating this is the first time a specific user identity has successfuly retrieved a secret value from Secrets Manager.

#### Possible investigation steps

- Identify the account and its role in the environment, and inspect the related policy.
- Identify the applications that should use this account.
- Investigate other alerts associated with the user account during the past 48 hours.
- Investigate abnormal values in the `user_agent.original` field by comparing them with the intended and authorized usage and historical data. Suspicious user agent values include non-SDK, AWS CLI, custom user agents, etc.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences involving other users.
- Contact the account owner and confirm whether they are aware of this activity.
- Considering the source IP address and geolocation of the user who issued the command:
    - Do they look normal for the calling user?
    - If the source is an EC2 IP address, is it associated with an EC2 instance in one of your accounts or is the source IP from an EC2 instance that's not under your control?
    - If it is an authorized EC2 instance, is the activity associated with normal behavior for the instance role or roles? Are there any other alerts or signs of suspicious activity involving this instance?
- Review IAM permission policies for the user identity and specific secrets accessed.
- Examine the request parameters. These might indicate the source of the program or the nature of its tasks.
- If you suspect the account has been compromised, scope potentially compromised assets by tracking servers, services, and data accessed by the account in the last 24 hours.

### False positive analysis

- Review `entity.id` values for expected combinations of identity and secret value access. If this is an expected behavior, consider adding exceptions to the rule.
- False positives may occur due to the intended usage of the service. Tuning is needed in order to have higher confidence. Consider adding exceptions — preferably with a combination of user agent and IP address conditions.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Disable or limit the account during the investigation and response.
- Identify the possible impact of the incident and prioritize accordingly; the following actions can help you gain context:
    - Identify the account role in the cloud environment.
    - Assess the criticality of affected services and servers.
    - Work with your IT team to identify and minimize the impact on users.
    - Identify if the attacker is moving laterally and compromising other accounts, servers, or services.
    - Identify any regulatory or legal ramifications related to this activity.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Rotate secrets or delete API keys as needed to revoke the attacker's access to the environment. Work with your IT teams to minimize the impact on business operations during these actions.
- Check if unauthorized new users were created, remove unauthorized new accounts, and request password resets for other IAM users.
- Consider enabling multi-factor authentication for users.
- Review the permissions assigned to the implicated user to ensure that the least privilege principle is being followed.
- Implement security best practices [outlined](https://aws.amazon.com/premiumsupport/knowledge-center/security-best-practices/) by AWS.
- Take the actions needed to return affected systems, data, or services to their normal operational levels.
- Identify the initial vector abused by the attacker and take action to prevent reinfection via the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
references = [
    "https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html",
    "https://detectioninthe.cloud/ttps/credential_access/access_secret_in_secrets_manager/",
    "https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_BatchGetSecretValue.html",
    "https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-services/aws-secrets-manager-enum",
]
risk_score = 47
rule_id = "a00681e3-9ed6-447c-ab2c-be648821c622"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Platform: AWS",
    "Data Source: AWS CloudTrail",
    "Service: AWS Secrets Manager",
    "Tactic: Credential Access",
    "Rule Type: New Terms",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
data_stream.dataset: aws.cloudtrail 
    and event.provider: secretsmanager.amazonaws.com 
    and event.action: GetSecretValue 
    and event.outcome: success
    and not user_agent.original: *Fargate*
    and not user.id: AWSServiceRole*
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1555"
name = "Credentials from Password Stores"
reference = "https://attack.mitre.org/techniques/T1555/"
[[rule.threat.technique.subtechnique]]
id = "T1555.006"
name = "Cloud Secrets Management Stores"
reference = "https://attack.mitre.org/techniques/T1555/006/"



[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"

[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.access_key_id",
    "event.action",
    "event.outcome",
    "cloud.account.id",
    "cloud.region",
    "aws.cloudtrail.request_parameters",
]

[rule.new_terms]
field = "new_terms_fields"
value = ["cloud.account.id", "user.name"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"


Stages and Predicates

Stage 1: new_terms

data_stream.dataset: aws.cloudtrail 
    and event.provider: secretsmanager.amazonaws.com 
    and event.action: GetSecretValue 
    and event.outcome: success
    and not user_agent.original: *Fargate*
    and not user.id: AWSServiceRole*

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
data_stream.dataseteq
  • aws.cloudtrail corpus 143 (elastic 143)
field:"data_stream.dataset" kind:eq value:"aws.cloudtrail"
event.actioneq
  • GetSecretValue corpus 2 (elastic 2)
field:"EventType" kind:eq value:"GetSecretValue"
event.outcomeeq
  • success corpus 306 (elastic 306)
field:"event.outcome" kind:eq value:"success"
event.providereq
  • secretsmanager.amazonaws.com corpus 2 (elastic 2)
field:"Provider_Name" kind:eq value:"secretsmanager.amazonaws.com"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
user.idstarts_withAWSServiceRoleexcludes:user.id field:"user.id" value:"AWSServiceRole"
user_agent.originalmatchFargateexcludes:user_agent.original field:"user_agent.original" value:"Fargate"

GitHub Actions Workflow Modification Blocked

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects when a GitHub Actions workflow attempts to create or modify workflow files in a protected branch but is blocked due to insufficient permissions. This behavior is indicative of a supply chain attack where a malicious package or compromised CI/CD pipeline attempts to inject persistent backdoor workflows into a repository.

Known False Positives

  • Legitimate CI/CD automation that requires workflow file modifications may trigger this alert if not properly configured with the necessary permissions. Review the workflow configuration and ensure the GITHUB_TOKEN or PAT has the required 'workflows' permission if the modification is intentional.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2025/12/05"
integration = ["github"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Detects when a GitHub Actions workflow attempts to create or modify workflow files in a protected branch but is blocked
due to insufficient permissions. This behavior is indicative of a supply chain attack where a malicious package or
compromised CI/CD pipeline attempts to inject persistent backdoor workflows into a repository.
"""
false_positives = [
    """
    Legitimate CI/CD automation that requires workflow file modifications may trigger this alert if not properly
    configured with the necessary permissions. Review the workflow configuration and ensure the GITHUB_TOKEN or PAT has
    the required 'workflows' permission if the modification is intentional.
    """,
]
from = "now-9m"
interval = "8m"
language = "esql"
license = "Elastic License v2"
name = "GitHub Actions Workflow Modification Blocked"
note = """## Triage and analysis

### Investigating GitHub Actions Workflow Modification Blocked

This rule detects attempts to push workflow files to a GitHub repository from within a GitHub Actions workflow that are blocked by GitHub's security controls. This is a key indicator of supply chain attacks where malicious code attempts to establish persistence by injecting backdoor workflows.

### Possible investigation steps

- Review the `github.repo` field to identify which repository was targeted.
- Examine the `github.actor_id` to determine if the action was triggered by a bot (`github-actions[bot]`) or a user account (PAT-based).
- Check recent workflow runs in the repository for suspicious activity, especially in jobs that run `npm install` or other package manager commands.
- Review the repository's dependencies for recently added or updated packages that may contain malicious preinstall/postinstall hooks.
- Examine the `github.reasons.message` field for details on which workflow file was being created or modified.
- Search for other repositories in the organization that may have the same malicious dependency.
- Review GitHub audit logs for successful workflow file modifications that may have occurred before protections were enabled.

### False positive analysis

- Legitimate automation tools that manage workflow files may trigger this alert. Verify if the repository uses tools like Dependabot, Renovate, or custom automation that modifies workflows.
- CI/CD pipelines that intentionally update workflow files should use a PAT with the 'workflows' scope and be documented.

### Response and remediation

- If this is a confirmed attack attempt, immediately audit all dependencies in the affected repository.
- Remove any suspicious packages and regenerate lock files.
- Rotate any secrets that may have been exposed during the CI run.
- Review and revoke any PATs that may have been compromised.
- Enable branch protection rules requiring pull request reviews for workflow file changes.
- Consider implementing CODEOWNERS for `.github/workflows/` directory.
- Search for indicators of compromise such as unexpected workflow files (e.g., `discussion_*.yaml`, `formatter_*.yml`).
"""
references = ["https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack"]
risk_score = 47
rule_id = "e8b37f18-4804-4819-8602-4aba1169c9f4"
severity = "medium"
tags = [
    "Domain: Cloud",
    "Use Case: Threat Detection",
    "Tactic: Initial Access",
    "Tactic: Persistence",
    "Tactic: Execution",
    "Data Source: Github",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-github.audit-* metadata _id, _index, _version
| where
    data_stream.dataset == "github.audit" and
    event.action == "protected_branch.rejected_ref_update" and
    github.category == "protected_branch" and
    github.reasons.code == "workflow_updates" and
    match(github.reasons.message::STRING, "refusing to allow a GitHub App to create or update workflow")
| keep *
'''


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"

[[rule.threat.technique.subtechnique]]
id = "T1195.001"
name = "Compromise Software Dependencies and Development Tools"
reference = "https://attack.mitre.org/techniques/T1195/001/"

[[rule.threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/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 = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"

[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

Stages and Predicates

Stage 1: from

from logs-github.audit-* metadata _id, _index, _version

Stage 2: where

| where
    data_stream.dataset == "github.audit" and
    event.action == "protected_branch.rejected_ref_update" and
    github.category == "protected_branch" and
    github.reasons.code == "workflow_updates" and
    match(github.reasons.message::STRING, "refusing to allow a GitHub App to create or update workflow")

Stage 3: keep

| keep *

Indicators

These rows show field, operator, and value matches.

Output Fields

The rule emits every field available at its final step.

Google Workspace Suspended User Account Renewed

#
Status
production
Severity
high
Time window
130m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects when a previously suspended user's account is renewed in Google Workspace. An adversary may renew a suspended user account to maintain access to the Google Workspace organization with a valid account.

Known False Positives

  • Google Workspace administrators may renew a suspended user account if the user is expected to continue employment at the organization after temporary leave. Suspended user accounts are typically used by administrators to remove access to the user while actions is taken to transfer important documents and roles to other users, prior to deleting the user account and removing the license.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2020/11/17"
integration = ["google_workspace"]
maturity = "production"
updated_date = "2026/07/08"

[rule]
author = ["Elastic"]
description = """
Detects when a previously suspended user's account is renewed in Google Workspace. An adversary may renew a suspended
user account to maintain access to the Google Workspace organization with a valid account.
"""
false_positives = [
    """
    Google Workspace administrators may renew a suspended user account if the user is expected to continue employment at
    the organization after temporary leave. Suspended user accounts are typically used by administrators to remove
    access to the user while actions is taken to transfer important documents and roles to other users, prior to
    deleting the user account and removing the license.
    """,
]
from = "now-130m"
index = ["filebeat-*", "logs-google_workspace.admin-*"]
interval = "10m"
language = "kuery"
license = "Elastic License v2"
name = "Google Workspace Suspended User Account Renewed"
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 Google Workspace Suspended User Account Renewed

Google Workspace manages user identities and access, crucial for organizational security. Adversaries may exploit the renewal of suspended accounts to regain unauthorized access, bypassing security measures. The detection rule identifies such events by monitoring specific administrative actions, helping analysts spot potential misuse and maintain secure access controls.

### Possible investigation steps

- Review the event logs for the specific action `UNSUSPEND_USER` to identify the user account that was renewed and gather details about the timing and context of the action.
- Check the identity of the administrator or service account that performed the `UNSUSPEND_USER` action to determine if the action was authorized or if there are signs of account compromise.
- Investigate the history of the suspended user account to understand why it was initially suspended and assess any potential risks associated with its renewal.
- Examine recent activity logs for the renewed user account to identify any suspicious behavior or unauthorized access attempts following the account's reactivation.
- Cross-reference the event with other security alerts or incidents to determine if the renewal is part of a broader pattern of suspicious activity within the organization.

### False positive analysis

- Routine administrative actions may trigger the rule when IT staff unsuspend accounts for legitimate reasons, such as resolving a temporary issue. To manage this, create exceptions for known IT personnel or specific administrative actions that are part of regular account maintenance.
- Automated processes or scripts that unsuspend accounts as part of a workflow can also lead to false positives. Identify and document these processes, then exclude them from triggering alerts by using specific identifiers or tags associated with the automation.
- User accounts that are temporarily suspended due to policy violations or inactivity and later reinstated can cause false positives. Implement a review process to verify the legitimacy of these reinstatements and adjust the rule to exclude such cases when they are part of a documented policy.

### Response and remediation

- Immediately review the user account activity logs to determine if any unauthorized actions were taken after the account was unsuspended. Focus on sensitive data access and changes to security settings.
- Temporarily suspend the user account again to prevent further unauthorized access while the investigation is ongoing.
- Notify the security team and relevant stakeholders about the potential security incident to ensure coordinated response efforts.
- Conduct a thorough review of the account's permissions and access levels to ensure they align with the user's current role and responsibilities. Adjust as necessary to follow the principle of least privilege.
- If malicious activity is confirmed, initiate a password reset for the affected account and any other accounts that may have been compromised.
- Implement additional monitoring on the affected account and similar accounts to detect any further suspicious activity.
- Review and update security policies and procedures related to account suspension and reactivation to prevent similar incidents in the future.

## Setup

The Google Workspace Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.

### Important Information Regarding Google Workspace Event Lag Times
- As per Google's documentation, Google Workspace administrators may observe lag times ranging from minutes up to 3 days between the time of an event's occurrence and the event being visible in the Google Workspace admin/audit logs.
- This rule is configured to run every 10 minutes with a lookback time of 130 minutes.
- To reduce the risk of false negatives, consider reducing the interval that the Google Workspace (formerly G Suite) Filebeat module polls Google's reporting API for new events.
- By default, `var.interval` is set to 2 hours (2h). Consider changing this interval to a lower value, such as 10 minutes (10m).
- See the following references for further information:
  - https://support.google.com/a/answer/7061566
  - https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-google_workspace.html"""
references = [
    "https://support.google.com/a/answer/1110339",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-one",
    "https://www.elastic.co/security-labs/google-workspace-attack-surface-part-two",
]
risk_score = 73
rule_id = "00678712-b2df-11ed-afe9-f661ea17fbcc"
severity = "high"
tags = [
    "Domain: Cloud",
    "Data Source: Google Workspace",
    "Use Case: Identity and Access Audit",
    "Tactic: Initial Access",
    "Tactic: Persistence",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset: google_workspace.admin and google_workspace.event.type: "USER_SETTINGS" and event.action: "UNSUSPEND_USER"
'''


[[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 = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[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.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/"

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user.email",
    "source.ip",
    "google_workspace.actor.type",
    "user.target.email",
    "event.action",
    "cloud.account.id",
]

Stages and Predicates

Stage 1: query

data_stream.dataset: google_workspace.admin and google_workspace.event.type: "USER_SETTINGS" and event.action: "UNSUSPEND_USER"

Indicators

These rows show field, operator, and value matches.

Interactive Terminal Spawned via Python

#
Status
production
Severity
high
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies when a terminal (tty) is spawned via Python. Attackers may upgrade a simple reverse shell to a fully interactive tty after obtaining initial access to a host.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2020/04/15"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
Identifies when a terminal (tty) is spawned via Python. Attackers may upgrade a simple reverse shell to a fully
interactive tty after obtaining initial access to a host.
"""
from = "now-9m"
index = [
    "endgame-*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*"
]
language = "eql"
license = "Elastic License v2"
name = "Interactive Terminal Spawned via Python"
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 Interactive Terminal Spawned via Python

Python's ability to spawn interactive terminals is a powerful feature often used for legitimate administrative tasks. However, adversaries can exploit this to escalate a basic reverse shell into a fully interactive terminal, enhancing their control over a compromised system. The detection rule identifies such abuse by monitoring processes where Python spawns a shell, focusing on specific patterns in process arguments and parent-child process relationships, indicating potential malicious activity.

### Possible investigation steps

- Review the process tree to understand the parent-child relationship, focusing on the parent process named "python*" and the child process that is a shell (e.g., bash, sh, zsh).
- Examine the command-line arguments of the parent Python process to identify the use of "pty.spawn" and the presence of the "-c" flag, which may indicate an attempt to spawn an interactive terminal.
- Check the process start event details, including the timestamp and user context, to determine if the activity aligns with expected administrative tasks or if it appears suspicious.
- Investigate the source IP address and user account associated with the process to assess if they are known and authorized entities within the network.
- Look for any related alerts or logs that might indicate prior suspicious activity, such as initial access vectors or other execution attempts, to build a timeline of events.
- Correlate this activity with any recent changes or incidents reported on the host to determine if this is part of a larger attack or an isolated event.

### False positive analysis

- Administrative scripts or automation tools that use Python to manage system processes may trigger this rule. To handle this, identify and whitelist specific scripts or tools that are known to perform legitimate tasks.
- Developers or system administrators using Python for interactive debugging or system management might inadvertently match the rule's criteria. Consider excluding processes initiated by trusted user accounts or within specific directories associated with development or administration.
- Scheduled tasks or cron jobs that utilize Python to execute shell commands could be mistaken for malicious activity. Review and exclude these tasks by specifying their unique process arguments or parent-child process relationships.
- Security tools or monitoring solutions that leverage Python for executing shell commands as part of their normal operation may also trigger this rule. Identify these tools and create exceptions based on their process signatures or execution context.

### Response and remediation

- Immediately isolate the affected host from the network to prevent further unauthorized access or lateral movement.
- Terminate any suspicious Python processes identified in the alert, especially those spawning shell processes, to disrupt the attacker's control.
- Conduct a thorough review of the affected system for any additional signs of compromise, such as unauthorized user accounts, scheduled tasks, or modified system files.
- Reset credentials for any accounts accessed from the compromised host to prevent further unauthorized access.
- Apply security patches and updates to the affected system to address any vulnerabilities that may have been exploited.
- Enhance monitoring and logging on the affected host and network to detect any similar activities in the future, focusing on process creation and network connections.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected."""
risk_score = 73
rule_id = "d76b02ef-fc95-4001-9297-01cb7412232f"
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 = "high"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "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") and
(
  (process.parent.name : "python*" and process.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh",
   "fish") and process.parent.args_count >= 3 and process.parent.args : "*pty.spawn*" and process.parent.args : "-c") or
  (process.parent.name : "python*" and process.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
   process.args in (
     "sh", "dash", "bash", "zsh",
     "/bin/sh", "/bin/dash", "/bin/bash", "/bin/zsh",
     "/usr/bin/sh", "/usr/bin/dash", "/usr/bin/bash", "/usr/bin/zsh",
     "/usr/local/bin/sh", "/usr/local/bin/dash", "/usr/local/bin/bash", "/usr/local/bin/zsh"
   ) and process.args_count == 1 and process.parent.args_count == 1
  )
)
'''

[[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.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"

[[rule.threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start") and
(
  (process.parent.name : "python*" and process.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh",
   "fish") and process.parent.args_count >= 3 and process.parent.args : "*pty.spawn*" and process.parent.args : "-c") or
  (process.parent.name : "python*" and process.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
   process.args in (
     "sh", "dash", "bash", "zsh",
     "/bin/sh", "/bin/dash", "/bin/bash", "/bin/zsh",
     "/usr/bin/sh", "/usr/bin/dash", "/usr/bin/bash", "/usr/bin/zsh",
     "/usr/local/bin/sh", "/usr/local/bin/dash", "/usr/local/bin/bash", "/usr/local/bin/zsh"
   ) and process.args_count == 1 and process.parent.args_count == 1
  )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • exec
  • exec_event
  • start
field:"EventType" kind:in
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argsin
  • /bin/bash
  • /bin/dash
  • /bin/sh
  • /bin/zsh
  • /usr/bin/bash
  • /usr/bin/dash
  • /usr/bin/sh
  • /usr/bin/zsh
  • /usr/local/bin/bash
  • /usr/local/bin/dash
  • /usr/local/bin/sh
  • /usr/local/bin/zsh
  • bash
  • dash
  • sh
  • zsh
field:"process.args" kind:in
process.args_counteq
  • 1 transforms: number
field:"process.args_count" kind:eq value:"1"
process.namein
  • ash
  • bash
  • csh
  • dash
  • fish
  • ksh
  • sh
  • tcsh
  • zsh
field:"process_basename" kind:in
process.parent.argswildcard
  • *pty.spawn*
  • -c
field:"process.parent.args" kind:wildcard
process.parent.args_counteq
  • 1 transforms: number
field:"process.parent.args_count" kind:eq value:"1"
process.parent.args_countge
  • 3 transforms: number
field:"process.parent.args_count" kind:ge value:"3"
process.parent.namewildcard
  • python*
field:"parent_process_basename" kind:wildcard value:"python*"

Kubelet API Connection Attempt to Internal IP

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Detects network connection attempts to the Kubernetes Kubelet API port (10250/10255) on internal IP ranges from Linux hosts. This rule focuses on common request and scripting utilities (curl, wget, python, node, etc.) and executions from world-writable or ephemeral paths (/tmp, /var/tmp, /dev/shm, /var/run), which are frequently abused during container and cluster lateral movement.

Known False Positives

  • Legitimate node health checks, diagnostics, or in-cluster agents may access the Kubelet API on port 10250. Validate the calling process, command line, and whether the destination is the local node or another node.

MITRE ATT&CK Coverage

TacticTechniques
Discovery
Lateral Movement

Rule Body

[metadata]
creation_date = "2026/04/28"
integration = ["endpoint", "auditd_manager"]
maturity = "production"
updated_date = "2026/04/28"

[rule]
author = ["Elastic"]
description = """
Detects network connection attempts to the Kubernetes Kubelet API port (10250/10255) on internal IP ranges from Linux hosts.
This rule focuses on common request and scripting utilities (curl, wget, python, node, etc.) and executions from
world-writable or ephemeral paths (/tmp, /var/tmp, /dev/shm, /var/run), which are frequently abused during container and
cluster lateral movement.
"""
false_positives = [
    """
    Legitimate node health checks, diagnostics, or in-cluster agents may access the Kubelet API on port 10250. Validate
    the calling process, command line, and whether the destination is the local node or another node.
    """,
]
from = "now-9m"
index = ["auditbeat-*", "logs-auditd_manager.auditd-*", "logs-endpoint.events.network*"]
language = "eql"
license = "Elastic License v2"
name = "Kubelet API Connection Attempt to Internal IP"
note = """## Triage and analysis

### Investigating Kubelet API Connection Attempt to Internal IP

This alert indicates a process on a Linux host attempted to connect to port 10250 (Kubelet API) on an internal or
loopback IP address, including IPv4 private ranges and IPv6 localhost. Kubelet access is commonly abused to enumerate
pods, retrieve logs, or execute commands on nodes when authentication or network controls are weak.

### Possible investigation steps

- Review the initiating process (`process.*`) and its executable path; prioritize processes running from `/tmp`,
  `/var/tmp`, `/dev/shm`, or `/var/run`, and suspicious interpreters or downloaders.
- Determine whether the destination IP is the local node, another node, or a management host, and whether connectivity to
  10250 is expected for this workload/user.
- Correlate with process argument telemetry for HTTP URLs, kubelet endpoints (e.g., `/pods`, `/runningpods`, `/exec`), and
  subsequent Kubernetes API audit activity or credential access.

### False positive analysis

- Approved troubleshooting (SRE/cluster operator) sessions that validate Kubelet reachability on the node.
- In-cluster agents that legitimately scrape or query the Kubelet (confirm vendor, image, and deployment).

### Response and remediation

- Restrict pod-to-node access to 10250 using network policies/security groups where possible.
- Rotate and revoke any exposed Kubernetes credentials and investigate for follow-on cluster discovery or execution.
"""
references = [
    "https://attack.mitre.org/techniques/T1021/",
    "https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/",
]
risk_score = 47
rule_id = "9f420cca-cb27-44db-a13d-c43c7b48e04a"
setup = """## Setup

### Auditd Manager: emitting network connection telemetry

This rule is written against `event.category:network` events. Elastic Defend provides this natively. For Auditd Manager,
you typically need to audit network-related syscalls (for example `connect`) and rely on the integration/pipeline to map
those syscall events into ECS-like network events.

If you are not seeing `event.category:network` for Auditd Manager data, add syscall audit rules for network connections.
The example below is a starting point and may need to be adjusted for your environment and noise tolerance:

```
# 64-bit
-a always,exit -F arch=b64 -S connect -S accept -S accept4 -S sendto -S recvfrom -k netconn

# 32-bit (if applicable)
-a always,exit -F arch=b32 -S connect -S accept -S accept4 -S sendto -S recvfrom -k netconn
```

After enabling, validate that events include `destination.ip`, `destination.port`, and a populated `process.*` context.
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "Domain: Container",
    "Domain: Kubernetes",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Lateral Movement",
    "Tactic: Discovery",
    "Data Source: Elastic Defend",
    "Data Source: Auditd Manager",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
network where host.os.type == "linux" and event.type == "start" and event.category == "network" and network.direction == "egress" and 
  event.action in ("connected-to", "connection_attempted") and (destination.port == 10250 or destination.port == 10255) and
  cidrmatch(
    destination.ip,
    "127.0.0.0/8",
    "10.0.0.0/8",
    "172.16.0.0/12",
    "192.168.0.0/16",
    "169.254.0.0/16",
    "100.64.0.0/10",
    "::1/128",
    "fc00::/7",
    "fe80::/10"
  ) and
  (
    process.name in ("curl", "wget", "nc", "ncat", "netcat", "socat", "openssl", "perl", "busybox") or 
    process.name like ".*" or process.executable like "/*/.*" or 
    process.name like ("python*", "ruby*", "node*", "java*", "lua*", "apache*", "php*", "nginx", "httpd*", "lighttpd", "caddy", "mongrel_rails", "gunicorn", 
                       "uwsgi", "openresty", "cherokee", "h2o", "resin", "puma", "unicorn", "traefik", "tornado", "hypercorn", 
                       "daphne", "twistd", "yaws", "webfsd", "flask", "rails", "mongrel", "catalina.sh", "hiawatha", "lswsctrl") or
    process.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/var/run/*", "/home/*", "/run/user/*", "/busybox/*")
  )
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1021"
name = "Remote Services"
reference = "https://attack.mitre.org/techniques/T1021/"

[rule.threat.tactic]
id = "TA0008"
name = "Lateral Movement"
reference = "https://attack.mitre.org/tactics/TA0008/"


[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1613"
name = "Container and Resource Discovery"
reference = "https://attack.mitre.org/techniques/T1613/"

[rule.threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"

Stages and Predicates

Stage 1: network

network where host.os.type == "linux" and event.type == "start" and event.category == "network" and network.direction == "egress" and 
  event.action in ("connected-to", "connection_attempted") and (destination.port == 10250 or destination.port == 10255) and
  cidrmatch(
    destination.ip,
    "127.0.0.0/8",
    "10.0.0.0/8",
    "172.16.0.0/12",
    "192.168.0.0/16",
    "169.254.0.0/16",
    "100.64.0.0/10",
    "::1/128",
    "fc00::/7",
    "fe80::/10"
  ) and
  (
    process.name in ("curl", "wget", "nc", "ncat", "netcat", "socat", "openssl", "perl", "busybox") or 
    process.name like ".*" or process.executable like "/*/.*" or 
    process.name like ("python*", "ruby*", "node*", "java*", "lua*", "apache*", "php*", "nginx", "httpd*", "lighttpd", "caddy", "mongrel_rails", "gunicorn", 
                       "uwsgi", "openresty", "cherokee", "h2o", "resin", "puma", "unicorn", "traefik", "tornado", "hypercorn", 
                       "daphne", "twistd", "yaws", "webfsd", "flask", "rails", "mongrel", "catalina.sh", "hiawatha", "lswsctrl") or
    process.executable like ("/tmp/*", "/var/tmp/*", "/dev/shm/*", "/var/run/*", "/home/*", "/run/user/*", "/busybox/*")
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.ipcidr_match
  • 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.168.0.0/16
  • ::1/128
  • fc00::/7
  • fe80::/10
field:"dest_ip" kind:cidr_match
destination.porteq
  • 10250 transforms: number
  • 10255 transforms: number
field:"DestinationPort" kind:eq
event.actionin
  • connected-to
  • connection_attempted
field:"EventType" kind:in
event.categoryeq
  • network
field:"event.category" kind:eq value:"network"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
network.directioneq
  • egress
field:"Initiated" kind:eq value:"egress"
process.executablewildcard
  • /*/.*
  • /busybox/*
  • /dev/shm/*
  • /home/*
  • /run/user/*
  • /tmp/*
  • /var/run/*
  • /var/tmp/*
field:"Image" kind:wildcard
process.namein
  • busybox
  • curl
  • nc
  • ncat
  • netcat
  • openssl
  • perl
  • socat
  • wget
field:"process_basename" kind:in
process.namewildcard
  • .*
  • apache*
  • caddy
  • catalina.sh
  • cherokee
  • daphne
  • flask
  • gunicorn
  • h2o
  • hiawatha
  • httpd*
  • hypercorn
  • java*
  • lighttpd
  • lswsctrl
  • lua*
  • mongrel
  • mongrel_rails
  • nginx
  • node*
  • openresty
  • php*
  • puma
  • python*
  • rails
  • resin
  • ruby*
  • tornado
  • traefik
  • twistd
  • unicorn
  • uwsgi
  • webfsd
  • yaws
field:"process_basename" kind:wildcard

M365 Identity Device Code Grant by an Unusual User (Non-Compliant Device)

#
Status
production
Severity
medium
Time window
9m
Group by
o365.audit.UserId
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies a Microsoft 365 user completing an OAuth device code grant ("Cmsi:Cmsi") from a non-compliant device for the first time within the rule's historical window, regardless of the requesting application or target resource. Device code phishing kits complete the full login (password and MFA) at the genuine Microsoft endpoint and harvest the resulting token by polling, so MFA does not stop them. Because the victim authorizes the flow in their own browser, the grant is frequently completed on a personal or attacker-controlled device that is not enrolled or compliant with the organization's device policies. A user appearing with this device code flow on a non-compliant device for the first time in the lookback window is a strong early indicator of device code phishing, and removing the application and target constraints catches grants against any first-party application, not just the Microsoft Authentication Broker.

Known False Positives

  • A user legitimately using the device code flow for the first time on a personal or otherwise non-compliant device, such as a smart TV, kiosk, IoT device, conference room device, or a personal laptop for a CLI or headless developer workflow. Review the source ASN, geolocation, application, and the user's device posture to confirm whether the activity is expected before escalating.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2026/06/02"
integration = ["o365"]
maturity = "production"
updated_date = "2026/06/02"

[rule]
author = ["Elastic"]
description = """
Identifies a Microsoft 365 user completing an OAuth device code grant ("Cmsi:Cmsi") from a non-compliant device for the
first time within the rule's historical window, regardless of the requesting application or target resource. Device code
phishing kits complete the full login (password and MFA) at the genuine Microsoft endpoint and harvest the resulting
token by polling, so MFA does not stop them. Because the victim authorizes the flow in their own browser, the grant is
frequently completed on a personal or attacker-controlled device that is not enrolled or compliant with the
organization's device policies. A user appearing with this device code flow on a non-compliant device for the first time
in the lookback window is a strong early indicator of device code phishing, and removing the application and target
constraints catches grants against any first-party application, not just the Microsoft Authentication Broker.
"""
false_positives = [
    """
    A user legitimately using the device code flow for the first time on a personal or otherwise non-compliant device,
    such as a smart TV, kiosk, IoT device, conference room device, or a personal laptop for a CLI or headless developer
    workflow. Review the source ASN, geolocation, application, and the user's device posture to confirm whether the
    activity is expected before escalating.
    """,
]
from = "now-9m"
index = ["logs-o365.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "M365 Identity Device Code Grant by an Unusual User (Non-Compliant Device)"
note = """## Triage and analysis

### Investigating M365 Identity Device Code Grant by an Unusual User (Non-Compliant Device)

This rule detects a user completing an OAuth device code grant (`Cmsi:Cmsi`) from a device reported as non-compliant in the Microsoft 365 unified audit log for the first time within the rule's historical window (defined by the new terms history setting), independent of the requesting application or target resource. A match means the user has not been seen in this flow during the lookback window, not necessarily that it has never happened. Device code phishing kits (for example Kali365, Storm-2372 tradecraft) drive the device code flow against the genuine Microsoft endpoint and poll the token endpoint in the background, so the victim satisfies MFA while the attacker harvests a fully MFA-satisfied token, typically completed from a personal or attacker-controlled device that is not enrolled or compliant.

### Possible investigation steps

- Review `o365.audit.UserId` to identify the impacted account and confirm whether the user expected to perform a device code sign-in.
- Examine `o365.audit.DeviceProperties` to understand the device posture (compliance, management state, OS, browser) and whether the device is recognized for this user.
- Confirm `o365.audit.ApplicationId` and `o365.audit.Target.ID` to identify the application and resource the grant was for. Authentication Broker (`29d9ed98-a469-4536-ade2-f981bc1d605e`) and developer tooling (Azure CLI, PowerShell) are commonly abused.
- Inspect `source.as.number`, `source.as.organization.name`, `source.ip`, and `source.geo.*` and compare with the user's normal sign-in origins. Hosting, VPN, or datacenter providers are unusual for interactive user authentication.
- Examine `user_agent.original` for automation or headless-browser patterns.
- Pivot to `azure.signinlogs` for the corresponding `deviceCode` sign-in, conditional access decisions, and any concurrent non-interactive token-issuance legs from a different ASN (the kit's polling backend).
- Pivot to `azure.graphactivitylogs` for follow-up Graph activity (`/me` recon, mailbox or file enumeration).
- Check `azure.auditlogs` for subsequent device registration events on the user, which device code phishing kits use to establish Primary Refresh Token persistence.

### False positive analysis

- A legitimate first-time device code sign-in on a personal or non-compliant device.
- Provisioning of input-constrained devices (smart TVs, kiosks, IoT, conference room devices).
- CLI or headless developer workflows using the device code flow on an unmanaged device.
- If a user or device combination is confirmed benign and recurring, suppress it via a rule exception rather than broadening the query.

### Response and remediation

- Contact the user to confirm whether they initiated the device code sign-in or may have entered a code presented on a phishing page.
- If unauthorized, revoke all refresh tokens for the user and reset credentials to invalidate the harvested token.
- Review and remove any unauthorized device registrations to cut off Primary Refresh Token persistence.
- Review recent Microsoft Graph, Exchange, SharePoint, and Teams activity for the user for signs of recon or exfiltration.
- Restrict device code authentication to only the users and applications that require it, and require compliant or hybrid-joined devices, via Conditional Access policies.
- Educate users on device code phishing and the risk of entering codes presented by unsolicited documents or messages.
"""
references = [
    "https://arcticwolf.com/resources/blog/token-bingo-dont-let-your-code-be-the-winner/",
    "https://arcticwolf.com/resources/blog/kali365-expands-into-aws-microsoft-okta-xerox-max-messenger/",
    "https://www.ic3.gov/PSA/2026/PSA260521",
    "https://www.volexity.com/blog/2025/02/13/multiple-russian-threat-actors-targeting-microsoft-device-code-authentication/",
    "https://www.microsoft.com/en-us/security/blog/2025/02/13/storm-2372-conducts-device-code-phishing-campaign/",
]
risk_score = 47
rule_id = "7e2abdb3-c7b0-4e11-ba2f-6657602800a1"
setup = """#### Required Microsoft 365 Audit Logs
This rule requires the Microsoft 365 integration with unified audit logs (Azure AD / Entra sign-in events surfaced in the Microsoft 365 audit log) enabled and shipping to Elastic.
"""
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: SaaS",
    "Domain: Identity",
    "Data Source: Microsoft 365",
    "Data Source: Microsoft 365 Audit Logs",
    "Use Case: Identity and Access Audit",
    "Use Case: Threat Detection",
    "Resources: Investigation Guide",
    "Tactic: Initial Access",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
event.dataset: "o365.audit"
    and o365.audit.ExtendedProperties.RequestType: "Cmsi:Cmsi"
    and o365.audit.Actor.Type: (0 or 2 or 3 or 5 or 10)
    and o365.audit.DeviceProperties.Value: "False"
'''


[[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.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/"

[rule.new_terms]
field = "new_terms_fields"
value = ["o365.audit.UserId"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-7d"


Stages and Predicates

Stage 1: new_terms

event.dataset: "o365.audit"
    and o365.audit.ExtendedProperties.RequestType: "Cmsi:Cmsi"
    and o365.audit.Actor.Type: (0 or 2 or 3 or 5 or 10)
    and o365.audit.DeviceProperties.Value: "False"

Indicators

These rows show field, operator, and value matches.

M365 Identity Unusual SSO Authentication Errors for User

#
Status
production
Severity
medium
Time window
9m
Group by
o365.audit.ErrorNumber, o365.audit.UserId
Author
Elastic, Austin Songer
Source
github.com/elastic/detection-rules

Identifies the first occurrence of SSO, SAML, or federated authentication errors for a user. These errors may indicate token manipulation, SAML assertion tampering, or OAuth phishing attempts. Modern adversaries often target SSO mechanisms through token theft, SAML response manipulation, or exploiting federated authentication weaknesses rather than traditional brute force attacks.

Known False Positives

  • Initial SSO configuration issues or first-time federation setup errors for legitimate users may trigger this detection. Temporary federation service outages affecting multiple users simultaneously.

MITRE ATT&CK Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2021/05/17"
integration = ["o365"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic", "Austin Songer"]
description = """
Identifies the first occurrence of SSO, SAML, or federated authentication errors for a user. These errors may indicate
token manipulation, SAML assertion tampering, or OAuth phishing attempts. Modern adversaries often target SSO mechanisms
through token theft, SAML response manipulation, or exploiting federated authentication weaknesses rather than
traditional brute force attacks.
"""
false_positives = [
    """
    Initial SSO configuration issues or first-time federation setup errors for legitimate users may trigger this
    detection. Temporary federation service outages affecting multiple users simultaneously.
    """,
]
from = "now-9m"
index = ["logs-o365.audit-*", "filebeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "M365 Identity Unusual SSO Authentication Errors for User"
note = """## Triage and analysis

### Investigating M365 Identity Unusual SSO Authentication Errors for User

SSO, SAML, and federated authentication mechanisms are critical infrastructure for modern identity access. Adversaries increasingly
target these systems through token manipulation, SAML response tampering, OAuth phishing, and exploitation of federated trust
relationships rather than traditional credential brute forcing. This detection identifies when a user experiences SSO-related
authentication errors that are unusual for their typical behavior, which may indicate an attacker attempting to abuse stolen tokens or manipulate
authentication flows.

### Possible investigation steps

- Review the specific error code(s) in the `o365.audit.ErrorNumber` field to understand the nature of the authentication failure
  (e.g., token signature failure, SAML assertion tampering, cross-tenant token misuse). Reference Microsoft's AADSTS error codes
  at https://login.microsoftonline.com/error?code=<ErrorNumber> for detailed descriptions.
- Examine the source IP address and geolocation of the authentication attempt - compare against the user's typical login patterns.
- Check for concurrent authentication activity from the same user - multiple SSO errors alongside successful logins may indicate
  token replay or session hijacking attempts.
- Investigate recent OAuth application consent activity for this user - OAuth phishing campaigns often precede SSO manipulation attempts.
- Review the target application or service principal being accessed during the failed authentication to identify potential attacker objectives.
- Analyze the user's recent mailbox activity, particularly for phishing emails with OAuth consent links or suspicious authentication requests.
- Check for any recent changes to the user's federation settings, registered devices, or authentication methods.
- Correlate with Entra ID risky sign-in detections and risky user alerts for the same account.

### False positive analysis

- First-time SSO setup: Users configuring SSO access to a new federated application may encounter initial authentication errors.
  Validate whether the errors occurred during expected onboarding windows.
- Federation service outages: Widespread SSO errors affecting multiple users simultaneously often indicate infrastructure issues
  rather than targeted attacks. Check for service health incidents in the same timeframe.
- Certificate rotation: Federated authentication certificate renewals can temporarily cause signature validation errors. Verify
  if the errors align with planned certificate maintenance.
- Legitimate cross-tenant access: Users with business relationships across multiple tenants may encounter cross-tenant policy
  errors during authorized access attempts.

### Response and remediation

- If token manipulation or SAML tampering is suspected, immediately revoke all active sessions and refresh tokens for the affected user.
- Review and audit all OAuth application consents granted by the user - remove any suspicious or unrecognized applications.
- Enable Conditional Access policies requiring compliant devices and MFA for SSO authentication if not already enforced.
- If cross-tenant token misuse is detected, review and restrict external collaboration settings and cross-tenant access policies.
- For SAML assertion or signature errors, validate the integrity of federation trust certificates and metadata.
- Investigate whether the user's credentials have been compromised - enforce password reset if credential theft is suspected.
- Review Entra ID audit logs for unusual application registrations, service principal modifications, or federation setting changes.
- Escalate to the security operations team if evidence suggests active token theft, SAML Golden Ticket techniques, or OAuth phishing campaigns."""
references = [
    "https://techcommunity.microsoft.com/blog/microsoft-entra-blog/understanding-and-mitigating-golden-saml-attacks/4418864",
    "https://www.semperis.com/blog/meet-silver-saml/"
]
risk_score = 47
rule_id = "2de10e77-c144-4e69-afb7-344e7127abd0"
severity = "medium"
tags = [
    "Domain: Identity",
    "Data Source: Microsoft 365",
    "Data Source: Microsoft 365 Audit Logs",
    "Use Case: Identity and Access Audit",
    "Use Case: Threat Detection",
    "Tactic: Initial Access",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"

query = '''
data_stream.dataset:o365.audit
    and event.provider:AzureActiveDirectory
    and event.category:authentication
    and o365.audit.ErrorNumber:(
        20001 or 20012 or 20033 or 40008 or 40009 or 40015 or
        50006 or 50008 or 50012 or 50013 or 50027 or 50048 or
        50099 or 50132 or 75005 or 75008 or 75011 or 75016 or
        81004 or 81009 or 81010 or 399284 or 500212 or 500213 or
        700005 or 5000819
    )
'''


[[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.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"

[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 = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"

[[rule.threat.technique]]
id = "T1606"
name = "Forge Web Credentials"
reference = "https://attack.mitre.org/techniques/T1606/"

[[rule.threat.technique.subtechnique]]
id = "T1606.002"
name = "SAML Tokens"
reference = "https://attack.mitre.org/techniques/T1606/002/"

[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[rule.new_terms]
field = "new_terms_fields"
value = ["o365.audit.UserId", "o365.audit.ErrorNumber"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-10d"


Stages and Predicates

Stage 1: new_terms

data_stream.dataset:o365.audit
    and event.provider:AzureActiveDirectory
    and event.category:authentication
    and o365.audit.ErrorNumber:(
        20001 or 20012 or 20033 or 40008 or 40009 or 40015 or
        50006 or 50008 or 50012 or 50013 or 50027 or 50048 or
        50099 or 50132 or 75005 or 75008 or 75011 or 75016 or
        81004 or 81009 or 81010 or 399284 or 500212 or 500213 or
        700005 or 5000819
    )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
data_stream.dataseteq
  • o365.audit
field:"data_stream.dataset" kind:eq value:"o365.audit"
event.categoryeq
  • authentication
field:"event.category" kind:eq value:"authentication"
event.providereq
  • AzureActiveDirectory
field:"Provider_Name" kind:eq value:"AzureActiveDirectory"
o365.audit.ErrorNumberin
  • 20001
  • 20012
  • 20033
  • 399284
  • 40008
  • 40009
  • 40015
  • 50006
  • 50008
  • 5000819
  • 50012
  • 50013
  • 500212
  • 500213
  • 50027
  • 50048
  • 50099
  • 50132
  • 700005
  • 75005
  • 75008
  • 75011
  • 75016
  • 81004
  • 81009
  • 81010
field:"o365.audit.ErrorNumber" kind:in

Microsoft Office AddIn Creation

#
Source
github.com/elastic/protections-artifacts

Detects attempts to create or modify a file in known Microsoft Office add-ins directories. Adversaries may leverage Microsoft Office Addins for persistence.

MITRE ATT&CK Coverage

TacticTechniques
Persistence

Rule Body

[rule]
description = """
Detects attempts to create or modify a file in known Microsoft Office add-ins directories. Adversaries may leverage
Microsoft Office Addins for persistence.
"""
id = "4a99e412-ca98-468e-8730-d62009af23f7"
license = "Elastic License v2"
name = "Microsoft Office AddIn Creation"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/previous-versions/technet-magazine/ee851671(v=msdn.10)"]
version = "1.0.18"

query = '''
file where event.action != "deletion" and

  file.Ext.header_bytes : "4d5a*" and

  file.path :
    ("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Word\\Startup\\*",
     "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*",
     "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\*") and

  not (process.executable : "?:\\Windows\\sys*\\msiexec.exe" and file.path : "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*") and 
  not process.executable : "?:\\Windows\\explorer.exe" and 
  not (process.code_signature.subject_name : "Lars Schenk" and process.code_signature.trusted == true)
'''

min_endpoint_version = "8.1.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 = "T1137"
name = "Office Application Startup"
reference = "https://attack.mitre.org/techniques/T1137/"


[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

[internal]
min_endpoint_version = "8.1.0"

Stages and Predicates

Stage 1: file

file where event.action != "deletion" and

  file.Ext.header_bytes : "4d5a*" and

  file.path :
    ("?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Word\\Startup\\*",
     "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*",
     "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\Excel\\XLSTART\\*") and

  not (process.executable : "?:\\Windows\\sys*\\msiexec.exe" and file.path : "?:\\Users\\*\\AppData\\Roaming\\Microsoft\\AddIns\\*") and 
  not process.executable : "?:\\Windows\\explorer.exe" and 
  not (process.code_signature.subject_name : "Lars Schenk" and process.code_signature.trusted == true)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionne
  • deletion corpus 90 (elastic 90)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 4d5a* corpus 45 (elastic 45)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.pathwildcard
  • ?:\Users\*\AppData\Roaming\Microsoft\AddIns\*
  • ?:\Users\*\AppData\Roaming\Microsoft\Excel\XLSTART\*
  • ?:\Users\*\AppData\Roaming\Microsoft\Word\Startup\*
field:"TargetFilename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Potential Command Shell via NetCat

#
Status
production
Severity
high
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies potential attempt to execute via a reverse shell using the netcat utility to execute Windows commands using the default interpreters like Cmd.exe and Powershell.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2025/10/14"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/05/03"

[rule]
author = ["Elastic"]
description = """
Identifies potential attempt to execute via a reverse shell using the netcat utility to execute Windows commands using
the default interpreters like Cmd.exe and Powershell.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Command Shell via NetCat"
risk_score = 73
rule_id = "9c0f61fa-abf4-4b11-8d9d-5978c09182dd"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend"
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "windows" and event.type == "start" and
process.name : ("cmd.exe", "powershell.exe") and process.parent.args : "-e" and
 (
  (process.parent.args_count == 5 and process.parent.command_line regex~ """.*[0-9]{1,3}(\.[0-9]{1,3}){3}.*""") or
  (process.parent.args : "-*l*" and process.parent.args : "-*p*" and process.parent.args : ("cmd.exe", "powershell.exe"))
  )
'''

note = """## Triage and analysis

### Investigating Potential Command Shell via NetCat

#### Possible investigation steps

- Which remote-shell mode does the alert-local process evidence show?
  - Focus: `process.parent.command_line`, `process.parent.args_count`, and `process.name`.
  - Implication: escalate when "-e" wires "cmd.exe" or "powershell.exe" to an explicit IP, unusual port, or "-l"/"-p" listener; lower concern only when shell mode, port or destination, and child shell match a known lab, red-team, or break-glass workflow.

- Does the parent binary identity fit a recognized NetCat-family tool instead of a renamed payload?
  - Focus: `process.parent.executable`, `process.parent.name`, and code signature.
  - Implication: escalate when the parent is unsigned, renamed, or runs from temp, downloads, archives, shares, or another user-writable path; identity lowers concern only when path and signer fit the same controlled tool, and never clears the `-e` shell behavior by itself.

- Do recovered parent network events confirm a connect-back destination or exposed listener?
  - Focus: network events on `host.id` for `process.parent.entity_id`; separate DNS `dns.question.name` from `destination.ip`, `destination.port`, and `network.direction`. $investigate_0
  - Hint: network fields come from endpoint network events, not the process alert; compare any command-line IP or port with recovered connections.
  - Implication: escalate when recovered connections confirm a public or unexpected destination, or a listener is exposed on an unexpected asset; missing network telemetry is unresolved, not benign.

- Did the spawned shell launch operator commands after start?
  - Focus: child process starts where `process.parent.entity_id` matches the spawned shell `process.entity_id`; review `process.name`, `process.executable`, and `process.command_line`. $investigate_1
  - Implication: escalate when descendants show reconnaissance, credential, download, persistence, staging, lateral movement, or cleanup; no descendants weakens operator-control evidence but does not make the remote-shell pattern benign.

- Does the user and host context support the shell exposure?
  - Focus: `user.id`, `user.name`, `host.id`, `host.name`, and `process.parent.command_line`.
  - Implication: escalate when user-host pairing or account identity conflicts with expected testing or emergency use; lower concern only when the same user, host, and parent command fit one bounded authorized activity.

- If local evidence is suspicious or unresolved, do surrounding alerts expand the scope?
  - Focus: alerts for the same `user.id`, especially execution, defense-evasion, persistence, credential-access, lateral-movement, or command-and-control tied to the same parent command or recovered destination. $investigate_2
  - Hint: also check the same `host.id` to decide whether this remains one process on one asset or part of a broader compromise. $investigate_3
  - Implication: expand response scope when surrounding alerts share the user, host, parent command, or recovered destination pattern; keep triage local when no corroborating alerts appear after the parent, network, and descendant checks.

- What disposition is supported by shell mode, parent identity, descendant commands, network recovery, user-host context, and alert scope?
  - Focus: synthesize shell mode, parent identity, descendants, network recovery, user-host context, and alert scope.
  - Implication: escalate on alert-local "-e" behavior plus any corroborator: unrecognized parent, external or exposed network evidence, operator descendants, user-host conflict, or related alerts. Close only when all categories bind to one authorized security-testing or break-glass activity with no contradictions; if telemetry cannot prove legitimacy, require outside confirmation. Preserve artifacts and escalate when evidence is mixed or visibility is incomplete.

### False positive analysis

- NetCat "-e" shells are an operational anti-pattern outside confirmed security testing or break-glass support. Confirm benign use only when parent path and signer, exact parent command, shell mode, child shell, recovered destination or listen-port evidence, `user.id`, and `host.id` all align to the same bounded workflow. Use schedules, tickets, or owner confirmation only to corroborate that telemetry-matched activity; without them, require telemetry-only confirmation that the same user, host, parent command, and destination or port pattern recur for this rule. Any mismatch keeps the alert suspicious.
- Before creating an exception, validate stability across prior alerts for the same `user.id` and `host.id`. Anchor the exception on `process.parent.executable`, `process.parent.command_line`, child `process.command_line`, user/host scope, and recovered destination or listen-port pattern. Avoid exceptions on `process.name`, parent basename, or shell name alone.

### Response and remediation

- If confirmed benign, reverse any temporary containment and document the parent identity, exact command, shell mode, child shell, user/host scope, and recovered destination or listen-port evidence that proved the workflow. Create an exception only if that same workflow is stable across prior alerts from this rule.
- If suspicious but unconfirmed, preserve volatile state and case exports first: parent and child process entity IDs, command lines, descendant commands, parent binary path and signer, and recovered network indicators. Apply reversible containment tied to the findings, such as temporary destination blocks, firewall control of the exposed listener, or host isolation when interactive control or broader scope is likely and the host can tolerate it. Avoid process termination or deletion until evidence capture is complete.
- If confirmed malicious, first record `process.parent.entity_id`, `process.entity_id`, parent and child command lines, descendant commands, and recovered network indicators. Then isolate the host as appropriate, block recovered destination, domain, IP, or port indicators, and terminate the NetCat parent, spawned shell, and malicious descendants after evidence capture. Reset credentials only when descendant commands, user-host context, or related alerts show credential or administrator-command exposure.
- Eradicate only artifacts found during the investigation: the NetCat binary or script wrapper, staged payloads, persistence, service or listener configuration, tunnels, and cleanup scripts. Then remediate the delivery path that placed the tool on the host.
- Post-incident hardening: restrict unauthorized NetCat-family binaries and "-e" shell usage, retain process and network telemetry, and document adjacent variants such as renamed utilities, relay mode without "-e", or delayed shell handoff in the case record for future response.
"""

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
"""

[rule.investigation_fields]
field_names = [
    "@timestamp",
    "host.id",
    "user.id",
    "process.entity_id",
    "process.executable",
    "process.command_line",
    "process.parent.entity_id",
    "process.parent.executable",
    "process.parent.command_line",
    "process.parent.args",
    "process.parent.args_count",
    "process.parent.code_signature.subject_name",
    "process.parent.code_signature.trusted",
]

[transform]

[[transform.investigate]]
label = "Network events for the netcat parent process"
description = ""
providers = [
  [
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.parent.entity_id}}", valueType = "string" },
    { excluded = false, field = "event.category", queryType = "phrase", value = "network", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Descendant processes from the spawned shell"
description = ""
providers = [
  [
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.parent.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" },
    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"

[[rule.threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1095"
name = "Non-Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1095/"

[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

Stages and Predicates

Stage 1: process

process where host.os.type == "windows" and event.type == "start" and
process.name : ("cmd.exe", "powershell.exe") and process.parent.args : "-e" and
 (
  (process.parent.args_count == 5 and process.parent.command_line regex~ """.*[0-9]{1,3}(\.[0-9]{1,3}){3}.*""") or
  (process.parent.args : "-*l*" and process.parent.args : "-*p*" and process.parent.args : ("cmd.exe", "powershell.exe"))
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.namewildcard
  • cmd.exe corpus 122 (elastic 93, splunk 29)
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
field:"process_basename" kind:wildcard
process.parent.argswildcard
  • -*l* corpus 2 (elastic 2)
  • -*p* corpus 2 (elastic 2)
  • -e corpus 2 (elastic 2)
  • cmd.exe corpus 2 (elastic 2)
  • powershell.exe corpus 2 (elastic 2)
field:"process.parent.args" kind:wildcard
process.parent.args_counteq
  • 5 transforms: number corpus 2 (elastic 2)
field:"process.parent.args_count" kind:eq value:"5"
process.parent.command_lineregex_match
  • .*[0-9]{1,3}(.[0-9]{1,3}){3}.* corpus 2 (elastic 2)
field:"ParentCommandLine" kind:regex_match value:".*[0-9]{1,3}(.[0-9]{1,3}){3}.*"

Potential Disabling of AppArmor

#
Source
github.com/elastic/protections-artifacts

Monitors for potential attempts to disable AppArmor. AppArmor is a Linux security module that enforces fine-grained access control policies to restrict the actions and resources that specific applications and processes can access. Adversaries may disable AppArmor to avoid possible detection of their tools and activities.

MITRE ATT&CK Coverage

TacticTechniques
Defense Impairment

Rule Body

[rule]
description = """
Monitors for potential attempts to disable AppArmor. AppArmor is a Linux security module that enforces fine-grained
access control policies to restrict the actions and resources that specific applications and processes can access.
Adversaries may disable AppArmor to avoid possible detection of their tools and activities.
"""
id = "5a19f19d-6f94-475e-9eba-2520685c3861"
license = "Elastic License v2"
name = "Potential Disabling of AppArmor"
os_list = ["linux"]
version = "1.0.1"

query = '''
process where event.type == "start" and event.action == "exec" and (
  (process.name == "systemctl" and process.args in ("disable", "stop", "kill", "mask") and process.args in ("apparmor", "apparmor.service")) or
  (process.name == "service" and process.args == "apparmor" and process.args == "stop") or
  (process.name == "chkconfig" and process.args == "apparmor" and process.args == "off") or
  (process.name == "update-rc.d" and process.args == "apparmor" and process.args in ("remove", "disable")) or
  (process.name == "ln" and process.args like~ "/etc/apparmor.d/*" and process.args == "/etc/apparmor.d/disable/")
) and
not (
  process.parent.executable in ("/opt/puppetlabs/puppet/bin/ruby", "/lib/systemd/systemd-sysv-install") or
  process.parent.args like "/var/lib/dpkg/info/*.postinst" or
  process.working_directory == "/home/ansible"
)
'''

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 = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[threat.technique.subtechnique]]
id = "T1562.001"
name = "Disable or Modify Tools"
reference = "https://attack.mitre.org/techniques/T1562/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: process

process where event.type == "start" and event.action == "exec" and (
  (process.name == "systemctl" and process.args in ("disable", "stop", "kill", "mask") and process.args in ("apparmor", "apparmor.service")) or
  (process.name == "service" and process.args == "apparmor" and process.args == "stop") or
  (process.name == "chkconfig" and process.args == "apparmor" and process.args == "off") or
  (process.name == "update-rc.d" and process.args == "apparmor" and process.args in ("remove", "disable")) or
  (process.name == "ln" and process.args like~ "/etc/apparmor.d/*" and process.args == "/etc/apparmor.d/disable/")
) and
not (
  process.parent.executable in ("/opt/puppetlabs/puppet/bin/ruby", "/lib/systemd/systemd-sysv-install") or
  process.parent.args like "/var/lib/dpkg/info/*.postinst" or
  process.working_directory == "/home/ansible"
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Potential Git CVE-2025-48384 Exploitation

#
Source
github.com/elastic/protections-artifacts

Identifies potential attempts to execute malicious commands via a known git remote code execution vulnerability CVE-2025-48384.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[rule]
description = """
Identifies potential attempts to execute malicious commands via a known git remote code execution vulnerability
CVE-2025-48384.
"""
id = "78ca6f13-ff26-416f-9e48-e2d92694ed58"
license = "Elastic License v2"
name = "Potential Git CVE-2025-48384 Exploitation"
os_list = ["linux", "macos"]
reference = [
    "https://www.kucoin.com/zh-hant/blog/en-breaking-lazarus-group-apt38-targets-crypto-sector-with-sophisticated-phishing-campaign",
    "https://securitylabs.datadoghq.com/articles/git-arbitrary-file-write/",
    "https://github.com/acheong08/CVE-2025-48384",
]
version = "1.0.2"

query = '''
process where event.type == "start" and event.action == "exec" and
 process.parent.name == "git" and process.command_line : "*clone*--recursive*http*" and
 process.name in (
   "dash", "sh", "static-sh", "bash", "bash-static", "zsh", "ash", "csh", "ksh", "tcsh", "busybox", "fish", "ksh93", "rksh", "rksh93", "lksh",
   "mksh", "mksh-static", "csharp", "posh", "rc", "sash", "yash", "zsh5", "zsh5-static"
)
'''

min_endpoint_version = "7.16.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 = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and
 process.parent.name == "git" and process.command_line : "*clone*--recursive*http*" and
 process.name in (
   "dash", "sh", "static-sh", "bash", "bash-static", "zsh", "ash", "csh", "ksh", "tcsh", "busybox", "fish", "ksh93", "rksh", "rksh93", "lksh",
   "mksh", "mksh-static", "csharp", "posh", "rc", "sash", "yash", "zsh5", "zsh5-static"
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.command_linewildcard
  • *clone*--recursive*http*
field:"CommandLine" kind:wildcard value:"*clone*--recursive*http*"
process.namein
  • ash corpus 10 (elastic 10)
  • bash corpus 181 (elastic 181)
  • bash-static corpus 2 (elastic 2)
  • busybox corpus 67 (elastic 67)
  • csh corpus 148 (elastic 148)
  • csharp corpus 2 (elastic 2)
  • dash corpus 150 (elastic 150)
  • fish corpus 151 (elastic 151)
  • ksh corpus 149 (elastic 149)
  • ksh93 corpus 2 (elastic 2)
  • lksh corpus 2 (elastic 2)
  • mksh corpus 20 (elastic 20)
  • mksh-static corpus 2 (elastic 2)
  • posh corpus 2 (elastic 2)
  • rc corpus 5 (elastic 5)
  • rksh corpus 3 (elastic 3)
  • rksh93 corpus 2 (elastic 2)
  • sash corpus 4 (elastic 4)
  • sh corpus 180 (elastic 180)
  • static-sh corpus 2 (elastic 2)
  • tcsh corpus 145 (elastic 145)
  • yash corpus 4 (elastic 4)
  • zsh corpus 180 (elastic 180)
  • zsh5 corpus 2 (elastic 2)
  • zsh5-static corpus 2 (elastic 2)
field:"process_basename" kind:in
process.parent.nameeq
  • git corpus 3 (elastic 3)
field:"parent_process_basename" kind:eq value:"git"

Potential IIS Web Shell File Creation

#
Status
production
Severity
high
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies the creation of ASPX/ASHX/ASMX files in specific directories that are commonly targeted by attackers to deploy web shells.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2025/07/24"
integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "m365_defender", "crowdstrike"]
maturity = "production"
updated_date = "2026/08/26"

[rule]
author = ["Elastic"]
description = """
Identifies the creation of ASPX/ASHX/ASMX files in specific directories that are commonly targeted by attackers to deploy web shells.
"""
from = "now-9m"
index = [
    "winlogbeat-*",
    "logs-endpoint.events.file-*",
    "logs-windows.sysmon_operational-*",
    "endgame-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-m365_defender.event-*",
    "logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "Potential IIS Web Shell File Creation"
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 Potential IIS Web Shell File Creation

Web shells are malicious scripts uploaded to web servers, often exploiting vulnerabilities in web applications. Those files, used in Windows environments, can be manipulated by attackers to maintain persistence and execute arbitrary commands. Adversaries target specific directories for deploying these files. The detection rule identifies suspicious ASPX file creation in these directories, excluding legitimate processes, to flag potential web shell activity.

### Possible investigation steps

- Review the file path where the ASPX/ASHX/ASMX file was created to confirm it matches the targeted directory pattern. This can help determine if the file is in a location commonly exploited for web shells.
- Examine the process that created the ASPX/ASHX/ASMX file to assess its legitimacy and potential malicious intent.
- Check the timestamp of the file creation event to correlate it with other suspicious activities or alerts on the host, which might provide additional context or evidence of compromise.
- Investigate the contents of the ASPX/ASHX/ASMX file to identify any malicious code or scripts that could indicate a web shell. Look for patterns or code snippets commonly associated with web shell functionality.
- Analyze network activity from the host around the time of the ASPX file creation to identify any unusual outbound connections or data transfers that might suggest communication with a command and control server.
- Review historical alerts and logs for the host to identify any previous suspicious activities or patterns that could indicate ongoing compromise or persistence mechanisms.

### False positive analysis

- Routine updates or installations of legitimate web server components may trigger alerts. Users can create exceptions for known update processes or installation paths to reduce false positives.
- Development or testing environments often generate ASPX files as part of normal operations. Exclude directories or processes associated with these environments to prevent unnecessary alerts.
- Automated scripts or tools used for web server maintenance might create ASPX files. Identify and whitelist these scripts to avoid false detections.
- Legitimate third-party applications that integrate with web server extensions may create ASPX files. Monitor and whitelist these applications to ensure they do not trigger false positives.
- Scheduled tasks or system processes that interact with web server directories can be mistaken for malicious activity. Review and exclude these tasks if they are verified as non-threatening.

### Response and remediation

- Isolate the affected server from the network to prevent further malicious activity and lateral movement.
- Terminate any suspicious processes associated with the creation of the ASPX file, especially those not originating from legitimate executables like msiexec.exe.
- Remove the identified ASPX file from the targeted directory to eliminate the potential web shell.
- Conduct a thorough scan of the server using updated antivirus and endpoint detection tools to identify and remove any additional malicious files or processes.
- Review server logs and network traffic for signs of unauthorized access or data exfiltration, and document any findings for further analysis.
- Restore the server from a known good backup if necessary, ensuring that the backup is free from any malicious artifacts.
- Escalate the incident to the security operations team for further investigation and to assess the need for additional security measures, such as patching vulnerabilities or enhancing monitoring capabilities.
"""

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 11 - File Create](https://ela.st/sysmon-event-11-setup)
"""

references = [
    "https://blog.viettelcybersecurity.com/toolshell-a-critical-sharepoint-vulnerability-chain-under-active-exploitation/",
    "https://www.sentinelone.com/blog/sharepoint-toolshell-zero-day-exploited-in-the-wild-targets-enterprise-servers/",
    "https://www.rapid7.com/blog/post/2024/10/30/investigating-a-sharepoint-compromise-ir-tales-from-the-field/",
]
risk_score = 73
rule_id = "32144184-7bfa-4541-9c3f-b65f16d24df9"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Persistence",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: SentinelOne",
    "Data Source: Microsoft Defender XDR",
    "Data Source: Crowdstrike",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
file where host.os.type == "windows" and event.type != "deletion" and file.extension : ("aspx", "ashx", "asmx") and
 process.name : ("w3wp.exe", "MSExchangeMailboxReplication.exe", "EdgeTransport.exe", "Microsoft.Exchange.*.exe", "UMWorkerProcess.exe", "umservice.exe", "cmd.exe", "powershell.exe", "pwsh.exe", "certutil.exe", "xcopy.exe") and 
  (
   (file.path : ("?:\\Program Files\\Common Files\\microsoft shared\\Web Server Extensions\\*\\TEMPLATE\\LAYOUTS\\*",
                 "?:\\inetpub\\wwwroot\\aspnet_client\\system_web\\*", 
                 "?:\\Program Files\\Microsoft\\Exchange Server\\V*\\FrontEnd\\HttpProxy\\owa\\auth\\*", 
                 "?:\\Program Files\\Microsoft\\Exchange Server\\V*\\FrontEnd\\HttpProxy\\ecp\\auth\\*") and 
    /* not sub-dirs */
    not file.path : ("?:\\inetpub\\wwwroot\\aspnet_client\\system_web\\*\\*", 
                     "?:\\Program Files\\Microsoft\\Exchange Server\\V*\\FrontEnd\\HttpProxy\\*\\auth\\*\\*", 
                     "?:\\Program Files\\Common Files\\microsoft shared\\Web Server Extensions\\*\\TEMPLATE\\LAYOUTS\\*\\*")) or 

    /* not sub-dirs */
   (file.path : "?:\\inetpub\\wwwroot\\aspnet_client\\*" and not file.path : "?:\\inetpub\\wwwroot\\aspnet_client\\*\\*")
  ) 
'''

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1505"
name = "Server Software Component"
reference = "https://attack.mitre.org/techniques/T1505/"
[[rule.threat.technique.subtechnique]]
id = "T1505.003"
name = "Web Shell"
reference = "https://attack.mitre.org/techniques/T1505/003/"



[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"

Stages and Predicates

Stage 1: file

file where host.os.type == "windows" and event.type != "deletion" and file.extension : ("aspx", "ashx", "asmx") and
 process.name : ("w3wp.exe", "MSExchangeMailboxReplication.exe", "EdgeTransport.exe", "Microsoft.Exchange.*.exe", "UMWorkerProcess.exe", "umservice.exe", "cmd.exe", "powershell.exe", "pwsh.exe", "certutil.exe", "xcopy.exe") and
  (
   (file.path : ("?:\\Program Files\\Common Files\\microsoft shared\\Web Server Extensions\\*\\TEMPLATE\\LAYOUTS\\*",
                 "?:\\inetpub\\wwwroot\\aspnet_client\\system_web\\*",
                 "?:\\Program Files\\Microsoft\\Exchange Server\\V*\\FrontEnd\\HttpProxy\\owa\\auth\\*",
                 "?:\\Program Files\\Microsoft\\Exchange Server\\V*\\FrontEnd\\HttpProxy\\ecp\\auth\\*") and
    not file.path : ("?:\\inetpub\\wwwroot\\aspnet_client\\system_web\\*\\*",
                     "?:\\Program Files\\Microsoft\\Exchange Server\\V*\\FrontEnd\\HttpProxy\\*\\auth\\*\\*",
                     "?:\\Program Files\\Common Files\\microsoft shared\\Web Server Extensions\\*\\TEMPLATE\\LAYOUTS\\*\\*")) or
   (file.path : "?:\\inetpub\\wwwroot\\aspnet_client\\*" and not file.path : "?:\\inetpub\\wwwroot\\aspnet_client\\*\\*")
  )

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typene
  • deletion corpus 33 (elastic 33)
field:"event.type" kind:ne value:"deletion"
file.extensionwildcard
  • ashx
  • asmx corpus 2 (elastic 2)
  • aspx corpus 2 (elastic 2)
field:"file.extension" kind:wildcard
file.pathwildcard
  • ?:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\TEMPLATE\LAYOUTS\*
  • ?:\Program Files\Microsoft\Exchange Server\V*\FrontEnd\HttpProxy\ecp\auth\*
  • ?:\Program Files\Microsoft\Exchange Server\V*\FrontEnd\HttpProxy\owa\auth\*
  • ?:\inetpub\wwwroot\aspnet_client\* corpus 2 (elastic 2)
  • ?:\inetpub\wwwroot\aspnet_client\system_web\*
field:"TargetFilename" kind:wildcard
process.namewildcard
  • EdgeTransport.exe
  • MSExchangeMailboxReplication.exe
  • Microsoft.Exchange.*.exe
  • UMWorkerProcess.exe
  • certutil.exe corpus 5 (elastic 5)
  • cmd.exe corpus 8 (elastic 8)
  • powershell.exe corpus 12 (elastic 12)
  • pwsh.exe corpus 6 (elastic 6)
  • umservice.exe
  • w3wp.exe corpus 2 (elastic 2)
  • xcopy.exe
field:"process_basename" kind:wildcard

Potential Injection via the Console Window Class

#
Source
github.com/elastic/protections-artifacts

Identifies the execution of a process from the Windows Console host and from an unbacked memeory region. This may indicate an attempt to inject code via the ConsoleWindowClass method.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies the execution of a process from the Windows Console host and from an unbacked memeory region. This may
indicate an attempt to inject code via the ConsoleWindowClass method.
"""
id = "2ad63716-3dc3-49ba-b682-ef4b9e4a4d87"
license = "Elastic License v2"
name = "Potential Injection via the Console Window Class"
os_list = ["windows"]
reference = [
    "https://github.com/odzhan/injection/tree/master/conhost",
    "https://modexp.wordpress.com/2018/09/12/process-injection-user-data/",
    "https://www.elastic.co/security-labs/upping-the-ante-detecting-in-memory-threats-with-kernel-call-stacks",
]
version = "1.0.19"

query = '''
process where event.action == "start" and
 process.parent.name : "conhost.exe" and
 process.parent.thread.Ext.call_stack_contains_unbacked == true and
 process.parent.thread.Ext.call_stack_summary : "*kernelbase.dll|Unbacked*" and
 not process.executable : "C:\\Program Files (x86)\\Microsoft Intune Management Extension\\AgentExecutor.exe"
'''

min_endpoint_version = "8.8.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 = "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.8.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
 process.parent.name : "conhost.exe" and
 process.parent.thread.Ext.call_stack_contains_unbacked == true and
 process.parent.thread.Ext.call_stack_summary : "*kernelbase.dll|Unbacked*" and
 not process.executable : "C:\\Program Files (x86)\\Microsoft Intune Management Extension\\AgentExecutor.exe"

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.executableeqC:\Program Files (x86)\Microsoft Intune Management Extension\AgentExecutor.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\Microsoft Intune Management Extension\AgentExecutor.exe"

Potential PowerShell HackTool Script by Author

#
Status
production
Severity
high
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies PowerShell script block content containing known offensive-tool author handles or attribution strings (for example, public tool author names). Attackers often run public PowerShell tooling with minimal changes, leaving author artifacts in comments or headers.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/05/08"
integration = ["windows"]
maturity = "production"
updated_date = "2026/05/01"

[rule]
author = ["Elastic"]
description = """
Identifies PowerShell script block content containing known offensive-tool author handles or attribution strings (for
example, public tool author names). Attackers often run public PowerShell tooling with minimal changes, leaving author
artifacts in comments or headers.
"""
from = "now-9m"
index = ["logs-windows.powershell*", "winlogbeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "Potential PowerShell HackTool Script by Author"
references = [
    "https://github.com/atc-project/atc-data/blob/master/docs/Logging_Policies/LP_0109_windows_powershell_script_block_log.md",
]
risk_score = 73
rule_id = "2553a9af-52a4-4a05-bb03-85b2a479a0a0"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: PowerShell Logs",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
host.os.type:windows and event.category:process and
  powershell.file.script_block_text : (
      "mattifestation" or "JosephBialek" or
      "harmj0y" or "ukstufus" or
      "SecureThisShit" or "Matthew Graeber" or
      "secabstraction" or "mgeeky" or
      "oddvarmoe" or "am0nsec" or
      "obscuresec" or "sixdub" or
      "darkoperator" or "funoverip" or
      "rvrsh3ll" or "kevin_robertson" or
      "dafthack" or "r4wd3r" or
      "danielhbohannon" or "OneLogicalMyth" or
      "cobbr_io" or "xorrior" or
      "PetrMedonos" or "citronneur" or
      "eladshamir" or "RastaMouse" or
      "enigma0x3" or "FuzzySec" or
      "424f424f" or "jaredhaight" or
      "fullmetalcache" or "Hubbl3" or
      "curi0usJack" or "Cx01N" or
      "itm4n" or "nurfed1" or
      "cfalta" or "Scott Sutherland" or
      "_nullbind" or "_tmenochet" or
      "jaredcatkinson" or "ChrisTruncer" or
      "monoxgas" or "TheRealWover" or
      "splinter_code" or "samratashok" or
      "leechristensen" or "nikhil_mitt"
  ) and
  not powershell.file.script_block_text : ("Get-UEFIDatabaseSigner" or "Posh-SSH")
'''

note = """## Triage and analysis

### Investigating Potential PowerShell HackTool Script by Author

#### Possible investigation steps

- What did the alert-local author match show?
  - Focus: `powershell.file.script_block_text`, `powershell.file.script_block_length`, `file.path`, and `user.id` on `host.id`.
  - Implication: escalate when the handle appears beside executable functions, encoded strings, download, credential, discovery, remote-execution, or persistence logic; lower suspicion when it is only an inert header or comment in a recognized lab, test, or community-module path with harmless surrounding code.

- Can you reconstruct the complete script block before judging intent?
  - Focus: collect and order fragments on `host.id` with `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`, and `powershell.file.script_block_text`. $investigate_0
  - Implication: escalate when reconstruction reveals hidden stages, helper functions, obfuscation, decoding, or payload logic; keep unresolved if fragments are missing because they can hide decisive code.

- Was the script file-backed or fileless, and what does that say about delivery?
  - Focus: `file.path`, `file.directory`, and `file.name` when present; absent `file.path` suggests inline, generated, or interactive execution.
  - Implication: escalate when fileless execution, user-writable paths, shares, temp or staging folders, or suspicious names pair with hacktool code; lower suspicion when a stable repository, lab path, or community-module path matches benign content.

- Can you recover the PowerShell process and explain launch?
  - Focus: With endpoint process telemetry, recover the matching process via `host.id + process.pid` before interpreting `process.*` or `process.parent.*`. Capture `process.entity_id`, `process.command_line`, `process.parent.executable`, and `process.parent.command_line`. $investigate_1
  - Hint: confirm timestamps to reduce PID-reuse ambiguity; if no process start event appears, expand time before falling back to `host.id`, `user.id`, and alert time.
  - Implication: escalate when a document, browser, chat client, remote-management tool, scheduled task, service, or unexpected script host launched the code without matching lab, assessment, support, or deployment evidence; lower suspicion when lineage matches the exact workflow proven by script content.

- What capability or observables move this beyond attribution text?
  - Focus: reconstructed script for credential access, discovery, remote execution, payload delivery, persistence, AMSI or logging tampering, reflection, or decode-and-execute logic; extract domains, IPs, URLs, paths, accounts, registry targets, and reusable function or module names.
  - Implication: escalate when the body implements offensive capability or yields high-signal observables; lower suspicion only when it remains benign utility logic tied to a recognized workflow.

- Did script-extracted file or registry targets appear on the host?
  - Focus: With file or registry telemetry, search same-PID events around `@timestamp` for extracted `file.path`, `registry.path`, `registry.value`, or `registry.data.strings`. $investigate_4
  - Implication: escalate when extracted payload paths are created or executed, or registry targets indicate persistence or security changes; missing artifact or configuration telemetry is unresolved, not benign.

- Did extracted network or identity observables confirm active offensive use?
  - Focus: With network telemetry, search same-PID DNS and connection events for extracted domains in `dns.question.name` or `dns.resolved_ip` and IPs in `destination.ip`. $investigate_5 Review Windows 4624 or 4648 with `winlog.event_data.TargetUserName` and `winlog.event_data.SubjectUserName` for extracted accounts.
  - Implication: escalate when the host contacts extracted infrastructure, downloads content, or shows remote, credential, or lateral-use evidence. Missing network or authentication telemetry is unresolved, not benign.

- If the script content or launch chain remains suspicious or unresolved, does recurrence change scope?
  - Focus: related alerts for `user.id` in the last 48 hours, comparing author string, reconstructed script body, file source, launch pattern, and extracted observables. $investigate_2
  - Hint: if the user view is quiet or ambiguous, compare related alerts for `host.id` in the last 48 hours. $investigate_3
  - Implication: broaden when the same script body or extracted observables reach unrelated users or hosts; keep local when recurrence stays within the same lab, assessment, support, or deployment host/user cohort. Do not close on recurrence alone if script content or recovery remains unresolved.

- Escalate on reconstructed capability, unauthorized launch, follow-on evidence, or missing/conflicting required telemetry; close only when the author match, reconstructed script, source path, launch context, observables, and `user.id` or `host.id` scope bind one exact benign workflow, with outside confirmation when telemetry cannot verify it.

### False positive analysis

- Authorized testing, red-team, malware-analysis, validation, community-module, or admin scripts can retain author strings. Confirm the reconstructed body, exact `user.id` and `host.id` scope, `file.path` or launch context, recognized test or lab records when telemetry cannot prove legitimacy, and no contradictory observables or follow-on activity.
- Before creating an exception, validate recurrence of the same benign workflow with the same `powershell.file.script_block_text` fragment, `file.path` or launch source, and `user.id` or `host.id` scope. Avoid author-string-only exceptions because unrelated offensive scripts can reuse the same handle.

### Response and remediation

- If confirmed benign:
  - Reverse temporary containment and document the reconstructed script, source path, launch context, `user.id`, and `host.id` evidence confirming the legitimate workflow. Build an exception only for that exact workflow and scope.
- If suspicious but unconfirmed:
  - Preserve or export alert details, reconstructed script with fragment metadata, process PID, source path, extracted indicators, and recovered launch details before containment or cleanup.
  - Apply reversible containment tied to the evidence, such as temporary restrictions for extracted destinations or heightened monitoring on affected `host.id` and `user.id`.
  - Escalate to host isolation or stronger account action only if the script is still executing, staging payloads, reaching suspicious destinations, or showing credential or lateral-use evidence, and the host role tolerates isolation.
- If confirmed malicious:
  - Preserve the reconstructed script, recovered process entity ID and launch details, extracted indicators, staged artifacts, and timeline before isolation, process termination, or cleanup.
  - Isolate the host when script capability, launch context, follow-on artifacts, or destination evidence confirms unauthorized activity and the host role tolerates isolation.
  - Block confirmed malicious destinations, URLs, file hashes, and script paths found during triage.
  - Eradicate only dropped files, registry changes, scheduled tasks, services, and follow-on payloads tied to this script, then remediate the path that delivered or launched it.
  - Review related hosts and users for the same author string, reconstructed script body, or extracted indicators before destructive cleanup so scoping is complete.
- Post-incident hardening:
  - Verify PowerShell 4104 logging coverage and retention are sufficient to reconstruct multi-part scripts and preserve process recovery context.
  - Restrict authorized testing of public offensive PowerShell tooling to controlled hosts and identities.
  - Document matched author strings, extracted observables, and author-stripped or rebranded variants surfaced during triage for future analyst reference.
"""

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
"""

[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"
]

[transform]

[[transform.investigate]]
label = "Script block fragments for the same script"
description = ""
providers = [
  [
    { excluded = false, field = "powershell.file.script_block_id", queryType = "phrase", value = "{{powershell.file.script_block_id}}", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Process events for the PowerShell instance"
description = ""
providers = [
  [
    { excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "event.category", queryType = "phrase", value = "process", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Alerts associated with the user"
description = ""
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "Alerts associated with the host"
description = ""
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "File and registry events for the PowerShell PID"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "file", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" }
  ],
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "registry", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[transform.investigate]]
label = "Network and DNS events for the PowerShell PID"
description = ""
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "network", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" }
  ],
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "dns", valueType = "string" },
    { excluded = false, field = "host.id", queryType = "phrase", value = "{{host.id}}", valueType = "string" },
    { excluded = false, field = "process.pid", queryType = "phrase", value = "{{process.pid}}", valueType = "string" }
  ]
]
relativeFrom = "now-1h"
relativeTo = "now"

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

Stages and Predicates

Stage 1: query

host.os.type:windows and event.category:process and
  powershell.file.script_block_text : (
      "mattifestation" or "JosephBialek" or
      "harmj0y" or "ukstufus" or
      "SecureThisShit" or "Matthew Graeber" or
      "secabstraction" or "mgeeky" or
      "oddvarmoe" or "am0nsec" or
      "obscuresec" or "sixdub" or
      "darkoperator" or "funoverip" or
      "rvrsh3ll" or "kevin_robertson" or
      "dafthack" or "r4wd3r" or
      "danielhbohannon" or "OneLogicalMyth" or
      "cobbr_io" or "xorrior" or
      "PetrMedonos" or "citronneur" or
      "eladshamir" or "RastaMouse" or
      "enigma0x3" or "FuzzySec" or
      "424f424f" or "jaredhaight" or
      "fullmetalcache" or "Hubbl3" or
      "curi0usJack" or "Cx01N" or
      "itm4n" or "nurfed1" or
      "cfalta" or "Scott Sutherland" or
      "_nullbind" or "_tmenochet" or
      "jaredcatkinson" or "ChrisTruncer" or
      "monoxgas" or "TheRealWover" or
      "splinter_code" or "samratashok" or
      "leechristensen" or "nikhil_mitt"
  ) and
  not powershell.file.script_block_text : ("Get-UEFIDatabaseSigner" or "Posh-SSH")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.categoryeq
  • process corpus 105 (elastic 105)
field:"event.category" kind:eq value:"process"
powershell.file.script_block_textin
  • 424f424f
  • ChrisTruncer
  • Cx01N
  • FuzzySec
  • Hubbl3
  • JosephBialek
  • Matthew Graeber
  • OneLogicalMyth
  • PetrMedonos
  • RastaMouse
  • Scott Sutherland
  • SecureThisShit
  • TheRealWover
  • _nullbind
  • _tmenochet
  • am0nsec
  • cfalta
  • citronneur
  • cobbr_io
  • curi0usJack
  • dafthack
  • danielhbohannon
  • darkoperator
  • eladshamir
  • enigma0x3
  • fullmetalcache
  • funoverip
  • harmj0y
  • itm4n
  • jaredcatkinson
  • jaredhaight
  • kevin_robertson
  • leechristensen
  • mattifestation
  • mgeeky
  • monoxgas
  • nikhil_mitt
  • nurfed1
  • obscuresec
  • oddvarmoe
  • r4wd3r
  • rvrsh3ll
  • samratashok
  • secabstraction
  • sixdub
  • splinter_code
  • ukstufus
  • xorrior
field:"ScriptBlockText" kind:in

Exclusions

The rule actively suppresses these predicates.

Potential Privilege Escalation via Recently Compiled Executable

#
Status
production
Severity
high
Time window
1m
Sequence by
file.name, host.id, process.args, process.name
Author
Elastic
Source
github.com/elastic/detection-rules

This rule monitors a sequence involving a program compilation event followed by its execution and a subsequent alteration of UID permissions to root privileges. This behavior can potentially indicate the execution of a kernel or software privilege escalation exploit.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/08/28"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule monitors a sequence involving a program compilation event followed by its execution and a subsequent
alteration of UID permissions to root privileges. This behavior can potentially indicate the execution of a kernel or
software privilege escalation exploit.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Privilege Escalation via Recently Compiled Executable"
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 Potential Privilege Escalation via Recently Compiled Executable

In Linux environments, compiling and executing programs is a routine operation. However, adversaries can exploit this by compiling malicious code to escalate privileges. This detection rule identifies suspicious sequences where a non-root user compiles and executes a program, followed by a UID change to root, indicating potential privilege escalation attempts. By monitoring these patterns, the rule helps in identifying and mitigating exploitation risks.

### Possible investigation steps

- Review the alert details to identify the specific non-root user involved in the compilation and execution sequence. Check the user.id field to gather more information about the user's activities and permissions.
- Examine the process.args field from the initial compilation event to understand the source code or script being compiled. This can provide insights into whether the code has malicious intent.
- Investigate the file.name field associated with the creation event to determine the nature of the executable file created. Check its location and any associated metadata for anomalies.
- Analyze the process.name field from the execution event to identify the program that was run. Cross-reference this with known malicious binaries or scripts.
- Check the process.name field in the UID change event to identify the process responsible for the privilege escalation. Determine if this process is known to exploit vulnerabilities for privilege escalation.
- Review system logs and other security tools for any additional suspicious activities or anomalies around the time of the alert to gather more context on the potential threat.
- Assess the system for any signs of compromise or unauthorized changes, such as new user accounts, altered configurations, or unexpected network connections, to evaluate the impact and scope of the incident.

### False positive analysis

- Development activities by legitimate users can trigger this rule when compiling and testing new software. To manage this, consider creating exceptions for specific users or groups known to perform regular development tasks.
- Automated build systems or continuous integration pipelines may compile and execute code as part of their normal operation. Exclude these systems by identifying their user accounts or host identifiers.
- System administrators performing maintenance or updates might compile and execute programs, leading to false positives. Implement exceptions for these users or specific maintenance windows.
- Educational environments where students frequently compile and execute code for learning purposes can generate alerts. Exclude these activities by setting up exceptions for student user accounts or specific lab environments.
- Security testing and research activities that involve compiling and executing exploit code in a controlled manner can be mistaken for malicious behavior. Exclude these activities by identifying the user accounts or systems involved in such testing.

### Response and remediation

- Immediately isolate the affected host from the network to prevent further unauthorized access or lateral movement.
- Terminate any suspicious processes identified in the alert, especially those associated with the compiled executable and any processes running with elevated privileges.
- Revert any unauthorized changes to user permissions, particularly any UID changes to root, to restore the system to its secure state.
- Conduct a thorough review of the affected system for additional indicators of compromise, such as unauthorized file modifications or new user accounts, and remove any malicious artifacts.
- Apply relevant security patches and updates to the system to address any vulnerabilities that may have been exploited for privilege escalation.
- Monitor the affected system and network for any signs of recurring or related suspicious activity, using enhanced logging and alerting mechanisms.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems may be affected, ensuring comprehensive remediation across the environment."""
risk_score = 73
rule_id = "193549e8-bb9e-466a-a7f9-7e783f5cb5a6"
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 = "high"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Privilege Escalation",
    "Use Case: Vulnerability",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id with maxspan=1m
  [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
   process.name in ("gcc", "g++", "cc") and user.id != "0"] by process.args
  [file where host.os.type == "linux" and event.action == "creation" and event.type == "creation" and
   process.name == "ld" and user.id != "0"] by file.name
  [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
   user.id != "0"] by process.name
  [process where host.os.type == "linux" and event.action in ("uid_change", "guid_change") and event.type == "change" and
   user.id == "0"] by process.name
'''

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"

[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"

[[rule.threat.technique.subtechnique]]
id = "T1548.001"
name = "Setuid and Setgid"
reference = "https://attack.mitre.org/techniques/T1548/001/"

[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by file.name, host.id, process.args, process.name.

Stage 1: process

[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
   process.name in ("gcc", "g++", "cc") and user.id != "0"] by process.args

Stage 2: file

[file where host.os.type == "linux" and event.action == "creation" and event.type == "creation" and
   process.name == "ld" and user.id != "0"] by file.name

Stage 3: process

[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
   user.id != "0"] by process.name

Stage 4: process

[process where host.os.type == "linux" and event.action in ("uid_change", "guid_change") and event.type == "change" and
   user.id == "0"] by process.name

Indicators

These rows show field, operator, and value matches.

Potential Reverse Shell via Suspicious Binary

#
Status
production
Severity
high
Time window
1s
Sequence by
host.id, process.entity_id
Author
Elastic
Source
github.com/elastic/detection-rules

This detection rule detects the creation of a shell through a chain consisting of the execution of a suspicious binary (located in a commonly abused location or executed manually) followed by a network event and ending with a shell being spawned. Stageless reverse tcp shells display this behaviour. Attackers may spawn reverse shells to establish persistence onto a target system.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/07/05"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This detection rule detects the creation of a shell through a chain consisting of the execution of a suspicious binary
(located in a commonly abused location or executed manually) followed by a network event and ending with a shell being
spawned. Stageless reverse tcp shells display this behaviour. Attackers may spawn reverse shells to establish
persistence onto a target system.
"""
from = "now-9m"
index = ["logs-endpoint.events.network*", "logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Reverse Shell via Suspicious Binary"
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 Potential Reverse Shell via Suspicious Binary

Reverse shells are a common technique used by attackers to gain persistent access to a compromised system. They exploit legitimate shell environments to execute commands remotely. Adversaries often deploy binaries in unusual directories to evade detection. The detection rule identifies suspicious binaries executed in these locations, followed by network activity and shell spawning, indicating potential reverse shell activity. This approach helps in identifying unauthorized access attempts on Linux systems.

### Possible investigation steps

- Review the process execution details to identify the suspicious binary's path and name, focusing on the directories specified in the query such as /tmp, /var/tmp, and /dev/shm.
- Examine the parent process of the suspicious binary to determine if it was spawned by a legitimate shell process like bash or sh, as indicated in the query.
- Analyze the network activity associated with the suspicious binary, paying attention to the destination IP address to identify any external connections that are not local (i.e., not 127.0.0.1 or ::1).
- Check the process tree to see if a new shell was spawned following the network activity, which could indicate a reverse shell attempt.
- Investigate the user account under which the suspicious process was executed to assess if it aligns with expected behavior or if it might be compromised.
- Correlate the event timestamps to understand the sequence of actions and verify if they align with typical reverse shell behavior patterns.

### False positive analysis

- Legitimate administrative scripts or binaries may be executed from directories like /tmp or /var/tmp during maintenance tasks. To handle this, create exceptions for known scripts or binaries used by trusted administrators.
- Automated deployment tools might temporarily use directories such as /dev/shm or /run for staging files. Identify these tools and exclude their processes from triggering the rule.
- Custom monitoring or backup scripts could initiate network connections from non-standard directories. Review these scripts and whitelist their activities if they are verified as safe.
- Development or testing environments might involve executing binaries from unusual locations. Ensure these environments are well-documented and exclude their processes from the detection rule.
- Some legitimate applications may spawn shells as part of their normal operation. Identify these applications and add them to an exception list to prevent false alerts.

### Response and remediation

- Isolate the affected system from the network immediately to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious processes identified by the detection rule, especially those originating from unusual directories or involving shell spawning.
- Conduct a thorough review of the system's scheduled tasks, startup scripts, and cron jobs to identify and remove any unauthorized entries that may have been added by the attacker.
- Analyze network logs to identify any external IP addresses involved in the suspicious network activity and block these IPs at the firewall to prevent further connections.
- Restore the affected system from a known good backup to ensure that any malicious changes are reverted.
- Update and patch the system to the latest security standards to close any vulnerabilities that may have been exploited.
- Escalate the incident to the security operations team for further investigation and to assess the potential impact on other systems within the network."""
references = [
    "https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md",
]
risk_score = 73
rule_id = "fa3a59dc-33c3-43bf-80a9-e8437a922c7f"
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 = "high"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
type = "eql"
query = '''
sequence by host.id, process.entity_id with maxspan=1s
[ process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
  process.executable : (
  "./*", "/tmp/*", "/var/tmp/*", "/var/www/*", "/dev/shm/*", "/etc/init.d/*", "/etc/rc*.d/*",
  "/etc/crontab", "/etc/cron.*", "/etc/update-motd.d/*", "/usr/lib/update-notifier/*",
  "/boot/*", "/srv/*", "/run/*", "/root/*", "/etc/rc.local"
   ) and
  process.parent.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and not
  process.name : ("curl", "wget", "ping", "apt", "dpkg", "yum", "rpm", "dnf", "dockerd") ]
[ network where host.os.type == "linux" and event.type == "start" and event.action in ("connection_attempted", "connection_accepted") and
  process.executable : (
  "./*", "/tmp/*", "/var/tmp/*", "/var/www/*", "/dev/shm/*", "/etc/init.d/*", "/etc/rc*.d/*",
  "/etc/crontab", "/etc/cron.*", "/etc/update-motd.d/*", "/usr/lib/update-notifier/*",
  "/boot/*", "/srv/*", "/run/*", "/root/*", "/etc/rc.local"
   ) and destination.ip != null and destination.ip != "127.0.0.1" and destination.ip != "::1" ]
[ process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
  process.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
  process.parent.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") ]
'''

[[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.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"

[[rule.threat.technique]]
id = "T1095"
name = "Non-Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1095/"

[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1s, correlated by host.id, process.entity_id.

Stage 1: process

[ process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
  process.executable : (
  "./*", "/tmp/*", "/var/tmp/*", "/var/www/*", "/dev/shm/*", "/etc/init.d/*", "/etc/rc*.d/*",
  "/etc/crontab", "/etc/cron.*", "/etc/update-motd.d/*", "/usr/lib/update-notifier/*",
  "/boot/*", "/srv/*", "/run/*", "/root/*", "/etc/rc.local"
   ) and
  process.parent.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and not
  process.name : ("curl", "wget", "ping", "apt", "dpkg", "yum", "rpm", "dnf", "dockerd") ]

Stage 2: network

[ network where host.os.type == "linux" and event.type == "start" and event.action in ("connection_attempted", "connection_accepted") and
  process.executable : (
  "./*", "/tmp/*", "/var/tmp/*", "/var/www/*", "/dev/shm/*", "/etc/init.d/*", "/etc/rc*.d/*",
  "/etc/crontab", "/etc/cron.*", "/etc/update-motd.d/*", "/usr/lib/update-notifier/*",
  "/boot/*", "/srv/*", "/run/*", "/root/*", "/etc/rc.local"
   ) and destination.ip != null and destination.ip != "127.0.0.1" and destination.ip != "::1" ]

Stage 3: process

[ process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
  process.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
  process.parent.name : ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") ]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
destination.ipis_not_null
  • (no value, null check)
field:"dest_ip" kind:is_not_null
destination.ipne
  • 127.0.0.1
  • ::1
field:"dest_ip" kind:ne
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.actionin
  • connection_accepted
  • connection_attempted
field:"EventType" kind:in
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /etc/cron.*
  • /etc/crontab
  • /etc/init.d/*
  • /etc/rc*.d/*
  • /etc/rc.local
  • /etc/update-motd.d/*
  • /root/*
  • /run/*
  • /srv/*
  • /tmp/*
  • /usr/lib/update-notifier/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namewildcard
  • bash
  • csh
  • dash
  • fish
  • ksh
  • sh
  • tcsh
  • zsh
field:"process_basename" kind:wildcard
process.parent.namewildcard
  • bash
  • csh
  • dash
  • fish
  • ksh
  • sh
  • tcsh
  • zsh
field:"parent_process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.nameeqcurl, wget, ping, apt, dpkg, yum, rpm, dnf, dockerdexcludes:process.name

Potential Shellcode Fluctuation v1

#
Source
github.com/elastic/protections-artifacts

Identifies private (JIT) code memory with fluctuating page protections. This may indicate an attempt to hide injected code from memory scanners.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies private (JIT) code memory with fluctuating page protections. This may indicate an attempt to hide injected
code from memory scanners.
"""
id = "30c72c75-43f9-4edb-bd6b-a32787082763"
license = "Elastic License v2"
name = "Potential Shellcode Fluctuation v1"
os_list = ["windows"]
version = "1.0.9"

query = '''
api where process.Ext.api.behaviors : ("execute_fluctuation", "write_fluctuation") and
/* private memory only */
process.Ext.api.metadata.target_address_name == "Unbacked" and process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and

/* trusted executable */
 process.code_signature.trusted == true and

/* ignore second stage shellcode - this will trigger other rules */
process.Ext.api.behaviors != "allocate_shellcode" and

not process.thread.Ext.call_stack_final_user_module.name : ("Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance : ("Unknown", "Kernel*", "Undetermined") and

/* large payloads only */
process.Ext.api.parameters.size > 66000 and

/* trusted signer exclusions */
not (
  process.thread.Ext.call_stack_final_user_module.name : ("chakra.dll", "mpengine.dll", "pidgenx.dll", "ieshims.dll", "jscript9.dll", "$$deletemekernelbase.dll*") and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name == "Microsoft Windows")
) and

not (
  process.thread.Ext.call_stack_final_user_module.name : ("mso.dll", "appvisvsubsystems32.dll", "appvisvsubsystems64.dll", "msedgeupdate.dll", "msvbvm60.dll") and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name == "Microsoft Corporation")
) and

not (
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and 
    $entry.subject_name : (
      "Microsoft Windows Hardware Compatibility Publisher",
      "Microsoft Windows Software Compatibility Publisher",
      "Avast Software s.r.o.",
      "AVG Technologies USA, LLC",
      "BeyondTrust Corporation",
      "Bitdefender SRL",
      "Carbon Black, Inc.",
      "Check Point Software Technologies Ltd.",
      "Cisco Systems, Inc.",
      "ESET, spol. s r.o.",
      "FireEye, Inc.",
      "Kaspersky Lab",
      "Kaspersky Lab JSC",
      "AO Kaspersky Lab",
      "McAfee, Inc.",
      "Mozilla Corporation",
      "Palo Alto Networks",
      "SentinelOne Inc.",
      "Sophos Limited",
      "Symantec Corporation",
      "Trend Micro, Inc.",
      "VMware, Inc.",
      "WithSecure Oyj",
      "Fortinet Technologies (Canada) ULC",
      "Fortinet Inc",
      "Sentinel Labs, Inc.",
      "VIPRE Security (ThreatTrack Security, Inc.)",
      "Adobe Inc.",
      "Codejock Technologies, LLC",
      "Intel Corporation",
      "Intel(R) Software Development Products",
      "Johannes Schindelin", /* Git for Windows */
      "Mozilla Corporation",
      "SAP SE",
      "VisualSVN Software Ltd.",
      "SAS Institute Inc.",
      "combit Software GmbH",
      "PC SOFT INFORMATIQUE",
      "PC SOFT INFORMATIQUE SAS",
      "Configura Sverige AB"
    )
  )
) and

not process.thread.Ext.call_stack_summary : "*ntdll.dll|tmmon.dll|*" and

/* untrusted exclusions */

not (process.code_signature.subject_name == "OMICRON electronics GmbH" and
  process.thread.Ext.call_stack_final_user_module.name == "toolkitpro.dll") and

process.thread.Ext.call_stack_final_user_module.name != "jvm.dll" and

not process.thread.Ext.call_stack_final_user_module.path like ("c:\\program files\\*", "c:\\program files (x86)\\*") and

not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("*ntdll.dll!LdrLoadDll*", "*ntdll.dll!LdrShutdownProcess*", "*clr.dll!DllCanUnloadNowInternal*")) and

not process.thread.Ext.call_stack_final_user_module.hash.sha256 in ("6593198214805d47df5726b153284326d71b9b4aa0dbb2242151bc740ca0a0d4",
                                                                    "ad3eeeec77ddc069ddc0bc0531dc8c3da4b48eb15e9ed097e7568a8b16442ff3",
                                                                    "0d82b0bc752e54e69467524c171cf50ca90786fac197f76792eb01ab341fd8b9",
                                                                    "c49cf406c3b2fc29807dc710623f5bf740c54d7d2ebaa07803c3c227dc0e6917",
                                                                    "ba6fdc007e5a23453c136283301b63743e92caa5742b67a34cdf5db483aa8741",
                                                                    "51b74ca155761ff868d0f57b1d23490b4ce46719c0d6a72dd0c1f8efcabd1ec6",
                                                                    "68f18d4e81a098435cc320173d1e57bd56f7a017ccbc9cc20e0e9c8bb50102d2",
                                                                    "47876bc0823230667047227e5031f731e3579e7805348fd8c63b381e103bebd8",
                                                                    "2cf71398291dccd79eef86a234b3644060adbf9477752c28358ee16558d75046",
                                                                    "3112c2b909bce7ab9f19c35925ba4444b1c89f42bb76182efe98d20f46482746",
                                                                    "ba2b1262c4492d32c7f1e4713f8b22e855315414395e4d32e9ec369845279792",
                                                                    "e4a0aa2bb7e9003d1f436e1fcc783c4949f38e24d0d9b960ae9411609fe9c0a6",
                                                                    "bde4966990afdde03df017bd79889a11cabb522577952f1fe6f6f0dbd85cfc09",
                                                                    "45793df158cace910d48a620d380f390ae5a09ecf1bcfefe11e6a029ddb0be53")
'''

max_endpoint_version = "8.14.1"
min_endpoint_version = "8.10.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 = "T1620"
name = "Reflective Code Loading"
reference = "https://attack.mitre.org/techniques/T1620/"


[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.behaviors : ("execute_fluctuation", "write_fluctuation") and
process.Ext.api.metadata.target_address_name == "Unbacked" and process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
 process.code_signature.trusted == true and
process.Ext.api.behaviors != "allocate_shellcode" and
not process.thread.Ext.call_stack_final_user_module.name : ("Unknown", "Undetermined") and
not process.thread.Ext.call_stack_final_user_module.protection_provenance : ("Unknown", "Kernel*", "Undetermined") and
process.Ext.api.parameters.size > 66000 and
not (
  process.thread.Ext.call_stack_final_user_module.name : ("chakra.dll", "mpengine.dll", "pidgenx.dll", "ieshims.dll", "jscript9.dll", "$$deletemekernelbase.dll*") and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name == "Microsoft Windows")
) and
not (
  process.thread.Ext.call_stack_final_user_module.name : ("mso.dll", "appvisvsubsystems32.dll", "appvisvsubsystems64.dll", "msedgeupdate.dll", "msvbvm60.dll") and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and $entry.subject_name == "Microsoft Corporation")
) and
not (
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
    $entry.subject_name : (
      "Microsoft Windows Hardware Compatibility Publisher",
      "Microsoft Windows Software Compatibility Publisher",
      "Avast Software s.r.o.",
      "AVG Technologies USA, LLC",
      "BeyondTrust Corporation",
      "Bitdefender SRL",
      "Carbon Black, Inc.",
      "Check Point Software Technologies Ltd.",
      "Cisco Systems, Inc.",
      "ESET, spol. s r.o.",
      "FireEye, Inc.",
      "Kaspersky Lab",
      "Kaspersky Lab JSC",
      "AO Kaspersky Lab",
      "McAfee, Inc.",
      "Mozilla Corporation",
      "Palo Alto Networks",
      "SentinelOne Inc.",
      "Sophos Limited",
      "Symantec Corporation",
      "Trend Micro, Inc.",
      "VMware, Inc.",
      "WithSecure Oyj",
      "Fortinet Technologies (Canada) ULC",
      "Fortinet Inc",
      "Sentinel Labs, Inc.",
      "VIPRE Security (ThreatTrack Security, Inc.)",
      "Adobe Inc.",
      "Codejock Technologies, LLC",
      "Intel Corporation",
      "Intel(R) Software Development Products",
      "Johannes Schindelin",
      "Mozilla Corporation",
      "SAP SE",
      "VisualSVN Software Ltd.",
      "SAS Institute Inc.",
      "combit Software GmbH",
      "PC SOFT INFORMATIQUE",
      "PC SOFT INFORMATIQUE SAS",
      "Configura Sverige AB"
    )
  )
) and
not process.thread.Ext.call_stack_summary : "*ntdll.dll|tmmon.dll|*" and
not (process.code_signature.subject_name == "OMICRON electronics GmbH" and
  process.thread.Ext.call_stack_final_user_module.name == "toolkitpro.dll") and
process.thread.Ext.call_stack_final_user_module.name != "jvm.dll" and
not process.thread.Ext.call_stack_final_user_module.path like ("c:\\program files\\*", "c:\\program files (x86)\\*") and
not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("*ntdll.dll!LdrLoadDll*", "*ntdll.dll!LdrShutdownProcess*", "*clr.dll!DllCanUnloadNowInternal*")) and
not process.thread.Ext.call_stack_final_user_module.hash.sha256 in ("6593198214805d47df5726b153284326d71b9b4aa0dbb2242151bc740ca0a0d4",
                                                                    "ad3eeeec77ddc069ddc0bc0531dc8c3da4b48eb15e9ed097e7568a8b16442ff3",
                                                                    "0d82b0bc752e54e69467524c171cf50ca90786fac197f76792eb01ab341fd8b9",
                                                                    "c49cf406c3b2fc29807dc710623f5bf740c54d7d2ebaa07803c3c227dc0e6917",
                                                                    "ba6fdc007e5a23453c136283301b63743e92caa5742b67a34cdf5db483aa8741",
                                                                    "51b74ca155761ff868d0f57b1d23490b4ce46719c0d6a72dd0c1f8efcabd1ec6",
                                                                    "68f18d4e81a098435cc320173d1e57bd56f7a017ccbc9cc20e0e9c8bb50102d2",
                                                                    "47876bc0823230667047227e5031f731e3579e7805348fd8c63b381e103bebd8",
                                                                    "2cf71398291dccd79eef86a234b3644060adbf9477752c28358ee16558d75046",
                                                                    "3112c2b909bce7ab9f19c35925ba4444b1c89f42bb76182efe98d20f46482746",
                                                                    "ba2b1262c4492d32c7f1e4713f8b22e855315414395e4d32e9ec369845279792",
                                                                    "e4a0aa2bb7e9003d1f436e1fcc783c4949f38e24d0d9b960ae9411609fe9c0a6",
                                                                    "bde4966990afdde03df017bd79889a11cabb522577952f1fe6f6f0dbd85cfc09",
                                                                    "45793df158cace910d48a620d380f390ae5a09ecf1bcfefe11e6a029ddb0be53")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stack_final_user_module.code_signaturearray_any(no value, null check)excludes:process.thread.Ext.call_stack_final_user_module.code_signature
process.thread.Ext.call_stack_final_user_module.nameeqmso.dll, appvisvsubsystems32.dll, appvisvsubsystems64.dll, msedgeupdate.dll, msvbvm60.dllexcludes:process.thread.Ext.call_stack_final_user_module.name
process.thread.Ext.call_stack_final_user_module.namewildcardchakra.dll, mpengine.dll, pidgenx.dll, ieshims.dll, jscript9.dll, $$deletemekernelbase.dll*excludes:process.thread.Ext.call_stack_final_user_module.name
process.code_signature.subject_nameeqOMICRON electronics GmbHexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"OMICRON electronics GmbH"
process.thread.Ext.call_stack_final_user_module.nameeqtoolkitpro.dllexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"toolkitpro.dll"
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack
process.thread.Ext.call_stack_final_user_module.hash.sha256in0d82b0bc752e54e69467524c171cf50ca90786fac197f76792eb01ab341fd8b9, 2cf71398291dccd79eef86a234b3644060adbf9477752c28358ee16558d75046, 3112c2b909bce7ab9f19c35925ba4444b1c89f42bb76182efe98d20f46482746, 45793df158cace910d48a620d380f390ae5a09ecf1bcfefe11e6a029ddb0be53, 47876bc0823230667047227e5031f731e3579e7805348fd8c63b381e103bebd8, 51b74ca155761ff868d0f57b1d23490b4ce46719c0d6a72dd0c1f8efcabd1ec6, 6593198214805d47df5726b153284326d71b9b4aa0dbb2242151bc740ca0a0d4, 68f18d4e81a098435cc320173d1e57bd56f7a017ccbc9cc20e0e9c8bb50102d2, ad3eeeec77ddc069ddc0bc0531dc8c3da4b48eb15e9ed097e7568a8b16442ff3, ba2b1262c4492d32c7f1e4713f8b22e855315414395e4d32e9ec369845279792, ba6fdc007e5a23453c136283301b63743e92caa5742b67a34cdf5db483aa8741, bde4966990afdde03df017bd79889a11cabb522577952f1fe6f6f0dbd85cfc09, c49cf406c3b2fc29807dc710623f5bf740c54d7d2ebaa07803c3c227dc0e6917, e4a0aa2bb7e9003d1f436e1fcc783c4949f38e24d0d9b960ae9411609fe9c0a6excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256
process.thread.Ext.call_stack_final_user_module.nameeqUnknown, Undeterminedexcludes:process.thread.Ext.call_stack_final_user_module.name field:"process.thread.Ext.call_stack_final_user_module.name" value:"Unknown" field:"process.thread.Ext.call_stack_final_user_module.name" value:"Undetermined"
process.thread.Ext.call_stack_final_user_module.pathstarts_withc:\program files\, c:\program files (x86)\excludes:process.thread.Ext.call_stack_final_user_module.path field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\program files\" field:"process.thread.Ext.call_stack_final_user_module.path" value:"c:\program files (x86)\"
process.thread.Ext.call_stack_final_user_module.protection_provenancewildcardUnknown, Kernel*, Undeterminedexcludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Unknown" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Kernel*" field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"Undetermined"
process.thread.Ext.call_stack_summarymatchntdll.dll|tmmon.dll|excludes:process.thread.Ext.call_stack_summary field:"process.thread.Ext.call_stack_summary" value:"ntdll.dll|tmmon.dll|"

Remote File Download via MpCmdRun

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies the Windows Defender configuration utility (MpCmdRun.exe) being used to download a remote file.

MITRE ATT&CK Coverage

TacticTechniques
Command & Control

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2020/09/03"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"

[transform]
[[transform.investigate]]
label = "Alerts associated with the user in the last 48h"
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "user.id", queryType = "phrase", value = "{{user.id}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "Alerts associated with the host in the last 48h"
providers = [
  [
    { excluded = false, field = "event.kind", queryType = "phrase", value = "signal", valueType = "string" },
    { excluded = false, field = "host.name", queryType = "phrase", value = "{{host.name}}", valueType = "string" }
  ]
]
relativeFrom = "now-48h/h"
relativeTo = "now"

[[transform.investigate]]
label = "Investigate the Subject Process Network Events"
providers = [
  [
    { excluded = false, field = "event.category", queryType = "phrase", value = "network", valueType = "string" },
    { excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.entity_id}}", valueType = "string" }
  ]
]

[[transform.osquery]]
label = "Osquery - Retrieve DNS Cache"
query = "SELECT * FROM dns_cache"

[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"

[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""

[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""


[rule]
author = ["Elastic"]
description = "Identifies the Windows Defender configuration utility (MpCmdRun.exe) being used to download a remote file."
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 = "Remote File Download via MpCmdRun"
note = """## Triage and analysis

### Investigating Remote File Download via MpCmdRun

Attackers commonly transfer tooling or malware from external systems into a compromised environment using the command and control channel. However, they can also abuse signed utilities to drop these files.

The `MpCmdRun.exe` is a command-line tool part of Windows Defender and is used to manage various Microsoft Windows Defender Antivirus settings and perform certain tasks. It can also be abused by attackers to download remote files, including malware and offensive tooling. This rule looks for the patterns used to perform downloads using the utility.

> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
> This investigation guide uses the [Investigate Markdown Plugin](https://www.elastic.co/guide/en/security/current/interactive-investigation-guides.html) introduced in Elastic Stack version 8.8.0. Older Elastic Stack versions will display unrendered Markdown in this guide.

#### Possible investigation steps

- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
  - $investigate_0
  - $investigate_1
- Check the reputation of the domain or IP address used to host the downloaded file.
- Examine the host for derived artifacts that indicate suspicious activities:
  - Analyze the file using a private sandboxed analysis system.
  - Observe and collect information about the following activities in both the sandbox and the alert subject host:
    - Attempts to contact external domains and addresses.
      - Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
        - $investigate_2
      - Examine the DNS cache for suspicious or anomalous entries.
        - $osquery_0
    - Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
    - Examine the host services for suspicious or anomalous entries.
      - $osquery_1
      - $osquery_2
      - $osquery_3
  - Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Investigate potentially compromised accounts. Analysts can do this by searching for login events (for example, 4624) to the target host after the registry modification.

### False positive analysis

- This activity is unlikely to happen legitimately. Benign true positives (B-TPs) can be added as exceptions if necessary.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
  - Implement temporary network rules, procedures, and segmentation to contain the malware.
  - Stop suspicious processes.
  - Immediately block the identified indicators of compromise (IoCs).
  - Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""

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)
"""

references = [
    "https://twitter.com/mohammadaskar2/status/1301263551638761477",
    "https://www.bleepingcomputer.com/news/microsoft/microsoft-defender-can-ironically-be-used-to-download-malware/",
]
risk_score = 47
rule_id = "c6453e73-90eb-4fe7-a98c-cde7bbfc504a"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Command and Control",
    "Resources: Investigation Guide",
    "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",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "windows" and event.type == "start" and
  (process.name : "MpCmdRun.exe" or ?process.pe.original_file_name == "MpCmdRun.exe") and
   process.args : "-DownloadFile" and process.args : "-url" and process.args : "-path"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"


[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"

Stages and Predicates

Stage 1: process

process where host.os.type == "windows" and event.type == "start" and
  (process.name : "MpCmdRun.exe" or ?process.pe.original_file_name == "MpCmdRun.exe") and
   process.args : "-DownloadFile" and process.args : "-url" and process.args : "-path"

Indicators

These rows show field, operator, and value matches.

Scripting or Unsigned Binary Performing DNS Lookups to Ethereum RPC Providers

#
Time window
5m
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies scripting engines or unsigned/suspicious-path processes followed by DNS lookups to known Ethereum RPC provider domains. This may indicate cryptocurrency mining, wallet drainers, or other blockchain-related malware using public RPC infrastructure for command and control or on-chain interaction.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies scripting engines or unsigned/suspicious-path processes followed by DNS lookups to known Ethereum RPC
provider domains. This may indicate cryptocurrency mining, wallet drainers, or other blockchain-related malware using
public RPC infrastructure for command and control or on-chain interaction.
"""
id = "a3c8e0f7-5b9d-1e4a-c2f6-8e7b5a4d3c1f"
license = "Elastic License v2"
name = "Scripting or Unsigned Binary Performing DNS Lookups to Ethereum RPC Providers"
os_list = ["windows"]
reference = [
    "https://attack.mitre.org/tactics/TA0011/",
    "https://attack.mitre.org/techniques/T1071/004/",
    "https://attack.mitre.org/techniques/T1496/",
]
version = "1.0.1"

query = '''
sequence by process.entity_id with maxspan=5m
[process where event.action == "start" and
 (
  process.name : ("node.exe", "javaw.exe", "python*.exe", "deno.exe", "powershell.exe", "wscript.exe", "AutoIt*.exe") or
  process.pe.original_file_name : ("node.exe", "javaw.exe", "java.exe", "python*.exe", "deno.exe", "powershell.exe", "wscript.exe", "AutoIt*.exe") or
  process.code_signature.subject_name : ("OpenJS Foundation", "Python Software Foundation", "Deno", "Eclipse.org Foundation, Inc.", "AutoIt Consulting Ltd") or
  ((process.code_signature.trusted == false or process.code_signature.exists == false) and
   (process.Ext.relative_file_name_modify_time <= 500 or process.Ext.relative_file_creation_time <= 500))
 )]
[dns where dns.question.name : (
  "*ethereum.org",
  "*infura.io",
  "*alchemy.com",
  "*alchemyapi.io",
  "*ankr.com",
  "*quiknode.pro",
  "*tatum.io",
  "*thirdweb.com",
  "*tenderly.co",
  "*flashbots.net",
  "*mevblocker.io",
  "*drpc.org",
  "*blockpi.network",
  "*llamarpc.com",
  "*1rpc.io",
  "*0xrpc.io",
  "*nodies.app",
  "*blastapi.io",
  "*nownodes.io",
  "*pokt.network",
  "*merkle.io",
  "*blinklabs.xyz",
  "*leorpc.com",
  "*publicnode.com",
  "*cloudflare-eth.com",
  "*payload.de",
  "*etherscan.io",
  "*api.etherscan.io",
  "*ethplorer.io",
  "*blockchair.com",
  "*eth-mainnet.gateway.pokt.network",
  "*gateway.pokt.network",
  "*pokt.io",
  "*getblock.io",
  "*chainstack.com",
  "*moralis.io",
  "*quicknode.com",
  "*quiknode.com",
  "*figment.io",
  "*nodesmith.io",
  "*blockdaemon.com",
  "*onfinality.io",
  "*ankr-rpc.com",
  "*rpc.flashbots.net",
  "*rpc.mevblocker.io",
  "*eth.llamarpc.com",
  "*mainnet.publicnode.com",
  "*ethereum.publicnode.com",
  "*rpc.payload.de",
  "*hardhat.org",
  "*foundry.paradigm.xyz",
  "*paradigm.xyz",
  "*ethrpc.com",
  "*web3api.com"
)]
'''

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 = "T1071"
name = "Application Layer Protocol"
reference = "https://attack.mitre.org/techniques/T1071/"
[[threat.technique.subtechnique]]
id = "T1071.004"
name = "DNS"
reference = "https://attack.mitre.org/techniques/T1071/004/"



[threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1496"
name = "Resource Hijacking"
reference = "https://attack.mitre.org/techniques/T1496/"


[threat.tactic]
id = "TA0040"
name = "Impact"
reference = "https://attack.mitre.org/tactics/TA0040/"

[internal]
min_endpoint_version = "8.10.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5m, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and
 (
  process.name : ("node.exe", "javaw.exe", "python*.exe", "deno.exe", "powershell.exe", "wscript.exe", "AutoIt*.exe") or
  process.pe.original_file_name : ("node.exe", "javaw.exe", "java.exe", "python*.exe", "deno.exe", "powershell.exe", "wscript.exe", "AutoIt*.exe") or
  process.code_signature.subject_name : ("OpenJS Foundation", "Python Software Foundation", "Deno", "Eclipse.org Foundation, Inc.", "AutoIt Consulting Ltd") or
  ((process.code_signature.trusted == false or process.code_signature.exists == false) and
   (process.Ext.relative_file_name_modify_time <= 500 or process.Ext.relative_file_creation_time <= 500))
 )]

Stage 2: dns

[dns where dns.question.name : (
  "*ethereum.org",
  "*infura.io",
  "*alchemy.com",
  "*alchemyapi.io",
  "*ankr.com",
  "*quiknode.pro",
  "*tatum.io",
  "*thirdweb.com",
  "*tenderly.co",
  "*flashbots.net",
  "*mevblocker.io",
  "*drpc.org",
  "*blockpi.network",
  "*llamarpc.com",
  "*1rpc.io",
  "*0xrpc.io",
  "*nodies.app",
  "*blastapi.io",
  "*nownodes.io",
  "*pokt.network",
  "*merkle.io",
  "*blinklabs.xyz",
  "*leorpc.com",
  "*publicnode.com",
  "*cloudflare-eth.com",
  "*payload.de",
  "*etherscan.io",
  "*api.etherscan.io",
  "*ethplorer.io",
  "*blockchair.com",
  "*eth-mainnet.gateway.pokt.network",
  "*gateway.pokt.network",
  "*pokt.io",
  "*getblock.io",
  "*chainstack.com",
  "*moralis.io",
  "*quicknode.com",
  "*quiknode.com",
  "*figment.io",
  "*nodesmith.io",
  "*blockdaemon.com",
  "*onfinality.io",
  "*ankr-rpc.com",
  "*rpc.flashbots.net",
  "*rpc.mevblocker.io",
  "*eth.llamarpc.com",
  "*mainnet.publicnode.com",
  "*ethereum.publicnode.com",
  "*rpc.payload.de",
  "*hardhat.org",
  "*foundry.paradigm.xyz",
  "*paradigm.xyz",
  "*ethrpc.com",
  "*web3api.com"
)]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dns.question.namewildcard
  • *0xrpc.io
  • *1rpc.io
  • *alchemy.com
  • *alchemyapi.io
  • *ankr-rpc.com
  • *ankr.com
  • *api.etherscan.io
  • *blastapi.io
  • *blinklabs.xyz
  • *blockchair.com
  • *blockdaemon.com
  • *blockpi.network
  • *chainstack.com
  • *cloudflare-eth.com
  • *drpc.org
  • *eth-mainnet.gateway.pokt.network
  • *eth.llamarpc.com
  • *ethereum.org
  • *ethereum.publicnode.com
  • *etherscan.io
  • *ethplorer.io
  • *ethrpc.com
  • *figment.io
  • *flashbots.net
  • *foundry.paradigm.xyz
  • *gateway.pokt.network
  • *getblock.io
  • *hardhat.org
  • *infura.io
  • *leorpc.com
  • *llamarpc.com
  • *mainnet.publicnode.com
  • *merkle.io
  • *mevblocker.io
  • *moralis.io
  • *nodesmith.io
  • *nodies.app
  • *nownodes.io
  • *onfinality.io
  • *paradigm.xyz
  • *payload.de
  • *pokt.io
  • *pokt.network
  • *publicnode.com
  • *quicknode.com
  • *quiknode.com
  • *quiknode.pro
  • *rpc.flashbots.net
  • *rpc.mevblocker.io
  • *rpc.payload.de
  • *tatum.io
  • *tenderly.co
  • *thirdweb.com
  • *web3api.com
field:"QueryName" kind:wildcard
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.Ext.relative_file_creation_timele
  • 500 transforms: number corpus 28 (elastic 28)
field:"process.Ext.relative_file_creation_time" kind:le value:"500"
process.Ext.relative_file_name_modify_timele
  • 500 transforms: number corpus 21 (elastic 21)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"500"
process.code_signature.existseq
  • false transforms: boolean corpus 118 (elastic 118)
field:"process.code_signature.exists" kind:eq value:"false"
process.code_signature.subject_namewildcard
  • AutoIt Consulting Ltd corpus 5 (elastic 5)
  • Deno
  • Eclipse.org Foundation, Inc.
  • OpenJS Foundation corpus 6 (elastic 6)
  • Python Software Foundation corpus 6 (elastic 6)
field:"Signature" kind:wildcard
process.code_signature.trustedeq
  • false transforms: boolean corpus 114 (elastic 114)
field:"process.code_signature.trusted" kind:eq value:"false"
process.namewildcard
  • AutoIt*.exe corpus 4 (elastic 4)
  • deno.exe corpus 2 (elastic 2)
  • javaw.exe corpus 4 (elastic 4)
  • node.exe corpus 8 (elastic 8)
  • powershell.exe corpus 12 (elastic 12)
  • python*.exe corpus 4 (elastic 4)
  • wscript.exe corpus 9 (elastic 9)
field:"process_basename" kind:wildcard
process.pe.original_file_namewildcard
  • AutoIt*.exe corpus 8 (elastic 8)
  • deno.exe
  • java.exe
  • javaw.exe
  • node.exe corpus 3 (elastic 3)
  • powershell.exe
  • python*.exe corpus 2 (elastic 2)
  • wscript.exe corpus 2 (elastic 2)
field:"OriginalFileName" kind:wildcard

Segfault from Sensitive Process Detected

#
Status
production
Severity
medium
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Monitors kernel logs for segfault messages from sensitive processes. A segfault, or segmentation fault, is an error that occurs when a program tries to access a memory location that it's not allowed to access, typically leading to program termination. A segfault can be an indication of malicious behavior if it results from attempts to exploit buffer overflows, inject shared objects, or other vulnerabilities in software to execute arbitrary code or disrupt its normal operation.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2026/05/28"
integration = ["system"]
maturity = "production"
updated_date = "2026/06/01"

[rule]
author = ["Elastic"]
description = """
Monitors kernel logs for segfault messages from sensitive processes. A segfault, or segmentation fault, is an error
that occurs when a program tries to access a memory location that it's not allowed to access, typically leading to
program termination. A segfault can be an indication of malicious behavior if it results from attempts to exploit
buffer overflows, inject shared objects, or other vulnerabilities in software to execute arbitrary code or disrupt
its normal operation.
"""
from = "now-9m"
index = ["logs-system.syslog-*", "filebeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "Segfault from Sensitive Process Detected"
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 Segfault from Sensitive Process Detected

This alert flags a Linux kernel-reported segmentation fault in a sensitive service or authentication-related process, which matters because unexpected crashes in these programs often mark memory corruption, exploit attempts, or deliberate disruption around privileged execution and credential handling. An attacker might feed a crafted request to sshd, sudo, pkexec, or a web daemon to trigger a crash while exploiting a buffer overflow or forcing a malicious library load to gain code execution or access secrets.

### Possible investigation steps

- Correlate the crash timestamp with application, authentication, and reverse-proxy logs plus inbound connections to identify the exact user action, request, or source IP that immediately preceded the fault.
- Determine whether the executable and loaded libraries changed recently by comparing package version, file hashes, ownership, and recent writes in system paths, and note any recent upgrades that could explain a benign stability issue.
- Collect the core dump, journald entries, and surrounding kernel messages to extract the faulting address, signal details, stack trace, and library references, which can help distinguish a known software bug from memory-corruption or injection activity.
- Review adjacent endpoint telemetry on the same host for exploitation indicators such as abnormal child processes, privilege-escalation attempts, ptrace activity, unexpected environment manipulation, dropped shared objects, or new outbound connections after the crash.
- If the crashed service handles authentication or privileged actions, scope impact by identifying failed or successful logins, credential access attempts, service restarts, and user disruption, then isolate and patch the host if crashes recur or align with suspicious activity.

### False positive analysis

- A legitimate package upgrade or service restart can expose a software bug in a sensitive daemon such as sshd, nginx, or sudo; verify by checking for recent version or library changes, planned maintenance, and the absence of suspicious requests or follow-on process activity around the crash time.
- An approved configuration change or normal user action can trigger an edge-case parsing error that crashes services such as httpd, rsyslogd, or openvpn; verify by reviewing recent config edits and service logs to confirm the segfault aligns with the authorized change and does not coincide with anomalous authentication or network events.

### Response and remediation

- Isolate the affected Linux host from the network, stop the crashing sensitive service, and block the source IPs, URLs, or client requests that immediately preceded the segfault to prevent additional exploitation.
- Preserve the core dump, journald history, and the crashing binary for evidence, then escalate to incident response immediately if the crash was followed by root shell activity, successful sudo or pkexec use, access to /etc/shadow or credential stores, or similar segfaults on multiple hosts.
- Remove attacker persistence by deleting unauthorized shared objects, LD_PRELOAD entries, cron jobs, systemd units, startup scripts, web shells, modified SSH authorized_keys files, and any trojanized copies of the affected executable or its libraries.
- Restore the system to a known-good state by rebuilding from a trusted image or reinstalling affected packages from signed repositories, validate file integrity before reconnecting it, and rotate passwords, SSH keys, API tokens, and service secrets that may have been exposed on the host.
- Harden the environment by patching the vulnerable service and dependent libraries, enforcing SELinux or AppArmor and least-privilege service accounts, restricting who can read core dumps, and adding detections for repeated crashes, unexpected library loads, and child processes spawned by sensitive services.
"""
risk_score = 47
rule_id = "01e244f0-fef9-4102-903f-9788052b2c91"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Tactic: Execution",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
host.os.type:linux and event.dataset:system.syslog and process.name:kernel and
message:(
  segfault and (
    agetty or apache2 or atd or auditbeat or auditd or beacon-chain or besu or chage or
    chfn or chsh or clef or cron or crond or dbus-broker or dbus-daemon or dnsmasq or
    elastic-agent or erigon or ethrex or ethsigner or geth or getty or gpasswd or
    grandine or httpd or krb5_child or ldap_child or lighthouse or lodestar or login or
    logrotate or named or nethermind or newgrp or nginx or nslcd or op-batcher or
    op-challenger or op-conductor or op-geth or op-node or op-proposer or openvpn or
    osqueryd or passwd or pkexec or polkitd or proftpd or prysm or reth or rsyslogd or
    smbd or ssh or sshd or sssd or sssd_nss or sssd_pam or su or sudo or sudoedit or
    systemd-logind or teku or unix_chkpwd or vsftpd or web3signer
  )
)
'''

[[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]]
id = "T1212"
name = "Exploitation for Credential Access"
reference = "https://attack.mitre.org/techniques/T1212/"

[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 = "T1203"
name = "Exploitation for Client Execution"
reference = "https://attack.mitre.org/techniques/T1203/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

Stages and Predicates

Stage 1: query

host.os.type:linux and event.dataset:system.syslog and process.name:kernel and
message:(
  segfault and (
    agetty or apache2 or atd or auditbeat or auditd or beacon-chain or besu or chage or
    chfn or chsh or clef or cron or crond or dbus-broker or dbus-daemon or dnsmasq or
    elastic-agent or erigon or ethrex or ethsigner or geth or getty or gpasswd or
    grandine or httpd or krb5_child or ldap_child or lighthouse or lodestar or login or
    logrotate or named or nethermind or newgrp or nginx or nslcd or op-batcher or
    op-challenger or op-conductor or op-geth or op-node or op-proposer or openvpn or
    osqueryd or passwd or pkexec or polkitd or proftpd or prysm or reth or rsyslogd or
    smbd or ssh or sshd or sssd or sssd_nss or sssd_pam or su or sudo or sudoedit or
    systemd-logind or teku or unix_chkpwd or vsftpd or web3signer
  )
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.dataseteq
  • system.syslog
field:"event.dataset" kind:eq value:"system.syslog"
messageeq
  • segfault
field:"message" kind:eq value:"segfault"
messagein
  • agetty
  • apache2
  • atd
  • auditbeat
  • auditd
  • beacon-chain
  • besu
  • chage
  • chfn
  • chsh
  • clef
  • cron
  • crond
  • dbus-broker
  • dbus-daemon
  • dnsmasq
  • elastic-agent
  • erigon
  • ethrex
  • ethsigner
  • geth
  • getty
  • gpasswd
  • grandine
  • httpd
  • krb5_child
  • ldap_child
  • lighthouse
  • lodestar
  • login
  • logrotate
  • named
  • nethermind
  • newgrp
  • nginx
  • nslcd
  • op-batcher
  • op-challenger
  • op-conductor
  • op-geth
  • +25 more values (see full rule source)
field:"message" kind:in
process.nameeq
  • kernel
field:"process_basename" kind:eq value:"kernel"

Service Control Spawned via Script Interpreter

#
Status
production
Severity
low
Time window
9m
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies Service Control (sc.exe) spawning from script interpreter processes to create, modify, or start services. This can potentially indicate an attempt to elevate privileges or maintain persistence.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2020/02/18"
integration = ["endpoint", "system", "windows", "m365_defender", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"

[transform]
[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"

[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""

[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""


[rule]
author = ["Elastic"]
description = """
Identifies Service Control (sc.exe) spawning from script interpreter processes to create, modify, or start services.
This can potentially indicate an attempt to elevate privileges or maintain persistence.
"""
from = "now-9m"
index = [
    "endgame-*",
    "logs-crowdstrike.fdr*",
    "logs-endpoint.events.process-*",
    "logs-m365_defender.event-*",
    "logs-system.security*",
    "logs-windows.forwarded*",
    "winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Service Control Spawned via Script Interpreter"
note = """## Triage and analysis

### Investigating Service Control Spawned via Script Interpreter

Windows services are background processes that run with SYSTEM privileges and provide specific functionality or support to other applications and system components.

The `sc.exe` command line utility is used to manage and control Windows services on a local or remote computer. Attackers may use `sc.exe` to create, modify, and start services to elevate their privileges from administrator to SYSTEM.

> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.

#### Possible investigation steps

- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Examine the command line, registry changes events, and Windows events related to service activities (for example, 4697 and/or 7045) for suspicious characteristics.
  - Examine the created and existent services, the executables or drivers referenced, and command line arguments for suspicious entries.
    - $osquery_0
    - $osquery_1
    - $osquery_2
  - Retrieve the referenced files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the account owner and confirm whether they are aware of this activity.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Assess whether this behavior is prevalent in the environment by looking for similar occurrences across hosts.

### False positive analysis

- This activity is not inherently malicious if it occurs in isolation. As long as the analyst did not identify suspicious activity related to the user, host, and service, such alerts can be dismissed.

### Response and remediation

- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved host to prevent further post-compromise behavior.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Delete the service or restore it to the original configuration.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""

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)
- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
"""

references = ["https://www.elastic.co/security-labs/invisible-miners-unveiling-ghostengine"]
risk_score = 21
rule_id = "e8571d5f-bea1-46c2-9f56-998de2d3ed95"
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Privilege Escalation",
    "Tactic: Defense Evasion",
    "Tactic: Execution",
    "Data Source: Elastic Endgame",
    "Resources: Investigation Guide",
    "Data Source: Elastic Defend",
    "Data Source: Windows Security Event Logs",
    "Data Source: Microsoft Defender XDR",
    "Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
/* This rule is not compatible with Sysmon due to user.id issues */

process where host.os.type == "windows" and event.type == "start" and
  (process.name : "sc.exe" or ?process.pe.original_file_name == "sc.exe") and
  process.parent.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe",
                         "wmic.exe", "mshta.exe","powershell.exe", "pwsh.exe") and
  process.args:("config", "create", "start", "delete", "stop", "pause") and
  /* exclude SYSTEM SID - look for service creations by non-SYSTEM user */
  not user.id : "S-1-5-18"
'''


[[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.technique.subtechnique]]
id = "T1543.003"
name = "Windows Service"
reference = "https://attack.mitre.org/techniques/T1543/003/"

[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 = "T1047"
name = "Windows Management Instrumentation"
reference = "https://attack.mitre.org/techniques/T1047/"

[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"

[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"

[[rule.threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"

[[rule.threat.technique.subtechnique]]
id = "T1059.005"
name = "Visual Basic"
reference = "https://attack.mitre.org/techniques/T1059/005/"

[[rule.threat.technique]]
id = "T1569"
name = "System Services"
reference = "https://attack.mitre.org/techniques/T1569/"

[[rule.threat.technique.subtechnique]]
id = "T1569.002"
name = "Service Execution"
reference = "https://attack.mitre.org/techniques/T1569/002/"

[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"

[[rule.threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"

[[rule.threat.technique.subtechnique]]
id = "T1218.010"
name = "Regsvr32"
reference = "https://attack.mitre.org/techniques/T1218/010/"

[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"

[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 : "sc.exe" or ?process.pe.original_file_name == "sc.exe") and
  process.parent.name : ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe",
                         "wmic.exe", "mshta.exe","powershell.exe", "pwsh.exe") and
  process.args:("config", "create", "start", "delete", "stop", "pause") and
  not user.id : "S-1-5-18"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argswildcard
  • config corpus 3 (elastic 3)
  • create corpus 5 (elastic 5)
  • delete corpus 6 (elastic 6)
  • pause
  • start corpus 7 (elastic 7)
  • stop corpus 5 (elastic 5)
field:"process.args" kind:wildcard
process.namewildcard
  • sc.exe corpus 32 (elastic 17, splunk 15)
field:"process_basename" kind:wildcard value:"sc.exe"
process.parent.namewildcard
  • cmd.exe corpus 37 (elastic 32, splunk 4, kusto 1)
  • mshta.exe corpus 24 (elastic 22, splunk 2)
  • powershell.exe corpus 37 (elastic 35, splunk 1, kusto 1)
  • pwsh.exe corpus 5 (elastic 5)
  • regsvr32.exe corpus 13 (elastic 13)
  • rundll32.exe corpus 20 (elastic 20)
  • wmic.exe corpus 4 (elastic 3, splunk 1)
  • wscript.exe corpus 24 (elastic 23, splunk 1)
field:"parent_process_basename" kind:wildcard
process.pe.original_file_nameeq
  • sc.exe corpus 2 (elastic 2)
field:"OriginalFileName" kind:eq value:"sc.exe"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"

Shared Object Injection via Process Environment Variable

#
Source
github.com/elastic/protections-artifacts

This rule detects the use of process environment variables LD_PRELOAD to inject a shared library into a binary at or prior to execution. A threat actor may do this to load a malicious shared library for persistence, privilege escalation, and defense evasion. This activity is not common and should indicate malicious or suspicious behavior.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule detects the use of process environment variables LD_PRELOAD to inject a shared library into a binary at or
prior to execution. A threat actor may do this to load a malicious shared library for persistence, privilege escalation,
and defense evasion. This activity is not common and should indicate malicious or suspicious behavior.
"""
id = "f6f74bd6-414a-4f22-89ec-c045d634a805"
license = "Elastic License v2"
name = "Shared Object Injection via Process Environment Variable"
os_list = ["linux"]
reference = ["https://attack.mitre.org/techniques/T1574/006/"]
version = "1.0.50"

query = '''
process where event.type == "start" and event.action == "exec" and process.env_vars like "LD_PRELOAD=?*" and 
  (
    (
      process.env_vars like ("LD_PRELOAD=/tmp/*.so", 
                          "LD_PRELOAD=./*.so", 
                          "LD_PRELOAD=$LD_PRELOAD*",  
                          "LD_PRELOAD=$*LD_PRELOAD*")
    ) or 
    (
      process.command_line : ("./*") and 
      process.env_vars : ("LD_PRELOAD=/home/*",
                          "LD_PRELAOD=/tmp/*",
                          "LD_PRELOAD=/dev/shm/*",
                          "LD_PRELOAD=/run/*")
    ) or 
    (
      process.executable : ("/bin/busybox", 
                            "/usr/bin/busybox", 
                            "/bin/vi", 
                            "/usr/bin/vi") and 
      process.env_vars : "LD_PRELOAD=*.so"
    ) or 
    (
      process.args_count <= 1 and 
      process.parent.name : ("bash", "sh") and
      process.env_vars : ("LD_PRELOAD=/home/*",
                          "LD_PRELAOD=/tmp/*",
                          "LD_PRELOAD=/dev/shm/*",
                          "LD_PRELOAD=/run/*")
    ) or
    (process.env_vars : "LD_PRELOAD=/proc/*")
  ) and not (
  process.env_vars like (
    "LD_PRELOAD=", "LD_LIBRARY_PATH=", "LD_PRELOAD=/tmp/pressure-vessel-libs-*/${LIB}/gameoverlayrenderer.so",
    "LD_PRELOAD=*/.mount_*", "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2",
    "LD_PRELOAD=/opt/deepinstinct/bin/libDeepInterception.so", "LD_PRELOAD=/usr/lib/preloadable_libiconv.so",
    "LD_PRELOAD=./build/liblib.so", "LD_PRELOAD=/usr/libexec/sudo/sudo_noexec.so", "LD_PRELOAD=/home/oracle/*",
    "LD_PRELOAD=/home/*/lib/python*/site-packages/*", "*LD_PRELOAD=*MATLAB*ld_shim.so.2.*", 
    "LD_PRELOAD=/tmp/intercept-*/libear.so",
    "LD_PRELOAD=/opt/dynatrace/oneagent/agent/bin/current/linux-x86-64/liboneagentproc.so",
    "LD_PRELOAD=/home/*/.local/lib/vivaldi/media-codecs-*/libffmpeg.so",
    "LD_PRELOAD=/usr/local/lib/libmimalloc.so", "LD_PRELOAD=/home/*/opt/commvault/Base/libCvDllFilter.so",
    "LD_PRELOAD=/usr/lib/libjemalloc.so.2:/opt/zlib-ng/lib/libz.so",
    "LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so", "LD_PRELOAD=/usr/lib/libnss_wrapper.so",
    "LD_PRELOAD=/tmp/*/openwrt-imagebuilder*/runas.so", "LD_PRELOAD=/tmp/pressure-vessel-libs-*/libMangoHud_shim.so",
    "LD_PRELOAD=/home/libjemalloc.so.2", "LD_PRELOAD=/tmp/libredirectnull.so", "LD_PRELOAD=/tmp/libcuda_trace.so",
    "LD_PRELOAD=:/usr/lib/libjemalloc.so", "LD_PRELOAD=/lib/libSegFault.so", "LD_PRELOAD=/tmp/baum/easybuild/*",
    "LD_PRELOAD=/home/*/.local/share/WebexLauncher/*/bin/../lib/libCefMallinfoShim.so"
  ) or
  (process.env_vars == "LD_PRELOAD=./getrandom.so" and process.parent.command_line == "/opt/perlbrew/perls/perl-5.40.3/bin/perl t/getrandom.t") or
  process.parent.command_line == "runc init" or
  process.parent.executable like (
    "/usr/local/bin/fluentd", "/nix/store/*", "/usr/lib/pressure-vessel/from-host/bin/pressure-vessel-adverb", 
    "/opt/tm/toolchains/*", "/bin/sudoedit"
  ) or
  process.executable == "/usr/bin/adb" or
  process.executable like "/tmp/newroot/*" or
  (
    process.env_vars like "LD_PRELOAD=/tmp/pytest-of-*/*/.runtime/qgc/libqgc_timer_guard.so" and
    process.parent.executable == "/usr/bin/bash"
  ) or
  process.parent.command_line like "*/.codex/worktrees/*"
)
'''

min_endpoint_version = "8.6.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 = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"
[[threat.technique.subtechnique]]
id = "T1574.006"
name = "Dynamic Linker Hijacking"
reference = "https://attack.mitre.org/techniques/T1574/006/"



[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[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.006"
name = "Dynamic Linker Hijacking"
reference = "https://attack.mitre.org/techniques/T1574/006/"



[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.006"
name = "Dynamic Linker Hijacking"
reference = "https://attack.mitre.org/techniques/T1574/006/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.6.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.env_vars like "LD_PRELOAD=?*" and 
  (
    (
      process.env_vars like ("LD_PRELOAD=/tmp/*.so", 
                          "LD_PRELOAD=./*.so", 
                          "LD_PRELOAD=$LD_PRELOAD*",  
                          "LD_PRELOAD=$*LD_PRELOAD*")
    ) or 
    (
      process.command_line : ("./*") and 
      process.env_vars : ("LD_PRELOAD=/home/*",
                          "LD_PRELAOD=/tmp/*",
                          "LD_PRELOAD=/dev/shm/*",
                          "LD_PRELOAD=/run/*")
    ) or 
    (
      process.executable : ("/bin/busybox", 
                            "/usr/bin/busybox", 
                            "/bin/vi", 
                            "/usr/bin/vi") and 
      process.env_vars : "LD_PRELOAD=*.so"
    ) or 
    (
      process.args_count <= 1 and 
      process.parent.name : ("bash", "sh") and
      process.env_vars : ("LD_PRELOAD=/home/*",
                          "LD_PRELAOD=/tmp/*",
                          "LD_PRELOAD=/dev/shm/*",
                          "LD_PRELOAD=/run/*")
    ) or
    (process.env_vars : "LD_PRELOAD=/proc/*")
  ) and not (
  process.env_vars like (
    "LD_PRELOAD=", "LD_LIBRARY_PATH=", "LD_PRELOAD=/tmp/pressure-vessel-libs-*/${LIB}/gameoverlayrenderer.so",
    "LD_PRELOAD=*/.mount_*", "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2",
    "LD_PRELOAD=/opt/deepinstinct/bin/libDeepInterception.so", "LD_PRELOAD=/usr/lib/preloadable_libiconv.so",
    "LD_PRELOAD=./build/liblib.so", "LD_PRELOAD=/usr/libexec/sudo/sudo_noexec.so", "LD_PRELOAD=/home/oracle/*",
    "LD_PRELOAD=/home/*/lib/python*/site-packages/*", "*LD_PRELOAD=*MATLAB*ld_shim.so.2.*", 
    "LD_PRELOAD=/tmp/intercept-*/libear.so",
    "LD_PRELOAD=/opt/dynatrace/oneagent/agent/bin/current/linux-x86-64/liboneagentproc.so",
    "LD_PRELOAD=/home/*/.local/lib/vivaldi/media-codecs-*/libffmpeg.so",
    "LD_PRELOAD=/usr/local/lib/libmimalloc.so", "LD_PRELOAD=/home/*/opt/commvault/Base/libCvDllFilter.so",
    "LD_PRELOAD=/usr/lib/libjemalloc.so.2:/opt/zlib-ng/lib/libz.so",
    "LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so", "LD_PRELOAD=/usr/lib/libnss_wrapper.so",
    "LD_PRELOAD=/tmp/*/openwrt-imagebuilder*/runas.so", "LD_PRELOAD=/tmp/pressure-vessel-libs-*/libMangoHud_shim.so",
    "LD_PRELOAD=/home/libjemalloc.so.2", "LD_PRELOAD=/tmp/libredirectnull.so", "LD_PRELOAD=/tmp/libcuda_trace.so",
    "LD_PRELOAD=:/usr/lib/libjemalloc.so", "LD_PRELOAD=/lib/libSegFault.so", "LD_PRELOAD=/tmp/baum/easybuild/*",
    "LD_PRELOAD=/home/*/.local/share/WebexLauncher/*/bin/../lib/libCefMallinfoShim.so"
  ) or
  (process.env_vars == "LD_PRELOAD=./getrandom.so" and process.parent.command_line == "/opt/perlbrew/perls/perl-5.40.3/bin/perl t/getrandom.t") or
  process.parent.command_line == "runc init" or
  process.parent.executable like (
    "/usr/local/bin/fluentd", "/nix/store/*", "/usr/lib/pressure-vessel/from-host/bin/pressure-vessel-adverb", 
    "/opt/tm/toolchains/*", "/bin/sudoedit"
  ) or
  process.executable == "/usr/bin/adb" or
  process.executable like "/tmp/newroot/*" or
  (
    process.env_vars like "LD_PRELOAD=/tmp/pytest-of-*/*/.runtime/qgc/libqgc_timer_guard.so" and
    process.parent.executable == "/usr/bin/bash"
  ) or
  process.parent.command_line like "*/.codex/worktrees/*"
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.args_countle
  • 1 transforms: number
field:"process.args_count" kind:le value:"1"
process.command_linewildcard
  • ./*
field:"CommandLine" kind:wildcard value:"./*"
process.env_varswildcard
  • LD_PRELAOD=/tmp/*
  • LD_PRELOAD=$*LD_PRELOAD*
  • LD_PRELOAD=$LD_PRELOAD*
  • LD_PRELOAD=*.so
  • LD_PRELOAD=./*.so
  • LD_PRELOAD=/dev/shm/*
  • LD_PRELOAD=/home/*
  • LD_PRELOAD=/proc/*
  • LD_PRELOAD=/run/*
  • LD_PRELOAD=/tmp/*.so
  • LD_PRELOAD=?*
field:"process.env_vars" kind:wildcard
process.executablewildcard
  • /bin/busybox
  • /bin/vi
  • /usr/bin/busybox
  • /usr/bin/vi
field:"Image" kind:wildcard
process.parent.namewildcard
  • bash
  • sh
field:"parent_process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.env_varseqLD_PRELOAD=./getrandom.soexcludes:process.env_vars field:"process.env_vars" value:"LD_PRELOAD=./getrandom.so"
process.parent.command_lineeq/opt/perlbrew/perls/perl-5.40.3/bin/perl t/getrandom.texcludes:process.parent.command_line field:"process.parent.command_line" value:"/opt/perlbrew/perls/perl-5.40.3/bin/perl t/getrandom.t"
process.env_varswildcardLD_PRELOAD=/tmp/pytest-of-*/*/.runtime/qgc/libqgc_timer_guard.soexcludes:process.env_vars field:"process.env_vars" value:"LD_PRELOAD=/tmp/pytest-of-*/*/.runtime/qgc/libqgc_timer_guard.so"
process.parent.executableeq/usr/bin/bashexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/bash"
process.env_varswildcardLD_PRELOAD=, LD_LIBRARY_PATH=, LD_PRELOAD=/tmp/pressure-vessel-libs-*/${LIB}/gameoverlayrenderer.so, LD_PRELOAD=*/.mount_*, LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2, LD_PRELOAD=/opt/deepinstinct/bin/libDeepInterception.so, LD_PRELOAD=/usr/lib/preloadable_libiconv.so, LD_PRELOAD=./build/liblib.so, LD_PRELOAD=/usr/libexec/sudo/sudo_noexec.so, LD_PRELOAD=/home/oracle/*, LD_PRELOAD=/home/*/lib/python*/site-packages/*, *LD_PRELOAD=*MATLAB*ld_shim.so.2.*, LD_PRELOAD=/tmp/intercept-*/libear.so, LD_PRELOAD=/opt/dynatrace/oneagent/agent/bin/current/linux-x86-64/liboneagentproc.so, LD_PRELOAD=/home/*/.local/lib/vivaldi/media-codecs-*/libffmpeg.so, LD_PRELOAD=/usr/local/lib/libmimalloc.so, LD_PRELOAD=/home/*/opt/commvault/Base/libCvDllFilter.so, LD_PRELOAD=/usr/lib/libjemalloc.so.2:/opt/zlib-ng/lib/libz.so, LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so, LD_PRELOAD=/usr/lib/libnss_wrapper.so, LD_PRELOAD=/tmp/*/openwrt-imagebuilder*/runas.so, LD_PRELOAD=/tmp/pressure-vessel-libs-*/libMangoHud_shim.so, LD_PRELOAD=/home/libjemalloc.so.2, LD_PRELOAD=/tmp/libredirectnull.so, LD_PRELOAD=/tmp/libcuda_trace.so, LD_PRELOAD=:/usr/lib/libjemalloc.so, LD_PRELOAD=/lib/libSegFault.so, LD_PRELOAD=/tmp/baum/easybuild/*, LD_PRELOAD=/home/*/.local/share/WebexLauncher/*/bin/../lib/libCefMallinfoShim.soexcludes:process.env_vars
process.executableeq/usr/bin/adbexcludes:process.executable field:"process.executable" value:"/usr/bin/adb"
process.executablestarts_with/tmp/newroot/excludes:process.executable field:"process.executable" value:"/tmp/newroot/"
process.parent.command_lineeqrunc initexcludes:process.parent.command_line field:"process.parent.command_line" value:"runc init"
process.parent.command_linematch/.codex/worktrees/excludes:process.parent.command_line field:"process.parent.command_line" value:"/.codex/worktrees/"
process.parent.executablewildcard/usr/local/bin/fluentd, /nix/store/*, /usr/lib/pressure-vessel/from-host/bin/pressure-vessel-adverb, /opt/tm/toolchains/*, /bin/sudoeditexcludes:process.parent.executable

Shellcode behavior from suspicious RWX provenance

#
Source
github.com/elastic/protections-artifacts

Identifies suspicious API calls from a signed module and originating from suspicious RWX memory. This may indicate an attempt to perform code injection.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies suspicious API calls from a signed module and originating from suspicious RWX memory. This may indicate an
attempt to perform code injection.
"""
id = "a8bacf2b-23a9-4a6d-a117-5df433403c70"
license = "Elastic License v2"
name = "Shellcode behavior from suspicious RWX provenance"
os_list = ["windows"]
version = "1.0.3"

query = '''
api where
 process.Ext.api.behaviors == "allocate_shellcode" and process.Ext.api.behaviors == "unbacked_rwx" and
 process.Ext.api.metadata.target_address_name == "Unbacked" and
 process.thread.Ext.call_stack_final_user_module.protection_provenance != null and
 process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
 process.thread.Ext.call_stack_final_user_module.code_signature != null and
 process.thread.Ext.call_stack_summary in
                           ("ntdll.dll|Unbacked",
                            "ntdll.dll|kernelbase.dll|Unbacked",
                            "ntdll.dll|kernelbase.dll|kernel32.dll|Unbacked",
                            "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|Unbacked",
                            "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|Unbacked",
                            "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|Unbacked|kernel32.dll|ntdll.dll") and
 endswith~(process.thread.Ext.call_stack_final_user_module.protection_provenance_path, process.thread.Ext.call_stack_final_user_module.protection_provenance) and
 _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
 _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "Unbacked*" and not $entry.protection_provenance : "Unbacked*" and $entry.callsite_trailing_bytes : "?*") and
 not endswith~(process.thread.Ext.call_stack_final_user_module.protection_provenance, process.name) and
 not process.thread.Ext.call_stack_final_user_module.protection_provenance_path like
                                                    ("?:\\windows\\microsoft.net\\framework*\\clr.dll",
                                                     "?:\\windows\\microsoft.net\\framework*\\mscorwks.dll",
                                                     "?:\\program files (x86)\\*",
                                                     "?:\\program files\\*",
                                                     "?:\\windows\\winsxs\\x*\\msvcr*.dll",
                                                     "c:\\windows\\syswow64\\msv?_?.dll") and
 not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
                  $entry.subject_name in ("Microsoft Windows Hardware Compatibility Publisher", "Microsoft Windows Software Compatibility Publisher", "Microsoft Windows", "Microsoft Corporation",
                                          "Asesoria Informatica Gallega SL", "Riot Games, Inc.", ".NET", "Beijing Huorong Network Technology Co., Ltd.", "DameWare Development, LLC.", "Code Systems Corporation",
                                          "ACEVILLE PTE LTD", "Roblox Corporation")) and
 not (process.Ext.api.name == "VirtualProtect" and
      _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("c:\\windows\\sys?????\\ntdll.dll!LdrLoadDll*", "c:\\windows\\sys?????\\kernelbase.dll!LoadLibrary*"))) and
 not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.callsite_trailing_bytes like
                ("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                 "00000000000000f6375c5b2e8900000000000000ff0000ffeeffee0000000000001000000000000020000000000000000100000000000000100000000000003f",
                 "8985271*085c00f859400000056e84003000056e85502000056e85301000090909090909090908b4e3485c90f848900000003")) and
 not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
                        ("eff52743773eb550fcc6ce3efc37c85724502233b6b002a35496d828bd7b280a",
                         "fc450380eaa226b351c919e87df61dd869f02b6ab47beedf8f940618a65761b0",
                         "b982741576a050860c3f3608c7b269dbd35ab296429192b8afa53f1f190069c0",
                         "68fba9dd89bfad35f8fd657b9af22a8aebda31bffda35058a7f5ae376136e89b",
                         "f60dd9f2fcbd495674dfc1555effb710eb081fc7d4cae5fa58c438ab50405081")
'''

min_endpoint_version = "8.14.2"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[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.14.2"

Stages and Predicates

Stage 1: api

api where
 process.Ext.api.behaviors == "allocate_shellcode" and process.Ext.api.behaviors == "unbacked_rwx" and
 process.Ext.api.metadata.target_address_name == "Unbacked" and
 process.thread.Ext.call_stack_final_user_module.protection_provenance != null and
 process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
 process.thread.Ext.call_stack_final_user_module.code_signature != null and
 process.thread.Ext.call_stack_summary in
                           ("ntdll.dll|Unbacked",
                            "ntdll.dll|kernelbase.dll|Unbacked",
                            "ntdll.dll|kernelbase.dll|kernel32.dll|Unbacked",
                            "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|Unbacked",
                            "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|Unbacked",
                            "ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|Unbacked|kernel32.dll|ntdll.dll") and
 endswith~(process.thread.Ext.call_stack_final_user_module.protection_provenance_path, process.thread.Ext.call_stack_final_user_module.protection_provenance) and
 _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true) and
 _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info : "Unbacked*" and not $entry.protection_provenance : "Unbacked*" and $entry.callsite_trailing_bytes : "?*") and
 not endswith~(process.thread.Ext.call_stack_final_user_module.protection_provenance, process.name) and
 not process.thread.Ext.call_stack_final_user_module.protection_provenance_path like
                                                    ("?:\\windows\\microsoft.net\\framework*\\clr.dll",
                                                     "?:\\windows\\microsoft.net\\framework*\\mscorwks.dll",
                                                     "?:\\program files (x86)\\*",
                                                     "?:\\program files\\*",
                                                     "?:\\windows\\winsxs\\x*\\msvcr*.dll",
                                                     "c:\\windows\\syswow64\\msv?_?.dll") and
 not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == true and
                  $entry.subject_name in ("Microsoft Windows Hardware Compatibility Publisher", "Microsoft Windows Software Compatibility Publisher", "Microsoft Windows", "Microsoft Corporation",
                                          "Asesoria Informatica Gallega SL", "Riot Games, Inc.", ".NET", "Beijing Huorong Network Technology Co., Ltd.", "DameWare Development, LLC.", "Code Systems Corporation",
                                          "ACEVILLE PTE LTD", "Roblox Corporation")) and
 not (process.Ext.api.name == "VirtualProtect" and
      _arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info like ("c:\\windows\\sys?????\\ntdll.dll!LdrLoadDll*", "c:\\windows\\sys?????\\kernelbase.dll!LoadLibrary*"))) and
 not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.callsite_trailing_bytes like
                ("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                 "00000000000000f6375c5b2e8900000000000000ff0000ffeeffee0000000000001000000000000020000000000000000100000000000000100000000000003f",
                 "8985271*085c00f859400000056e84003000056e85502000056e85301000090909090909090908b4e3485c90f848900000003")) and
 not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
                        ("eff52743773eb550fcc6ce3efc37c85724502233b6b002a35496d828bd7b280a",
                         "fc450380eaa226b351c919e87df61dd869f02b6ab47beedf8f940618a65761b0",
                         "b982741576a050860c3f3608c7b269dbd35ab296429192b8afa53f1f190069c0",
                         "68fba9dd89bfad35f8fd657b9af22a8aebda31bffda35058a7f5ae376136e89b",
                         "f60dd9f2fcbd495674dfc1555effb710eb081fc7d4cae5fa58c438ab50405081")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.behaviorseq
  • allocate_shellcode corpus 8 (elastic 8)
  • unbacked_rwx
field:"process.Ext.api.behaviors" kind:eq
process.Ext.api.metadata.target_address_nameeq
  • Unbacked corpus 8 (elastic 8)
field:"process.Ext.api.metadata.target_address_name" kind:eq value:"Unbacked"
process.thread.Ext.call_stack_final_user_module.code_signatureis_not_null
  • (no value, null check)
field:"process.thread.Ext.call_stack_final_user_module.code_signature" kind:is_not_null
process.thread.Ext.call_stack_final_user_module.hash.sha256is_not_null
  • (no value, null check)
field:"process.thread.Ext.call_stack_final_user_module.hash.sha256" kind:is_not_null
process.thread.Ext.call_stack_final_user_module.protection_provenanceis_not_null
  • (no value, null check)
field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" kind:is_not_null
process.thread.Ext.call_stack_final_user_module.protection_provenance_pathends_with
  • process.thread.Ext.call_stack_final_user_module.protection_provenance (field reference)
field:"process.thread.Ext.call_stack_final_user_module.protection_provenance_path" kind:ends_with value:"process.thread.Ext.call_stack_final_user_module.protection_provenance"
process.thread.Ext.call_stack_summaryin
  • ntdll.dll|Unbacked corpus 8 (elastic 8)
  • ntdll.dll|kernelbase.dll|Unbacked corpus 11 (elastic 11)
  • ntdll.dll|kernelbase.dll|kernel32.dll|Unbacked corpus 5 (elastic 5)
  • ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|Unbacked corpus 5 (elastic 5)
  • ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|Unbacked corpus 6 (elastic 6)
  • ntdll.dll|wow64.dll|wow64cpu.dll|wow64.dll|ntdll.dll|kernelbase.dll|Unbacked|kernel32.dll|ntdll.dll corpus 5 (elastic 5)
field:"process.thread.Ext.call_stack_summary" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack
process.Ext.api.nameeqVirtualProtectexcludes:process.Ext.api.name field:"process.Ext.api.name" value:"VirtualProtect"
process.thread.Ext.call_stack_final_user_module.code_signaturearray_any(no value, null check)excludes:process.thread.Ext.call_stack_final_user_module.code_signature
process.thread.Ext.call_stack_final_user_module.hash.sha256in68fba9dd89bfad35f8fd657b9af22a8aebda31bffda35058a7f5ae376136e89b, b982741576a050860c3f3608c7b269dbd35ab296429192b8afa53f1f190069c0, eff52743773eb550fcc6ce3efc37c85724502233b6b002a35496d828bd7b280a, f60dd9f2fcbd495674dfc1555effb710eb081fc7d4cae5fa58c438ab50405081, fc450380eaa226b351c919e87df61dd869f02b6ab47beedf8f940618a65761b0excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256
process.thread.Ext.call_stack_final_user_module.protection_provenanceends_withprocess.nameexcludes:process.thread.Ext.call_stack_final_user_module.protection_provenance field:"process.thread.Ext.call_stack_final_user_module.protection_provenance" value:"process.name"
process.thread.Ext.call_stack_final_user_module.protection_provenance_pathwildcard?:\windows\microsoft.net\framework*\clr.dll, ?:\windows\microsoft.net\framework*\mscorwks.dll, ?:\program files (x86)\*, ?:\program files\*, ?:\windows\winsxs\x*\msvcr*.dll, c:\windows\syswow64\msv?_?.dllexcludes:process.thread.Ext.call_stack_final_user_module.protection_provenance_path

Suspicious Perl File Modification

#
Source
github.com/elastic/protections-artifacts

Detects when Perl modifies script files in temporary directories or creates hidden files with scripting extensions. This behavior is commonly observed in npm typosquatting attacks where malicious packages leverage Perl to stage additional payloads or create hidden persistence mechanisms. Adversaries abuse Perl's trusted status to write malicious scripts that can be executed later for credential harvesting, data exfiltration, or maintaining access.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Detects when Perl modifies script files in temporary directories or creates hidden files with scripting extensions. This
behavior is commonly observed in npm typosquatting attacks where malicious packages leverage Perl to stage additional
payloads or create hidden persistence mechanisms. Adversaries abuse Perl's trusted status to write malicious scripts
that can be executed later for credential harvesting, data exfiltration, or maintaining access.
"""
id = "7f7a0f09-a2f3-4449-a83d-5b5279c6f704"
license = "Elastic License v2"
name = "Suspicious Perl File Modification"
os_list = ["macos"]
reference = ["https://socket.dev/blog/10-npm-typosquatted-packages-deploy-credential-harvester"]
version = "1.0.1"

query = '''
file where process.name == "perl" and file.extension in ("pl", "applescript", "scpt", "py", "sh") and 
 (file.path like ("/private/tmp/*", "/tmp/*", "/var/tmp/*", "/private/var/tmp/*") or file.name : ".*")
'''

min_endpoint_version = "8.16.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 0

[[actions]]
action = "kill_process"
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.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[threat.technique.subtechnique]]
id = "T1564.001"
name = "Hidden Files and Directories"
reference = "https://attack.mitre.org/techniques/T1564/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Stage 1: file

file where process.name == "perl" and file.extension in ("pl", "applescript", "scpt", "py", "sh") and 
 (file.path like ("/private/tmp/*", "/tmp/*", "/var/tmp/*", "/private/var/tmp/*") or file.name : ".*")

Indicators

These rows show field, operator, and value matches.

Suspicious PHP Script Execution

#
Time window
5m
Source
github.com/elastic/protections-artifacts

Identifies the execution a PHP script utility that was recently dropped followed by an egress network activity or spawning a suspicious child process.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies the execution a PHP script utility that was recently dropped followed by an egress network activity or
spawning a suspicious child process.
"""
id = "fb54419b-1284-4e85-abfd-aac59db82c8b"
license = "Elastic License v2"
name = "Suspicious PHP Script Execution"
os_list = ["windows"]
version = "1.0.4"

query = '''
sequence with maxspan=5m
 [any where
  (
   (event.category == "process" and event.type == "start" and process.pe.original_file_name == "php.exe" and
    (process.Ext.relative_file_creation_time <= 300 or process.Ext.relative_file_name_modify_time <= 300) and
    process.executable : "C:\\*") or

   (event.category == "library" and event.action == "load" and dll.pe.original_file_name : ("php?.dll", "php.dll") and
    (dll.Ext.relative_file_creation_time <= 300 or dll.Ext.relative_file_name_modify_time <= 300) and
    process.executable : "C:\\*")
   ) and
  process.executable : ("C:\\Users\\*.exe", "C:\\ProgramData\\*.exe", "C:\\Windows\\*")
 ] as event0
[any where
   /* spawn a child process */
   (event.category == "process" and event.action == "start" and process.name : ("cmd.exe", "powershell.exe") and
    process.parent.entity_id == event0.process.entity_id and
    not process.command_line : ("* /V:ON /E:ON /D*", "cmd.exe /c \"echo '%os%'\"",
                                "cmd.exe /s /c \"echo '%os%'\"", "cmd.exe /s /c \"mode CON\"",
                                "cmd.exe /s /c \"stty 2>&1\"", "cmd.exe /c \"stty 2> NUL\"", "cmd.exe /c mode CON")) or
   /* DNS lookup */
   (event.category == "dns" and process.entity_id == event0.process.entity_id and dns.question.name != null) or
   /* perform an egress conn to the internet */
   (event.category == "network" and event.action in ("disconnect_received", "connection_attempted") and
    process.entity_id == event0.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.4.0"
optional_actions = []
[[actions]]
action = "kill_process"
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.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 = "8.4.0"

Stages and Predicates

Stage 1: any

[any where
  (
   (event.category == "process" and event.type == "start" and process.pe.original_file_name == "php.exe" and
    (process.Ext.relative_file_creation_time <= 300 or process.Ext.relative_file_name_modify_time <= 300) and
    process.executable : "C:\\*") or

   (event.category == "library" and event.action == "load" and dll.pe.original_file_name : ("php?.dll", "php.dll") and
    (dll.Ext.relative_file_creation_time <= 300 or dll.Ext.relative_file_name_modify_time <= 300) and
    process.executable : "C:\\*")
   ) and
  process.executable : ("C:\\Users\\*.exe", "C:\\ProgramData\\*.exe", "C:\\Windows\\*")
 ] as event0

Stage 2: any

[any where
   (event.category == "process" and event.action == "start" and process.name : ("cmd.exe", "powershell.exe") and
    process.parent.entity_id == event0.process.entity_id and
    not process.command_line : ("* /V:ON /E:ON /D*", "cmd.exe /c \"echo '%os%'\"",
                                "cmd.exe /s /c \"echo '%os%'\"", "cmd.exe /s /c \"mode CON\"",
                                "cmd.exe /s /c \"stty 2>&1\"", "cmd.exe /c \"stty 2> NUL\"", "cmd.exe /c mode CON")) or
   (event.category == "dns" and process.entity_id == event0.process.entity_id and dns.question.name != null) or
   (event.category == "network" and event.action in ("disconnect_received", "connection_attempted") and
    process.entity_id == event0.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.

FieldKindValuesSearch
dll.Ext.relative_file_creation_timele
  • 300 transforms: number corpus 7 (elastic 7)
field:"dll.Ext.relative_file_creation_time" kind:le value:"300"
dll.Ext.relative_file_name_modify_timele
  • 300 transforms: number corpus 2 (elastic 2)
field:"dll.Ext.relative_file_name_modify_time" kind:le value:"300"
dll.pe.original_file_namewildcard
  • php.dll
  • php?.dll
field:"dll.pe.original_file_name" kind:wildcard
dns.question.nameis_not_null
  • (no value, null check)
field:"QueryName" kind:is_not_null
event.actioneq
  • load corpus 23 (elastic 23)
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq
event.actionin
  • connection_attempted corpus 24 (elastic 24)
  • disconnect_received corpus 11 (elastic 11)
field:"EventType" kind:in
event.categoryeq
  • dns corpus 2 (elastic 2)
  • library corpus 11 (elastic 11)
  • network corpus 9 (elastic 9)
  • process corpus 38 (elastic 38)
field:"event.category" kind:eq
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.Ext.relative_file_creation_timele
  • 300 transforms: number corpus 11 (elastic 11)
field:"process.Ext.relative_file_creation_time" kind:le value:"300"
process.Ext.relative_file_name_modify_timele
  • 300 transforms: number corpus 9 (elastic 9)
field:"process.Ext.relative_file_name_modify_time" kind:le value:"300"
process.entity_ideq
  • event0.process.entity_id (field reference)
field:"process_guid" kind:eq value:"event0.process.entity_id"
process.executablewildcard
  • C:\* corpus 16 (elastic 16)
  • C:\ProgramData\*.exe corpus 3 (elastic 3)
  • C:\Users\*.exe corpus 3 (elastic 3)
  • C:\Windows\*
field:"Image" kind:wildcard
process.namewildcard
  • cmd.exe corpus 122 (elastic 93, splunk 29)
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
field:"process_basename" kind:wildcard
process.parent.entity_ideq
  • event0.process.entity_id (field reference)
field:"parent_process_guid" kind:eq value:"event0.process.entity_id"
process.pe.original_file_nameeq
  • php.exe
field:"OriginalFileName" kind:eq value:"php.exe"

Suspicious xdg-open Command Execution

#
Source
github.com/elastic/protections-artifacts

This rule monitors for the execution of the xdg-open process via a common parent process. xdg-open is a command-line utility that opens documents and URLs in the user's preferred desktop application. Attackers may use this command to open malicious documents or URLs to gain access to the target system.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule monitors for the execution of the xdg-open process via a common parent process. xdg-open is a command-line
utility that opens documents and URLs in the user's preferred desktop application. Attackers may use this command to
open malicious documents or URLs to gain access to the target system.
"""
id = "8a8833d1-1003-4269-978a-c9535dc63d0d"
license = "Elastic License v2"
name = "Suspicious xdg-open Command Execution"
os_list = ["linux"]
version = "1.0.5"

query = '''
process where event.type == "start" and event.action == "exec" and (
  process.name == "xdg-open" or
  process.args in ("/bin/xdg-open", "/usr/bin/xdg-open", "/usr/local/bin/xdg-open", "xdg-open")
) and
process.command_line regex ".*[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(:[0-9]{1,5})?/.+" and
not (
  process.executable in ("/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod") or
  process.args like (
    "http://10.*", "https://10.*", "http://192.168.*", "https://192.168.*", "http://172.16.*",
    "https://172.16.*", "http://172.17.*", "https://172.17.*", "http://172.31.*", "https://172.31.*"
  ) or
  process.command_line like ("*127.0.0.1*", "*0.0.0.0*") or
  process.parent.executable in ("/usr/bin/make", "/opt/forticlient/gui/FortiClient-linux-x64/FortiClient") or
  (process.parent.executable == "/usr/share/code/code" and process.args like "http://*:8080/swagger/index.html")
)
'''

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 = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[[threat.technique.subtechnique]]
id = "T1204.001"
name = "Malicious Link"
reference = "https://attack.mitre.org/techniques/T1204/001/"

[[threat.technique.subtechnique]]
id = "T1204.002"
name = "Malicious File"
reference = "https://attack.mitre.org/techniques/T1204/002/"

[[threat.technique.subtechnique]]
id = "T1204.004"
name = "Malicious Copy and Paste"
reference = "https://attack.mitre.org/techniques/T1204/004/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and (
  process.name == "xdg-open" or
  process.args in ("/bin/xdg-open", "/usr/bin/xdg-open", "/usr/local/bin/xdg-open", "xdg-open")
) and
process.command_line regex ".*[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}(:[0-9]{1,5})?/.+" and
not (
  process.executable in ("/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod") or
  process.args like (
    "http://10.*", "https://10.*", "http://192.168.*", "https://192.168.*", "http://172.16.*",
    "https://172.16.*", "http://172.17.*", "https://172.17.*", "http://172.31.*", "https://172.31.*"
  ) or
  process.command_line like ("*127.0.0.1*", "*0.0.0.0*") or
  process.parent.executable in ("/usr/bin/make", "/opt/forticlient/gui/FortiClient-linux-x64/FortiClient") or
  (process.parent.executable == "/usr/share/code/code" and process.args like "http://*:8080/swagger/index.html")
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argswildcardhttp://*:8080/swagger/index.htmlexcludes:process.args field:"process.args" value:"http://*:8080/swagger/index.html"
process.parent.executableeq/usr/share/code/codeexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/share/code/code"
process.argsstarts_withhttp://10., https://10., http://192.168., https://192.168., http://172.16., https://172.16., http://172.17., https://172.17., http://172.31., https://172.31.excludes:process.args
process.command_linematch127.0.0.1, 0.0.0.0excludes:process.command_line field:"process.command_line" value:"127.0.0.1" field:"process.command_line" value:"0.0.0.0"
process.executablein/bin/chmod, /usr/bin/chmod, /usr/local/bin/chmodexcludes:process.executable field:"process.executable" value:"/bin/chmod" field:"process.executable" value:"/usr/bin/chmod" field:"process.executable" value:"/usr/local/bin/chmod"
process.parent.executablein/opt/forticlient/gui/FortiClient-linux-x64/FortiClient, /usr/bin/makeexcludes:process.parent.executable field:"process.parent.executable" value:"/opt/forticlient/gui/FortiClient-linux-x64/FortiClient" field:"process.parent.executable" value:"/usr/bin/make"

Back to all Elastic rules