Detection rules › Elastic

Elastic rules: 0v

API Call from a Process with a Spoofed Parent

#
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Detects Windows Memory API calls by a process with a fake parent process identity set to Windows Explorer often to blend in with user interactive activity.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Detects Windows Memory API calls by a process with a fake parent process identity set to Windows Explorer often to blend
in with user interactive activity.
"""
id = "e62f022c-88e2-403f-9f83-f76a91dd2203"
license = "Elastic License v2"
name = "API Call from a Process with a Spoofed Parent"
os_list = ["windows"]
version = "1.0.10"

query = '''
sequence by process.entity_id
 [process where event.action == "start" and process.parent.name : "explorer.exe" and process.parent.Ext.real.pid > 0 and 
  process.parent.thread.Ext.call_stack_summary : "?*" and process.executable != null and
  not _arraysearch(process.parent.thread.Ext.call_stack, $entry,
                   $entry.symbol_info : ("*advapi32.dll!CreateProcessAsUser*", "*advapi32.dll+0x*",
                    "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\appctrl\\bin\\Privilager.exe*")) and
  not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and
       process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and 
  not process.parent.thread.Ext.call_stack_summary : 
                                      ("*|rpcrt4.dll|*", 
                                       "*faultrep.dll|wersvc.dll*", 
                                       "*windows.storage.dll|shell32.dll*", 
                                       "*systemsettingsviewmodel.desktop.dll*")]
 [api where process.Ext.api.name : ("WriteProcessMemory", "VirtualProtect*", "VirtualAlloc*", "MapViewOfFile*") and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
  not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Kernel|*") and
  not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined", "sophosed.dll", "hmpalert.dll") and
  not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
                                         ("d1e1d111eff2d7d3e60e5ed47d1919a43fe5a44e45f75d4a33f7a6cbc39a4aac",
                                          "3afe14049a0baabf0519d5502d465abc6050d5a0f4a4fdb3bca22ab419c33f2a",
                                          "cfcaf06eaa34d603ff3a89dd0ddfe4b17c0ee7ad8fa4534634d24e1692a5e352",
                                          "eb278baed0f9c422e9abb6bd947d7934086ea73080575ecb2ef4a7306ca5b037",
                                          "d807a7b13f948f60bc9c299f2b6976bf3988532adc02df5ed4f44538f13f4275",
                                          "8c5350999da9836037c67fd08bfb4e261d6e288a79c6b4fc3c8e3bd3d1f4171e",
                                          "108bddeccbd09a4621d7702e53442c236a2623cb03b653ed89a1fa26007388ca",
                                          "2319da9f696d1589aa7f7a0d9b8d9e87d103f13a86817b275789d3787f2cbf77",
                                          "b4e1daaee72eb9ea621918eaa4293a50bcf9c4d71fb545325b7dcd8b0e858f34",
                                          "38011e713b4be8577576062754cad03e9899859488932ae4c9c83e5fbb5cb7d2",
                                          "4328398412fdc6eadf57c4e659a45a34716cbccea0f4c025ef7fcd6e27d8ca48")]
 until [process where event.action:"end"]
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"

[[threat.technique]]
id = "T1055"
name = "Process Injection"
reference = "https://attack.mitre.org/techniques/T1055/"

[[threat.technique]]
id = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"
[[threat.technique.subtechnique]]
id = "T1134.004"
name = "Parent PID Spoofing"
reference = "https://attack.mitre.org/techniques/T1134/004/"



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

[internal]
min_endpoint_version = "8.14.2"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and process.parent.name : "explorer.exe" and process.parent.Ext.real.pid > 0 and 
  process.parent.thread.Ext.call_stack_summary : "?*" and process.executable != null and
  not _arraysearch(process.parent.thread.Ext.call_stack, $entry,
                   $entry.symbol_info : ("*advapi32.dll!CreateProcessAsUser*", "*advapi32.dll+0x*",
                    "C:\\Program Files (x86)\\ManageEngine\\UEMS_Agent\\appctrl\\bin\\Privilager.exe*")) and
  not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe") and
       process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and 
  not process.parent.thread.Ext.call_stack_summary : 
                                      ("*|rpcrt4.dll|*", 
                                       "*faultrep.dll|wersvc.dll*", 
                                       "*windows.storage.dll|shell32.dll*", 
                                       "*systemsettingsviewmodel.desktop.dll*")]

Stage 2: api

[api where process.Ext.api.name : ("WriteProcessMemory", "VirtualProtect*", "VirtualAlloc*", "MapViewOfFile*") and
  _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry, $entry.trusted == false or $entry.exists == false) and
  not process.thread.Ext.call_stack_final_user_module.protection_provenance like ("Kernel", "Kernel|*") and
  not process.thread.Ext.call_stack_final_user_module.name in ("Kernel", "Unknown", "Undetermined", "sophosed.dll", "hmpalert.dll") and
  not process.thread.Ext.call_stack_final_user_module.hash.sha256 in
                                         ("d1e1d111eff2d7d3e60e5ed47d1919a43fe5a44e45f75d4a33f7a6cbc39a4aac",
                                          "3afe14049a0baabf0519d5502d465abc6050d5a0f4a4fdb3bca22ab419c33f2a",
                                          "cfcaf06eaa34d603ff3a89dd0ddfe4b17c0ee7ad8fa4534634d24e1692a5e352",
                                          "eb278baed0f9c422e9abb6bd947d7934086ea73080575ecb2ef4a7306ca5b037",
                                          "d807a7b13f948f60bc9c299f2b6976bf3988532adc02df5ed4f44538f13f4275",
                                          "8c5350999da9836037c67fd08bfb4e261d6e288a79c6b4fc3c8e3bd3d1f4171e",
                                          "108bddeccbd09a4621d7702e53442c236a2623cb03b653ed89a1fa26007388ca",
                                          "2319da9f696d1589aa7f7a0d9b8d9e87d103f13a86817b275789d3787f2cbf77",
                                          "b4e1daaee72eb9ea621918eaa4293a50bcf9c4d71fb545325b7dcd8b0e858f34",
                                          "38011e713b4be8577576062754cad03e9899859488932ae4c9c83e5fbb5cb7d2",
                                          "4328398412fdc6eadf57c4e659a45a34716cbccea0f4c025ef7fcd6e27d8ca48")]

Until: process

until [process where event.action:"end"]

Ends the sequence: the steps above must complete before an event matching this clause occurs.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
event.actionwildcard
  • end corpus 7 (elastic 7)
field:"EventType" kind:wildcard value:"end"
process.Ext.api.namewildcard
  • MapViewOfFile* corpus 3 (elastic 3)
  • VirtualAlloc* corpus 2 (elastic 2)
  • VirtualProtect* corpus 2 (elastic 2)
  • WriteProcessMemory corpus 2 (elastic 2)
field:"process.Ext.api.name" kind:wildcard
process.code_signature.subject_namewildcard
  • Microsoft* corpus 19 (elastic 19)
field:"Signature" kind:wildcard value:"Microsoft*"
process.executableis_not_null
  • (no value, null check)
field:"Image" kind:is_not_null
process.parent.Ext.real.pidgt
  • 0 transforms: number corpus 11 (elastic 11)
field:"process.parent.Ext.real.pid" kind:gt value:"0"
process.parent.namewildcard
  • explorer.exe corpus 50 (elastic 50)
field:"parent_process_basename" kind:wildcard value:"explorer.exe"
process.parent.thread.Ext.call_stack_summarywildcard
  • ?* corpus 2 (elastic 2)
field:"process.parent.thread.Ext.call_stack_summary" kind:wildcard value:"?*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_namestarts_withMicrosoftexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft"
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.parent.thread.Ext.call_stackarray_any(no value, null check)excludes:process.parent.thread.Ext.call_stack
process.parent.thread.Ext.call_stack_summarymatch|rpcrt4.dll|, faultrep.dll|wersvc.dll, windows.storage.dll|shell32.dll, systemsettingsviewmodel.desktop.dllexcludes:process.parent.thread.Ext.call_stack_summary
process.thread.Ext.call_stack_final_user_module.hash.sha256in108bddeccbd09a4621d7702e53442c236a2623cb03b653ed89a1fa26007388ca, 2319da9f696d1589aa7f7a0d9b8d9e87d103f13a86817b275789d3787f2cbf77, 38011e713b4be8577576062754cad03e9899859488932ae4c9c83e5fbb5cb7d2, 3afe14049a0baabf0519d5502d465abc6050d5a0f4a4fdb3bca22ab419c33f2a, 4328398412fdc6eadf57c4e659a45a34716cbccea0f4c025ef7fcd6e27d8ca48, 8c5350999da9836037c67fd08bfb4e261d6e288a79c6b4fc3c8e3bd3d1f4171e, b4e1daaee72eb9ea621918eaa4293a50bcf9c4d71fb545325b7dcd8b0e858f34, cfcaf06eaa34d603ff3a89dd0ddfe4b17c0ee7ad8fa4534634d24e1692a5e352, d1e1d111eff2d7d3e60e5ed47d1919a43fe5a44e45f75d4a33f7a6cbc39a4aac, d807a7b13f948f60bc9c299f2b6976bf3988532adc02df5ed4f44538f13f4275, eb278baed0f9c422e9abb6bd947d7934086ea73080575ecb2ef4a7306ca5b037excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256
process.thread.Ext.call_stack_final_user_module.nameinKernel, Undetermined, Unknown, hmpalert.dll, sophosed.dllexcludes:process.thread.Ext.call_stack_final_user_module.name
process.thread.Ext.call_stack_final_user_module.protection_provenancewildcardKernel, Kernel|*excludes:process.thread.Ext.call_stack_final_user_module.protection_provenance 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:"Kernel|*"

Attempt to Deactivate an Okta Policy

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

Detects attempts to deactivate an Okta policy. An adversary may attempt to deactivate an Okta policy in order to weaken an organization's security controls. For example, an adversary may attempt to deactivate an Okta multi-factor authentication (MFA) policy in order to weaken the authentication requirements for user accounts.

Known False Positives

  • If the behavior of deactivating Okta policies is expected, consider adding exceptions to this rule to filter false positives.

MITRE ATT&CK Coverage

Telemetry Coverage

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2020/05/21"
integration = ["okta"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Detects attempts to deactivate an Okta policy. An adversary may attempt to deactivate an Okta policy in order to weaken
an organization's security controls. For example, an adversary may attempt to deactivate an Okta multi-factor
authentication (MFA) policy in order to weaken the authentication requirements for user accounts.
"""
false_positives = [
    """
    If the behavior of deactivating Okta policies is expected, consider adding exceptions to this rule to filter false
    positives.
    """,
]
index = ["filebeat-*", "logs-okta*"]
language = "kuery"
license = "Elastic License v2"
name = "Attempt to Deactivate an Okta Policy"
note = """## Triage and analysis

### Investigating Attempt to Deactivate an Okta Policy

Okta policies define rules to manage user access to resources. Policies such as multi-factor authentication (MFA) are critical for enforcing strong security measures. Deactivation of an Okta policy could potentially weaken the security posture, allowing for unauthorized access or facilitating other malicious activities.

This rule is designed to detect attempts to deactivate an Okta policy, which could be indicative of an adversary's attempt to weaken an organization's security controls. For example, disabling an MFA policy could lower the security of user authentication processes.

#### Possible investigation steps:

- Identify the actor related to the alert by reviewing `okta.actor.id`, `okta.actor.type`, `okta.actor.alternate_id`, or `okta.actor.display_name` fields in the alert.
- Review the `okta.client.user_agent.raw_user_agent` field to understand the device and software used by the actor.
- Examine the `okta.outcome.reason` field for additional context around the deactivation attempt.
- Check the `okta.outcome.result` field to confirm the policy deactivation attempt.
- Check if there are multiple policy deactivation attempts from the same actor or IP address (`okta.client.ip`).
- Check for successful logins immediately following the policy deactivation attempt.
- Verify whether the actor's activity aligns with typical behavior or if any unusual activity took place around the time of the deactivation attempt.

### False positive analysis:

- Check if there were issues with the Okta system at the time of the deactivation attempt. This could indicate a system error rather than a genuine threat activity.
- Check the geographical location (`okta.request.ip_chain.geographical_context`) and time of the deactivation attempt. If these match the actor's normal behavior, it might be a false positive.
- Verify the actor's administrative rights to ensure they are correctly configured.

### Response and remediation:

- If unauthorized policy deactivation is confirmed, initiate the incident response process.
- Immediately lock the affected actor account and require a password change.
- Consider resetting MFA tokens for the actor and require re-enrollment.
- Check if the compromised account was used to access or alter any sensitive data or systems.
- If a specific deactivation technique was used, ensure your systems are patched or configured to prevent such techniques.
- Assess the criticality of affected services and servers.
- Work with your IT team to minimize the impact on users and maintain business continuity.
- If multiple accounts are affected, consider a broader reset or audit of MFA tokens.
- Implement security best practices [outlined](https://www.okta.com/blog/2019/10/9-admin-best-practices-to-keep-your-org-secure/) by Okta.
- 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

The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = [
    "https://help.okta.com/en/prod/Content/Topics/Security/Security_Policies.htm",
    "https://developer.okta.com/docs/reference/api/system-log/",
    "https://developer.okta.com/docs/reference/api/event-types/",
    "https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy",
    "https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
    "https://www.elastic.co/security-labs/starter-guide-to-understanding-okta",
]
risk_score = 21
rule_id = "b719a170-3bdb-4141-b0e3-13e3cf627bfe"
severity = "low"
tags = [
    "Use Case: Identity and Access Audit",
    "Data Source: Okta",
    "Tactic: Defense Evasion",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:okta.system and event.action:policy.lifecycle.deactivate
'''


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

[[rule.threat.technique]]
id = "T1556"
name = "Modify Authentication Process"
reference = "https://attack.mitre.org/techniques/T1556/"

[[rule.threat.technique.subtechnique]]
id = "T1556.006"
name = "Multi-Factor Authentication"
reference = "https://attack.mitre.org/techniques/T1556/006/"

[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"

[[rule.threat.technique.subtechnique]]
id = "T1562.007"
name = "Disable or Modify Cloud Firewall"
reference = "https://attack.mitre.org/techniques/T1562/007/"

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

Stages and Predicates

Stage 1: query

data_stream.dataset:okta.system and event.action:policy.lifecycle.deactivate

Indicators

These rows show field, operator, and value matches.

Connection to Dynamic DNS Provider by a Signed Binary Proxy

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

Identifies DNS queries to known Dynamic DNS Providers by a signed Microsoft binary execution proxy. Dynamic DNS providers are often misused to host malware Command and Control servers.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Identifies DNS queries to known Dynamic DNS Providers by a signed Microsoft binary execution proxy. Dynamic DNS
providers are often misused to host malware Command and Control servers.
"""
id = "fb6939a2-1b54-428c-92a2-3a831585af2a"
license = "Elastic License v2"
name = "Connection to Dynamic DNS Provider by a Signed Binary Proxy"
os_list = ["windows"]
version = "1.0.35"

query = '''
sequence by process.entity_id with maxspan=5m
  [process where event.action == "start" and user.id like ("S-1-5-21*", "S-1-12-*") and
    (
     process.name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe", "vbc.exe",
                     "powershell.exe", "pwsh.exe", "msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe",
                     "installutil.exe","RegSvcs.exe", "msxsl.exe", "xwizard.exe", "csc.exe", "msiexec.exe",
                     "scp.exe", "ssh.exe") or
     process.executable : ("?:\\Program Files\\Java\\jre*\\bin\\javaw.exe",
                           "?:\\Program Files (x86)\\Java\\jre*\\bin\\javaw.exe") or

     (process.executable : "?:\\Windows\\Microsoft.NET\\*.exe" and not (process.name:"dfsvc.exe" and process.parent.name : "rundll32.exe"))
     )
  ]
  [dns where
    dns.question.name :
         (
          "*.no-ip.com",
          "*.no-ip.org",
          "*.no-ip.biz",
          "*.no-ip.info",
          "*.noip.com",
          "*.afraid.org",
          "*.changeip.com",
          "*.ddns.net",
          "*.dyndns.org",
          "*.hopto.org",
          "*.zapto.org",
          "*.servehttp.com",
          "*.sytes.net",
          "*.myftp.biz",
          "*.myftp.org",
          "*.ddnsfree.com",
          "*.duckdns.org",
          "*.000webhostapp.com",
          "*.myddns.me",
          "*.dlinkddns.com",
          "*.chickenkiller.com",
          "*.thddns.net",
          "*.linkpc.net",
          "*.gotdns.ch",
          "*.dynv6.net",
          "*.dns.army",
          "*.dns.navy",
          "*.v6.army",
          "*.v6.navy",
          "*.v6.rocks",
          "*.dyndns-office.com",
          "*.myvnc.com",
          "*.is-certified.com"
         ) and

     /* covered by rule Id 51894221-7657-4b56-9406-e080e19ad159 */
    not dns.question.name : "checkip.dyndns.org" and
    not dns.question.name : ("www.duckdns.org")
  ]
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"


[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[[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/"

[internal]
min_endpoint_version = "7.15.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 user.id like ("S-1-5-21*", "S-1-12-*") and
    (
     process.name : ("wscript.exe", "cscript.exe", "regsvr32.exe", "mshta.exe", "rundll32.exe", "vbc.exe",
                     "powershell.exe", "pwsh.exe", "msbuild.exe", "wmic.exe", "cmstp.exe", "RegAsm.exe",
                     "installutil.exe","RegSvcs.exe", "msxsl.exe", "xwizard.exe", "csc.exe", "msiexec.exe",
                     "scp.exe", "ssh.exe") or
     process.executable : ("?:\\Program Files\\Java\\jre*\\bin\\javaw.exe",
                           "?:\\Program Files (x86)\\Java\\jre*\\bin\\javaw.exe") or

     (process.executable : "?:\\Windows\\Microsoft.NET\\*.exe" and not (process.name:"dfsvc.exe" and process.parent.name : "rundll32.exe"))
     )
  ]

Stage 2: dns

[dns where
    dns.question.name :
         (
          "*.no-ip.com",
          "*.no-ip.org",
          "*.no-ip.biz",
          "*.no-ip.info",
          "*.noip.com",
          "*.afraid.org",
          "*.changeip.com",
          "*.ddns.net",
          "*.dyndns.org",
          "*.hopto.org",
          "*.zapto.org",
          "*.servehttp.com",
          "*.sytes.net",
          "*.myftp.biz",
          "*.myftp.org",
          "*.ddnsfree.com",
          "*.duckdns.org",
          "*.000webhostapp.com",
          "*.myddns.me",
          "*.dlinkddns.com",
          "*.chickenkiller.com",
          "*.thddns.net",
          "*.linkpc.net",
          "*.gotdns.ch",
          "*.dynv6.net",
          "*.dns.army",
          "*.dns.navy",
          "*.v6.army",
          "*.v6.navy",
          "*.v6.rocks",
          "*.dyndns-office.com",
          "*.myvnc.com",
          "*.is-certified.com"
         ) and
    not dns.question.name : "checkip.dyndns.org" and
    not dns.question.name : ("www.duckdns.org")
  ]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dns.question.namewildcard
  • *.000webhostapp.com corpus 3 (elastic 3)
  • *.afraid.org corpus 3 (elastic 3)
  • *.changeip.com corpus 3 (elastic 3)
  • *.chickenkiller.com corpus 3 (elastic 3)
  • *.ddns.net corpus 3 (elastic 3)
  • *.ddnsfree.com corpus 3 (elastic 3)
  • *.dlinkddns.com corpus 3 (elastic 3)
  • *.dns.army corpus 3 (elastic 3)
  • *.dns.navy corpus 3 (elastic 3)
  • *.duckdns.org corpus 3 (elastic 3)
  • *.dyndns-office.com corpus 3 (elastic 3)
  • *.dyndns.org corpus 3 (elastic 3)
  • *.dynv6.net corpus 3 (elastic 3)
  • *.gotdns.ch corpus 3 (elastic 3)
  • *.hopto.org corpus 3 (elastic 3)
  • *.is-certified.com corpus 3 (elastic 3)
  • *.linkpc.net corpus 3 (elastic 3)
  • *.myddns.me corpus 3 (elastic 3)
  • *.myftp.biz corpus 3 (elastic 3)
  • *.myftp.org corpus 3 (elastic 3)
  • *.myvnc.com corpus 3 (elastic 3)
  • *.no-ip.biz corpus 3 (elastic 3)
  • *.no-ip.com corpus 3 (elastic 3)
  • *.no-ip.info corpus 3 (elastic 3)
  • *.no-ip.org corpus 3 (elastic 3)
  • *.noip.com corpus 3 (elastic 3)
  • *.servehttp.com corpus 3 (elastic 3)
  • *.sytes.net corpus 3 (elastic 3)
  • *.thddns.net corpus 3 (elastic 3)
  • *.v6.army corpus 3 (elastic 3)
  • *.v6.navy corpus 3 (elastic 3)
  • *.v6.rocks corpus 3 (elastic 3)
  • *.zapto.org corpus 3 (elastic 3)
field:"QueryName" kind:wildcard
event.actioneq
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq value:"start"
process.executablewildcard
  • ?:\Program Files (x86)\Java\jre*\bin\javaw.exe corpus 3 (elastic 3)
  • ?:\Program Files\Java\jre*\bin\javaw.exe corpus 3 (elastic 3)
  • ?:\Windows\Microsoft.NET\*.exe corpus 8 (elastic 8)
field:"Image" kind:wildcard
process.namewildcard
  • RegAsm.exe corpus 25 (elastic 24, splunk 1)
  • RegSvcs.exe corpus 22 (elastic 21, splunk 1)
  • cmstp.exe corpus 25 (elastic 25)
  • csc.exe corpus 12 (elastic 11, splunk 1)
  • cscript.exe corpus 68 (elastic 66, splunk 2)
  • installutil.exe corpus 36 (elastic 32, splunk 4)
  • msbuild.exe corpus 39 (elastic 36, splunk 3)
  • mshta.exe corpus 84 (elastic 80, splunk 4)
  • msiexec.exe corpus 45 (elastic 40, splunk 5)
  • msxsl.exe corpus 22 (elastic 22)
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
  • pwsh.exe corpus 78 (elastic 49, splunk 29)
  • regsvr32.exe corpus 74 (elastic 69, splunk 5)
  • rundll32.exe corpus 123 (elastic 100, splunk 23)
  • scp.exe corpus 5 (elastic 5)
  • ssh.exe corpus 8 (elastic 8)
  • vbc.exe corpus 8 (elastic 8)
  • wmic.exe corpus 66 (elastic 39, splunk 27)
  • wscript.exe corpus 84 (elastic 82, splunk 1, kusto 1)
  • xwizard.exe corpus 16 (elastic 16)
field:"process_basename" kind:wildcard
user.idwildcard
  • S-1-12-* corpus 21 (elastic 21)
  • S-1-5-21* corpus 21 (elastic 21)
field:"user.id" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
dns.question.nameeqcheckip.dyndns.orgexcludes:dns.question.name field:"dns.question.name" value:"checkip.dyndns.org"
dns.question.nameeqwww.duckdns.orgexcludes:dns.question.name field:"dns.question.name" value:"www.duckdns.org"

Curl SOCKS Proxy Activity from Unusual Parent

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

This rule detects the use of the "curl" command-line tool with SOCKS proxy options, launched from an unusual parent process. Attackers may use "curl" to establish a SOCKS proxy connection to bypass network restrictions and exfiltrate data or communicate with C2 servers.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/11/04"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"

[rule]
author = ["Elastic"]
description = """
This rule detects the use of the "curl" command-line tool with SOCKS proxy options, launched from an unusual parent
process. Attackers may use "curl" to establish a SOCKS proxy connection to bypass network restrictions and exfiltrate
data or communicate with C2 servers.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Curl SOCKS Proxy Activity from Unusual Parent"
risk_score = 47
rule_id = "734239fe-eda8-48c0-bca8-9e3dafd81a88"
setup = """## Setup

This rule requires data coming in from Elastic Defend.

### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).

#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).

Elastic Defend integration does not collect environment variable logging by default.
In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the Elastic Defend integration.
 #### To set up environment variable capture for an Elastic Agent policy:
- Go to “Security → Manage → Policies”.
- Select an “Elastic Agent policy”.
- Click “Show advanced settings”.
- Scroll down or search for “linux.advanced.capture_env_vars”.
- Enter the names of environment variables you want to capture, separated by commas.
- For this rule the linux.advanced.capture_env_vars variable should be set to "HTTP_PROXY,HTTPS_PROXY,ALL_PROXY".
- Click “Save”.
After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.
For more information on capturing environment variables refer to the [helper guide](https://www.elastic.co/guide/en/security/current/environment-variable-capture.html).
"""
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Command and Control",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
process.name == "curl" and (
  process.parent.executable like (
    "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/var/run/*", "/root/*", "/boot/*", "/var/www/*", "/opt/.*",
    "/home/*"
  ) or
  process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") or
  process.parent.name like ".*"
) and (
  process.args like ("--socks5-hostname", "--proxy", "--preproxy", "socks5*") or
  process.args == "-x" or
  process.env_vars like~ ("http_proxy=socks5h://*", "HTTPS_PROXY=socks5h://*", "ALL_PROXY=socks5h://*")
) and not (
  process.parent.args == "/opt/rudder/share/commands/agent-run" or
  process.args == "http://localhost:8080/rudder/api/status"
)
'''
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 Curl SOCKS Proxy Activity from Unusual Parent

Curl is a versatile command-line tool used for transferring data with URLs, often employed for legitimate data retrieval. However, adversaries can exploit its SOCKS proxy capabilities to bypass network restrictions, facilitating covert data exfiltration or communication with command and control servers. The detection rule identifies suspicious curl executions initiated by atypical parent processes, such as those from temporary directories or shell environments, combined with SOCKS proxy arguments, indicating potential misuse.

### Possible investigation steps

- Review the parent process details to understand the context of the curl execution, focusing on unusual directories like /dev/shm, /tmp, or shell environments such as bash or zsh.
- Examine the command-line arguments used with curl, specifically looking for SOCKS proxy options like --socks5-hostname or -x, to determine the intent and destination of the network request.
- Investigate the environment variables set for the process, such as http_proxy or HTTPS_PROXY, to identify any proxy configurations that might indicate an attempt to bypass network restrictions.
- Check the user account associated with the process execution to determine if it aligns with expected behavior or if it might be compromised.
- Analyze network logs to trace the destination IP addresses or domains contacted via the SOCKS proxy to assess if they are known malicious or suspicious entities.
- Correlate this activity with other alerts or logs from the same host to identify any patterns or additional indicators of compromise.

### False positive analysis

- Development environments may frequently use curl with SOCKS proxy options for legitimate testing purposes. To manage this, consider excluding specific development directories or user accounts from the rule.
- Automated scripts or cron jobs running from shell environments might use curl with SOCKS proxies for routine data retrieval. Identify these scripts and exclude their parent processes or specific arguments from triggering the rule.
- System administrators might use curl with SOCKS proxies for network diagnostics or maintenance tasks. Document these activities and create exceptions for known administrative accounts or specific command patterns.
- Web applications hosted in directories like /var/www/html may use curl for backend operations involving SOCKS proxies. Review these applications and whitelist their specific processes or arguments if they are verified as non-threatening.
- Temporary directories such as /tmp or /dev/shm might be used by legitimate software for transient operations involving curl. Monitor these occurrences and exclude known benign software from the rule.

### Response and remediation

- Immediately isolate the affected host from the network to prevent further data exfiltration or communication with command and control servers.
- Terminate any suspicious curl processes identified by the detection rule to halt potential malicious activity.
- Conduct a forensic analysis of the affected system to identify any additional indicators of compromise, such as unauthorized file modifications or additional malicious processes.
- Review and clean up any unauthorized or suspicious files in temporary directories or other unusual locations, such as /dev/shm, /tmp, or /var/tmp, to remove potential threats.
- Reset credentials and review access logs for any accounts that may have been compromised or used in conjunction with the detected activity.
- Implement network monitoring to detect and block any further attempts to use SOCKS proxy connections from unauthorized sources.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if broader organizational impacts exist."""

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

[[rule.threat.technique]]
id = "T1090"
name = "Proxy"
reference = "https://attack.mitre.org/techniques/T1090/"

[[rule.threat.technique.subtechnique]]
id = "T1090.002"
name = "External Proxy"
reference = "https://attack.mitre.org/techniques/T1090/002/"

[[rule.threat.technique]]
id = "T1572"
name = "Protocol Tunneling"
reference = "https://attack.mitre.org/techniques/T1572/"

[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 == "linux" and event.type == "start" and event.action == "exec" and
process.name == "curl" and (
  process.parent.executable like (
    "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/var/run/*", "/root/*", "/boot/*", "/var/www/*", "/opt/.*",
    "/home/*"
  ) or
  process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") or
  process.parent.name like ".*"
) and (
  process.args like ("--socks5-hostname", "--proxy", "--preproxy", "socks5*") or
  process.args == "-x" or
  process.env_vars like~ ("http_proxy=socks5h://*", "HTTPS_PROXY=socks5h://*", "ALL_PROXY=socks5h://*")
) and not (
  process.parent.args == "/opt/rudder/share/commands/agent-run" or
  process.args == "http://localhost:8080/rudder/api/status"
)

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseqhttp://localhost:8080/rudder/api/statusexcludes:process.args field:"process.args" value:"http://localhost:8080/rudder/api/status"
process.parent.argseq/opt/rudder/share/commands/agent-runexcludes:process.parent.args field:"process.parent.args" value:"/opt/rudder/share/commands/agent-run"

Entra ID OAuth User Impersonation to Microsoft Graph

#
Status
production
Severity
medium
Time window
31m
Group by
Esql.azure_signinlogs_properties_app_id_coalesce, Esql.azure_signinlogs_properties_session_id_coalesce, Esql.azure_signinlogs_properties_user_id_coalesce
Author
Elastic
Source
github.com/elastic/detection-rules

Identifies potential session hijacking or token replay in Microsoft Entra ID. This rule detects cases where a user signs in and subsequently accesses Microsoft Graph from a different IP address using the same session ID. This may indicate a successful OAuth phishing attack, session hijacking, or token replay attack, where an adversary has stolen a session cookie or refresh/access token and is impersonating the user from an alternate host or location.

Known False Positives

  • This pattern may occur during legitimate device switching or roaming between networks (e.g., corporate to mobile). Developers or power users leveraging multiple environments may also trigger this detection if session persistence spans IP ranges. Still, this behavior is rare and warrants investigation when rapid IP switching and Graph access are involved.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2025/05/08"
integration = ["azure"]
maturity = "production"
updated_date = "2026/05/21"

[rule]
author = ["Elastic"]
description = """
Identifies potential session hijacking or token replay in Microsoft Entra ID. This rule detects cases where a user signs
in and subsequently accesses Microsoft Graph from a different IP address using the same session ID. This may indicate a
successful OAuth phishing attack, session hijacking, or token replay attack, where an adversary has stolen a session
cookie or refresh/access token and is impersonating the user from an alternate host or location.
"""
false_positives = [
    """
    This pattern may occur during legitimate device switching or roaming between networks (e.g., corporate to mobile).
    Developers or power users leveraging multiple environments may also trigger this detection if session persistence
    spans IP ranges. Still, this behavior is rare and warrants investigation when rapid IP switching and Graph access
    are involved.
    """,
]
from = "now-31m"
interval = "30m"
language = "esql"
license = "Elastic License v2"
name = "Entra ID OAuth User Impersonation to Microsoft Graph"
note = """## Triage and analysis

### Investigating Entra ID OAuth User Impersonation to Microsoft Graph

Identifies potential phishing, session hijacking or token replay in Microsoft Entra ID. This rule detects cases where a user signs in and subsequently accesses Microsoft Graph from a different IP address using the same session ID and client application. This may indicate a successful OAuth phishing attack, session hijacking, or token replay attack, where an adversary has stolen a session cookie or refresh/access token and is impersonating the user from an alternate host or location.

This rule uses ESQL aggregations and thus has dynamically generated fields. Correlation of the values in the alert document may need to be
performed to the original sign-in and Graph events for further context.

### Possible investigation steps

- This rule relies on an aggregation-based ESQL query, therefore the alert document will contain dynamically generated fields.
    - To pivot into the original events, it is recommended to use the values captured to filter in timeline or discovery for the original sign-in and Graph events.
- Review the session ID and user ID to identify the user account involved in the suspicious activity.
- Check the source addresses involved in the sign-in and Graph access to determine if they are known or expected locations for the user.
    - The sign-in source addresses should be two, one for the initial phishing sign-in and the other when exchanging the auth code for a token by the adversary.
    - The Graph API source address should identify the IP address used by the adversary to access Microsoft Graph.
- Review the user agent strings for the sign-in and Graph access events to identify any anomalies or indicators of compromise.
- Analyze the Graph permission scopes to identify what resources were accessed and whether they align with the user's expected behavior.
- Check the timestamp difference between the sign-in and Graph access events to determine if they occurred within a reasonable time frame that would suggest successful phishing to token issuance and then Graph access.
- Identify the original sign-in event to investigation if conditional access policies were applied, such as requiring multi-factor authentication or blocking access from risky locations. In phishing scenarios, these policies likely were applied as the victim user would have been prompted to authenticate.

### False positive analysis
- This pattern may occur during legitimate device switching or roaming between networks (e.g., corporate to mobile).
- Developers or power users leveraging multiple environments may also trigger this detection if session persistence spans IP ranges. Still, this behavior is rare and warrants investigation when rapid IP switching and Graph access are involved.

### Response and remediation

- If confirmed malicious, revoke all refresh/access tokens for the user principal.
- Block the source IP(s) involved in the Graph access.
- Notify the user and reset credentials.
- Review session control policies and conditional access enforcement.
- Monitor for follow-on activity, such as lateral movement or privilege escalation.
- Review conditional access policies to ensure they are enforced correctly.
"""
references = [
    "https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
    "https://github.com/dirkjanm/ROADtools",
    "https://attack.mitre.org/techniques/T1078/004/",
    "https://pushsecurity.com/blog/consentfix",
]
risk_score = 47
rule_id = "0d3d2254-2b4a-11f0-a019-f661ea17fbcc"
setup = """#### Required Microsoft Entra ID Sign-In and Graph Activity Logs
This rule requires the Microsoft Entra ID Sign-In Logs and Microsoft Graph Activity Logs integration to be enabled and configured to collect audit and activity logs via Azure Event Hub.
"""
severity = "medium"
tags = [
    "Domain: Cloud",
    "Domain: Identity",
    "Domain: API",
    "Data Source: Azure",
    "Data Source: Microsoft Entra ID",
    "Data Source: Microsoft Entra ID Sign-In Logs",
    "Data Source: Microsoft Graph",
    "Data Source: Microsoft Graph Activity Logs",
    "Use Case: Identity and Access Audit",
    "Use Case: Threat Detection",
    "Resources: Investigation Guide",
    "Tactic: Defense Evasion",
    "Tactic: Initial Access",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-azure.signinlogs-*, logs-azure.graphactivitylogs-* metadata _id, _version, _index
| where
    (data_stream.dataset == "azure.signinlogs"
     and source.`as`.organization.name != "MICROSOFT-CORP-MSN-AS-BLOCK"
     and azure.signinlogs.properties.session_id is not null)
    or
    (data_stream.dataset == "azure.graphactivitylogs"
     and source.`as`.organization.name != "MICROSOFT-CORP-MSN-AS-BLOCK"
     and azure.graphactivitylogs.properties.c_sid is not null)

| eval
    Esql.azure_signinlogs_properties_session_id_coalesce = coalesce(azure.signinlogs.properties.session_id, azure.graphactivitylogs.properties.c_sid),
    Esql.azure_signinlogs_properties_user_id_coalesce = coalesce(azure.signinlogs.properties.user_id, azure.graphactivitylogs.properties.user_principal_object_id),
    Esql.azure_signinlogs_properties_app_id_coalesce = coalesce(azure.signinlogs.properties.app_id, azure.graphactivitylogs.properties.app_id),
    Esql.source_ip = source.ip,
    Esql.@timestamp = @timestamp,
    Esql.event_type_case = case(
        data_stream.dataset == "azure.signinlogs", "signin",
        data_stream.dataset == "azure.graphactivitylogs", "graph",
        "other"
    ),
    Esql.signin_source_asn = case(data_stream.dataset == "azure.signinlogs", source.`as`.organization.name),
    Esql.graph_source_asn = case(data_stream.dataset == "azure.graphactivitylogs", source.`as`.organization.name)

| where Esql.azure_signinlogs_properties_app_id_coalesce not in (
    "4354e225-50c9-4423-9ece-2d5afd904870",  // Augmentation Loop
    "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe",  // Microsoft Teams Services
    "ecd6b820-32c2-49b6-98a6-444530e5a77a",  // Microsoft Edge [Community Contributed]
    "e8be65d6-d430-4289-a665-51bf2a194bda",  // Microsoft 365 App Catalog Services
    "ab9b8c07-8f02-4f72-87fa-80105867a763",  // OneDrive SyncEngine
    "394866fc-eedb-4f01-8536-3ff84b16be2a",  // Microsoft People Cards Service
    "66a88757-258c-4c72-893c-3e8bed4d6899",  // Office 365 Search Service
    "9ea1ad79-fdb6-4f9a-8bc3-2b70f96e34c7",  // Bing
    "d7b530a4-7680-4c23-a8bf-c52c121d2e87",  // Microsoft Edge Enterprise New Tab Page [Community Contributed]
    "6f7e0f60-9401-4f5b-98e2-cf15bd5fd5e3",  // Microsoft Application Command Service [Community Contributed]
    "52c2e0b5-c7b6-4d11-a89c-21e42bcec444",  // Graph Files Manager
    "27922004-5251-4030-b22d-91ecd9a37ea4",  // Outlook Mobile
    "bb893c22-978d-4cd4-a6f7-bb6cc0d6e6ce",  // Olympus [Community Contributed]
    "26a7ee05-5602-4d76-a7ba-eae8b7b67941",  // Windows Search
    "00000007-0000-0000-c000-000000000000",  // Dataverse
    "6bc3b958-689b-49f5-9006-36d165f30e00",  // Teams CMD Services Artifacts
    "0ec893e0-5785-4de6-99da-4ed124e5296c",  // Office UWP PWA [Community Contributed]
    "fc108d3f-543d-4374-bbff-c7c51f651fe5",  // Zoom
    "01fc33a7-78ba-4d2f-a4b7-768e336e890e",  // MS PIM
    "7ab7862c-4c57-491e-8a45-d52a7e023983"   // Power Automate / Logic Apps Graph Connector
    ) and Esql.signin_source_asn IS NOT NULL and Esql.graph_source_asn IS NOT NULL

| keep
    Esql.azure_signinlogs_properties_session_id_coalesce,
    Esql.source_ip,
    Esql.@timestamp,
    Esql.event_type_case,
    Esql.azure_signinlogs_properties_user_id_coalesce,
    Esql.azure_signinlogs_properties_app_id_coalesce,
    Esql.signin_source_asn,
    Esql.graph_source_asn,
    source.`as`.organization.name,
    user_agent.original,
    url.original,
    azure.graphactivitylogs.properties.scopes,
    azure.signinlogs.properties.user_principal_name

| stats
    Esql.azure_signinlogs_properties_user_id_coalesce_values = values(Esql.azure_signinlogs_properties_user_id_coalesce),
    Esql.azure_signinlogs_properties_session_id_coalesce_values = values(Esql.azure_signinlogs_properties_session_id_coalesce),
    Esql_priv.azure_signinlogs_properties_user_principal_name_values = values(azure.signinlogs.properties.user_principal_name),
    Esql.source_ip_values = values(Esql.source_ip),
    Esql.source_ip_count_distinct = count_distinct(Esql.source_ip),
    Esql.source_as_organization_name_values = values(source.`as`.organization.name),
    Esql.source_as_organization_name_count_distinct = count_distinct(source.`as`.organization.name),
    Esql.signin_source_asn_values = values(Esql.signin_source_asn),
    Esql.signin_source_asn_count_distinct = count_distinct(Esql.signin_source_asn),
    Esql.graph_source_asn_values = values(Esql.graph_source_asn),
    Esql.graph_source_asn_count_distinct = count_distinct(Esql.graph_source_asn),
    Esql.user_agent_original_values = values(user_agent.original),
    Esql.azure_signinlogs_properties_app_id_coalesce_values = values(Esql.azure_signinlogs_properties_app_id_coalesce),
    Esql.azure_signinlogs_properties_app_id_coalesce_count_distinct = count_distinct(Esql.azure_signinlogs_properties_app_id_coalesce),
    Esql.event_type_case_values = values(Esql.event_type_case),
    Esql.event_type_case_count_distinct = count_distinct(Esql.event_type_case),
    Esql.signin_time_min = min(case(Esql.event_type_case == "signin", Esql.@timestamp)),
    Esql.graph_time_min = min(case(Esql.event_type_case == "graph", Esql.@timestamp)),
    Esql.url_original_values = values(url.original),
    Esql.azure_graphactivitylogs_properties_scopes_values = values(azure.graphactivitylogs.properties.scopes),
    Esql.event_count = count()
  by
    Esql.azure_signinlogs_properties_session_id_coalesce,
    Esql.azure_signinlogs_properties_app_id_coalesce,
    Esql.azure_signinlogs_properties_user_id_coalesce

| eval
    Esql.event_signin_to_graph_delay_minutes_date_diff = date_diff("minutes", Esql.signin_time_min, Esql.graph_time_min),
    Esql.event_signin_to_graph_delay_days_date_diff = date_diff("days", Esql.signin_time_min, Esql.graph_time_min)

| where
    Esql.event_type_case_count_distinct > 1 and
    Esql.source_ip_count_distinct > 1 and
    Esql.source_as_organization_name_count_distinct > 1 and
    Esql.azure_signinlogs_properties_app_id_coalesce_count_distinct == 1 and
    Esql.signin_time_min is not null and
    Esql.graph_time_min is not null and
    Esql.event_signin_to_graph_delay_minutes_date_diff > 0 and
    Esql.event_signin_to_graph_delay_days_date_diff == 0 and
    (Esql.signin_source_asn_count_distinct + Esql.graph_source_asn_count_distinct) == Esql.source_as_organization_name_count_distinct
'''


[[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.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"

[[rule.threat.technique.subtechnique]]
id = "T1550.004"
name = "Web Session Cookie"
reference = "https://attack.mitre.org/techniques/T1550/004/"

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

Stages and Predicates

Stage 1: from

from logs-azure.signinlogs-*, logs-azure.graphactivitylogs-* metadata _id, _version, _index

Stage 2: where

| where
    (data_stream.dataset == "azure.signinlogs"
     and source.`as`.organization.name != "MICROSOFT-CORP-MSN-AS-BLOCK"
     and azure.signinlogs.properties.session_id is not null)
    or
    (data_stream.dataset == "azure.graphactivitylogs"
     and source.`as`.organization.name != "MICROSOFT-CORP-MSN-AS-BLOCK"
     and azure.graphactivitylogs.properties.c_sid is not null)

Stage 3: eval

| eval
    Esql.azure_signinlogs_properties_session_id_coalesce = coalesce(azure.signinlogs.properties.session_id, azure.graphactivitylogs.properties.c_sid),
    Esql.azure_signinlogs_properties_user_id_coalesce = coalesce(azure.signinlogs.properties.user_id, azure.graphactivitylogs.properties.user_principal_object_id),
    Esql.azure_signinlogs_properties_app_id_coalesce = coalesce(azure.signinlogs.properties.app_id, azure.graphactivitylogs.properties.app_id),
    Esql.source_ip = source.ip,
    Esql.@timestamp = @timestamp,
    Esql.event_type_case = case(
        data_stream.dataset == "azure.signinlogs", "signin",
        data_stream.dataset == "azure.graphactivitylogs", "graph",
        "other"
    ),
    Esql.signin_source_asn = case(data_stream.dataset == "azure.signinlogs", source.`as`.organization.name),
    Esql.graph_source_asn = case(data_stream.dataset == "azure.graphactivitylogs", source.`as`.organization.name)
Esql.event_type_case =
ifdata_stream.dataset == "azure.signinlogs""signin"
elifdata_stream.dataset == "azure.graphactivitylogs""graph"
else"other"
Esql.graph_source_asn =
elsesource.`as`.organization.name
Esql.signin_source_asn =
elsesource.`as`.organization.name

Stage 4: where

| where Esql.azure_signinlogs_properties_app_id_coalesce not in (
    "4354e225-50c9-4423-9ece-2d5afd904870",
    "cc15fd57-2c6c-4117-a88c-83b1d56b4bbe",
    "ecd6b820-32c2-49b6-98a6-444530e5a77a",
    "e8be65d6-d430-4289-a665-51bf2a194bda",
    "ab9b8c07-8f02-4f72-87fa-80105867a763",
    "394866fc-eedb-4f01-8536-3ff84b16be2a",
    "66a88757-258c-4c72-893c-3e8bed4d6899",
    "9ea1ad79-fdb6-4f9a-8bc3-2b70f96e34c7",
    "d7b530a4-7680-4c23-a8bf-c52c121d2e87",
    "6f7e0f60-9401-4f5b-98e2-cf15bd5fd5e3",
    "52c2e0b5-c7b6-4d11-a89c-21e42bcec444",
    "27922004-5251-4030-b22d-91ecd9a37ea4",
    "bb893c22-978d-4cd4-a6f7-bb6cc0d6e6ce",
    "26a7ee05-5602-4d76-a7ba-eae8b7b67941",
    "00000007-0000-0000-c000-000000000000",
    "6bc3b958-689b-49f5-9006-36d165f30e00",
    "0ec893e0-5785-4de6-99da-4ed124e5296c",
    "fc108d3f-543d-4374-bbff-c7c51f651fe5",
    "01fc33a7-78ba-4d2f-a4b7-768e336e890e",
    "7ab7862c-4c57-491e-8a45-d52a7e023983"
    ) and Esql.signin_source_asn IS NOT NULL and Esql.graph_source_asn IS NOT NULL

Stage 5: keep

| keep
    Esql.azure_signinlogs_properties_session_id_coalesce,
    Esql.source_ip,
    Esql.@timestamp,
    Esql.event_type_case,
    Esql.azure_signinlogs_properties_user_id_coalesce,
    Esql.azure_signinlogs_properties_app_id_coalesce,
    Esql.signin_source_asn,
    Esql.graph_source_asn,
    source.`as`.organization.name,
    user_agent.original,
    url.original,
    azure.graphactivitylogs.properties.scopes,
    azure.signinlogs.properties.user_principal_name

Stage 6: stats

| stats
    Esql.azure_signinlogs_properties_user_id_coalesce_values = values(Esql.azure_signinlogs_properties_user_id_coalesce),
    Esql.azure_signinlogs_properties_session_id_coalesce_values = values(Esql.azure_signinlogs_properties_session_id_coalesce),
    Esql_priv.azure_signinlogs_properties_user_principal_name_values = values(azure.signinlogs.properties.user_principal_name),
    Esql.source_ip_values = values(Esql.source_ip),
    Esql.source_ip_count_distinct = count_distinct(Esql.source_ip),
    Esql.source_as_organization_name_values = values(source.`as`.organization.name),
    Esql.source_as_organization_name_count_distinct = count_distinct(source.`as`.organization.name),
    Esql.signin_source_asn_values = values(Esql.signin_source_asn),
    Esql.signin_source_asn_count_distinct = count_distinct(Esql.signin_source_asn),
    Esql.graph_source_asn_values = values(Esql.graph_source_asn),
    Esql.graph_source_asn_count_distinct = count_distinct(Esql.graph_source_asn),
    Esql.user_agent_original_values = values(user_agent.original),
    Esql.azure_signinlogs_properties_app_id_coalesce_values = values(Esql.azure_signinlogs_properties_app_id_coalesce),
    Esql.azure_signinlogs_properties_app_id_coalesce_count_distinct = count_distinct(Esql.azure_signinlogs_properties_app_id_coalesce),
    Esql.event_type_case_values = values(Esql.event_type_case),
    Esql.event_type_case_count_distinct = count_distinct(Esql.event_type_case),
    Esql.signin_time_min = min(case(Esql.event_type_case == "signin", Esql.@timestamp)),
    Esql.graph_time_min = min(case(Esql.event_type_case == "graph", Esql.@timestamp)),
    Esql.url_original_values = values(url.original),
    Esql.azure_graphactivitylogs_properties_scopes_values = values(azure.graphactivitylogs.properties.scopes),
    Esql.event_count = count()
  by
    Esql.azure_signinlogs_properties_session_id_coalesce,
    Esql.azure_signinlogs_properties_app_id_coalesce,
    Esql.azure_signinlogs_properties_user_id_coalesce

Stage 7: eval

| eval
    Esql.event_signin_to_graph_delay_minutes_date_diff = date_diff("minutes", Esql.signin_time_min, Esql.graph_time_min),
    Esql.event_signin_to_graph_delay_days_date_diff = date_diff("days", Esql.signin_time_min, Esql.graph_time_min)

Stage 8: where

| where
    Esql.event_type_case_count_distinct > 1 and
    Esql.source_ip_count_distinct > 1 and
    Esql.source_as_organization_name_count_distinct > 1 and
    Esql.azure_signinlogs_properties_app_id_coalesce_count_distinct == 1 and
    Esql.signin_time_min is not null and
    Esql.graph_time_min is not null and
    Esql.event_signin_to_graph_delay_minutes_date_diff > 0 and
    Esql.event_signin_to_graph_delay_days_date_diff == 0 and
    (Esql.signin_source_asn_count_distinct + Esql.graph_source_asn_count_distinct) == Esql.source_as_organization_name_count_distinct

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Esql.azure_signinlogs_properties_app_id_coalesce_count_distincteq
  • 1
field:"Esql.azure_signinlogs_properties_app_id_coalesce_count_distinct" kind:eq value:"1"
Esql.event_signin_to_graph_delay_days_date_diffeq
  • 0
field:"Esql.event_signin_to_graph_delay_days_date_diff" kind:eq value:"0"
Esql.event_signin_to_graph_delay_minutes_date_diffgt
  • 0
field:"Esql.event_signin_to_graph_delay_minutes_date_diff" kind:gt value:"0"
Esql.event_type_case_count_distinctgt
  • 1
field:"Esql.event_type_case_count_distinct" kind:gt value:"1"
Esql.graph_source_asnis_not_null
  • (no value, null check)
field:"Esql.graph_source_asn" kind:is_not_null
Esql.graph_time_minis_not_null
  • (no value, null check)
field:"Esql.graph_time_min" kind:is_not_null
Esql.signin_source_asnis_not_null
  • (no value, null check)
field:"Esql.signin_source_asn" kind:is_not_null
Esql.signin_time_minis_not_null
  • (no value, null check)
field:"Esql.signin_time_min" kind:is_not_null
Esql.source_as_organization_name_count_distinctgt
  • 1
field:"Esql.source_as_organization_name_count_distinct" kind:gt value:"1"
Esql.source_ip_count_distinctgt
  • 1
field:"Esql.source_ip_count_distinct" kind:gt value:"1"
azure.graphactivitylogs.properties.c_sidis_not_null
  • (no value, null check)
field:"azure.graphactivitylogs.properties.c_sid" kind:is_not_null
azure.signinlogs.properties.session_idis_not_null
  • (no value, null check)
field:"azure.signinlogs.properties.session_id" kind:is_not_null
data_stream.dataseteq
  • azure.graphactivitylogs
  • azure.signinlogs corpus 12 (elastic 12)
field:"data_stream.dataset" kind:eq
source.as.organization.namene
  • MICROSOFT-CORP-MSN-AS-BLOCK
field:"source.as.organization.name" kind:ne value:"MICROSOFT-CORP-MSN-AS-BLOCK"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
Esql.azure_signinlogs_properties_app_id_coalescein00000007-0000-0000-c000-000000000000, 01fc33a7-78ba-4d2f-a4b7-768e336e890e, 0ec893e0-5785-4de6-99da-4ed124e5296c, 26a7ee05-5602-4d76-a7ba-eae8b7b67941, 27922004-5251-4030-b22d-91ecd9a37ea4, 394866fc-eedb-4f01-8536-3ff84b16be2a, 4354e225-50c9-4423-9ece-2d5afd904870, 52c2e0b5-c7b6-4d11-a89c-21e42bcec444, 66a88757-258c-4c72-893c-3e8bed4d6899, 6bc3b958-689b-49f5-9006-36d165f30e00, 6f7e0f60-9401-4f5b-98e2-cf15bd5fd5e3, 7ab7862c-4c57-491e-8a45-d52a7e023983, 9ea1ad79-fdb6-4f9a-8bc3-2b70f96e34c7, ab9b8c07-8f02-4f72-87fa-80105867a763, bb893c22-978d-4cd4-a6f7-bb6cc0d6e6ce, cc15fd57-2c6c-4117-a88c-83b1d56b4bbe, d7b530a4-7680-4c23-a8bf-c52c121d2e87, e8be65d6-d430-4289-a665-51bf2a194bda, ecd6b820-32c2-49b6-98a6-444530e5a77a, fc108d3f-543d-4374-bbff-c7c51f651fe5excludes:Esql.azure_signinlogs_properties_app_id_coalesce

Output Fields

These fields are emitted when the rule matches.

FieldSource
Esql.azure_signinlogs_properties_user_id_coalesce_valuesSTATS Esql.azure_signinlogs_properties_user_id_coalesce_values = values(Esql.azure_signinlogs_properties_user_id_coalesce)
Esql.azure_signinlogs_properties_session_id_coalesce_valuesSTATS Esql.azure_signinlogs_properties_session_id_coalesce_values = values(Esql.azure_signinlogs_properties_session_id_coalesce)
Esql_priv.azure_signinlogs_properties_user_principal_name_valuesSTATS Esql_priv.azure_signinlogs_properties_user_principal_name_values = values(azure.signinlogs.properties.user_principal_name)
Esql.source_ip_valuesSTATS Esql.source_ip_values = values(Esql.source_ip)
Esql.source_ip_count_distinctSTATS Esql.source_ip_count_distinct = count_distinct(Esql.source_ip)
Esql.source_as_organization_name_valuesSTATS Esql.source_as_organization_name_values = values(source.`as`.organization.name)
Esql.source_as_organization_name_count_distinctSTATS Esql.source_as_organization_name_count_distinct = count_distinct(source.`as`.organization.name)
Esql.signin_source_asn_valuesSTATS Esql.signin_source_asn_values = values(Esql.signin_source_asn)
Esql.signin_source_asn_count_distinctSTATS Esql.signin_source_asn_count_distinct = count_distinct(Esql.signin_source_asn)
Esql.graph_source_asn_valuesSTATS Esql.graph_source_asn_values = values(Esql.graph_source_asn)
Esql.graph_source_asn_count_distinctSTATS Esql.graph_source_asn_count_distinct = count_distinct(Esql.graph_source_asn)
Esql.user_agent_original_valuesSTATS Esql.user_agent_original_values = values(user_agent.original)
Esql.azure_signinlogs_properties_app_id_coalesce_valuesSTATS Esql.azure_signinlogs_properties_app_id_coalesce_values = values(Esql.azure_signinlogs_properties_app_id_coalesce)
Esql.azure_signinlogs_properties_app_id_coalesce_count_distinctSTATS Esql.azure_signinlogs_properties_app_id_coalesce_count_distinct = count_distinct(Esql.azure_signinlogs_properties_app_id_coalesce)
Esql.event_type_case_valuesSTATS Esql.event_type_case_values = values(Esql.event_type_case)
Esql.event_type_case_count_distinctSTATS Esql.event_type_case_count_distinct = count_distinct(Esql.event_type_case)
Esql.signin_time_minSTATS Esql.signin_time_min = min(case(Esql.event_type_case == "signin", Esql.@timestamp))
Esql.graph_time_minSTATS Esql.graph_time_min = min(case(Esql.event_type_case == "graph", Esql.@timestamp))
Esql.url_original_valuesSTATS Esql.url_original_values = values(url.original)
Esql.azure_graphactivitylogs_properties_scopes_valuesSTATS Esql.azure_graphactivitylogs_properties_scopes_values = values(azure.graphactivitylogs.properties.scopes)
Esql.event_countSTATS Esql.event_count = count()
Esql.azure_signinlogs_properties_session_id_coalesceSTATS BY
Esql.azure_signinlogs_properties_app_id_coalesceSTATS BY
Esql.azure_signinlogs_properties_user_id_coalesceSTATS BY
Esql.event_signin_to_graph_delay_minutes_date_diffEVAL date_diff("minutes", Esql.signin_time_min, Esql.graph_time_min)
Esql.event_signin_to_graph_delay_days_date_diffEVAL date_diff("days", Esql.signin_time_min, Esql.graph_time_min)

Execution of a Windows Script Downloaded from the Internet

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

Identifies the execution of a Windows script that was downloaded from the internet.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = "Identifies the execution of a Windows script that was downloaded from the internet."
id = "a87d8240-0b80-4255-8680-cee8c68b2d1e"
license = "Elastic License v2"
name = "Execution of a Windows Script Downloaded from the Internet"
os_list = ["windows"]
version = "1.0.5"

query = '''
sequence with maxspan=5m
 [file where event.action == "creation" and
  file.Ext.windows.zone_identifier == 3 and file.origin_url : "http*" and
  file.extension in~ ("js", "jse", "vbs", "vbe", "wsh", "hta") and
  not file.origin_url like ("https://www.manageengine.com/products/*",
                            "https://*.sharepoint.com/*",
                            "https://artifacts.elastic.co/downloads/*",
                            "https://ajax.googleapis.com/ajax*",
                            "https://api.media.atlassian.com/*",
                            "https://gitlab.com/blooket/blooket-cheats/*", 
                            "https://dl.driverpack.io/test/PROD_Start_DriverPack.hta")
  ] as event0
 [process where event.action == "start" and
  (process.name in~ ("wscript.exe", "cscript.exe", "mshta.exe") or
   process.pe.original_file_name in ("cscript.exe", "wscript.exe", "MSHTA.EXE")) and
   (
    /* substring used to remove Zone.Identifier from file.name */
    stringcontains~(process.command_line, substring(event0.file.name, 0, length(event0.file.name) - 16)) or

    stringcontains~(process.command_line, event0.file.name) or

    startswith~(event0.file.path, process.working_directory)
   )]
'''

min_endpoint_version = "8.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
tree = true

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

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

[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"



[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.005"
name = "Mshta"
reference = "https://attack.mitre.org/techniques/T1218/005/"



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

[internal]
min_endpoint_version = "8.15.0"

Stages and Predicates

Stage 1: file

[file where event.action == "creation" and
  file.Ext.windows.zone_identifier == 3 and file.origin_url : "http*" and
  file.extension in~ ("js", "jse", "vbs", "vbe", "wsh", "hta") and
  not file.origin_url like ("https://www.manageengine.com/products/*",
                            "https://*.sharepoint.com/*",
                            "https://artifacts.elastic.co/downloads/*",
                            "https://ajax.googleapis.com/ajax*",
                            "https://api.media.atlassian.com/*",
                            "https://gitlab.com/blooket/blooket-cheats/*", 
                            "https://dl.driverpack.io/test/PROD_Start_DriverPack.hta")
  ] as event0

Stage 2: process

[process where event.action == "start" and
  (process.name in~ ("wscript.exe", "cscript.exe", "mshta.exe") or
   process.pe.original_file_name in ("cscript.exe", "wscript.exe", "MSHTA.EXE")) and
   (
    stringcontains~(process.command_line, substring(event0.file.name, 0, length(event0.file.name) - 16)) or
    stringcontains~(process.command_line, event0.file.name) or
    startswith~(event0.file.path, process.working_directory)
   )]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • creation corpus 50 (elastic 50)
  • start corpus 388 (elastic 388)
field:"EventType" kind:eq
event0.file.pathstarts_with
  • process.working_directory (field reference)
field:"event0.file.path" kind:starts_with value:"process.working_directory"
file.Ext.windows.zone_identifiereq
  • 3 transforms: number corpus 6 (elastic 6)
field:"file.Ext.windows.zone_identifier" kind:eq value:"3"
file.extensionin
  • hta corpus 4 (elastic 4)
  • js corpus 5 (elastic 5)
  • jse corpus 4 (elastic 4)
  • vbe corpus 4 (elastic 4)
  • vbs corpus 4 (elastic 4)
  • wsh corpus 4 (elastic 4)
field:"file.extension" kind:in
file.origin_urlwildcard
  • http*
field:"file.origin_url" kind:wildcard value:"http*"
process.command_linecontains
  • event0.file.name (field reference)
  • substring(event0.file.name, 0, (length(event0.file.name) - 16)) (expression)
field:"CommandLine" kind:contains
process.namein
  • cscript.exe corpus 24 (splunk 16, elastic 8)
  • mshta.exe corpus 27 (splunk 15, elastic 12)
  • wscript.exe corpus 28 (elastic 14, splunk 14)
field:"process_basename" kind:in
process.pe.original_file_namein
  • MSHTA.EXE corpus 8 (elastic 8)
  • cscript.exe corpus 9 (elastic 9)
  • wscript.exe corpus 9 (elastic 9)
field:"OriginalFileName" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.origin_urlwildcardhttps://www.manageengine.com/products/*, https://*.sharepoint.com/*, https://artifacts.elastic.co/downloads/*, https://ajax.googleapis.com/ajax*, https://api.media.atlassian.com/*, https://gitlab.com/blooket/blooket-cheats/*, https://dl.driverpack.io/test/PROD_Start_DriverPack.htaexcludes:file.origin_url

GKE Rapid Secret GET Activity Against Multiple Objects

#
Status
production
Severity
high
Time window
6m
Group by
client.user.email, source.ip, user_agent.original
Author
Elastic
Source
github.com/elastic/detection-rules

Detects an unusual volume of GKE API get requests against multiple distinct Secret objects from the same client fingerprint (user, source IP, and user agent) within the rule lookback window. This can indicate credential access or in-cluster reconnaissance, where a user or token is used to enumerate and retrieve sensitive data such as service account tokens, registry credentials, TLS material, or application configuration. Failed get requests are included and can signal RBAC probing; system service accounts are excluded only when secret reads succeed, since failed secret access by a service account may indicate compromise or misconfiguration worth investigating.

Known False Positives

  • Startup, Helm, or controllers may legitimately touch many secrets in one window; tune by client.user.email, namespace, or IP allowlists when baselined.

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

Telemetry Coverage

PlatformRecord / event type
Kubernetesget-secrets: get secrets

Rules Detecting the Same Action

These rules filter on the same operation.

Rule Body

[metadata]
creation_date = "2026/07/07"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/07/07"

[rule]
author = ["Elastic"]
description = """
Detects an unusual volume of GKE API get requests against multiple distinct Secret objects from the same client
fingerprint (user, source IP, and user agent) within the rule lookback window. This can indicate credential access or
in-cluster reconnaissance, where a user or token is used to enumerate and retrieve sensitive data such as service
account tokens, registry credentials, TLS material, or application configuration. Failed get requests are included and
can signal RBAC probing; system service accounts are excluded only when secret reads succeed, since failed secret access
by a service account may indicate compromise or misconfiguration worth investigating.
"""
false_positives = [
    """
    Startup, Helm, or controllers may legitimately touch many secrets in one window; tune by client.user.email,
    namespace, or IP allowlists when baselined.
    """,
]
from = "now-6m"
language = "esql"
license = "Elastic License v2"
name = "GKE Rapid Secret GET Activity Against Multiple Objects"
note = """## Triage and analysis

### Investigating GKE Rapid Secret GET Activity Against Multiple Objects

This rule surfaces clusters of `get` operations on secrets where the same identity and client path
(`client.user.email`, `source.ip`, `user_agent.original`) touch several different secret resource paths within the
lookback window. Allowed and denied outcomes are included: successful reads may indicate harvesting; repeated
failure responses can still signal reconnaissance or RBAC probing. System service accounts and core controllers are
excluded only for successful secret reads, failed attempts from those identities still alert.

### Investigation steps

- Inspect `Esql.event_outcome_values` for a mix of success vs failure and whether failures cluster on sensitive namespaces.
- Map the identity to RBAC and namespace scope; review `Esql.gcp_audit_resource_name_values` for high-value targets (tokens, registry
  credentials, TLS bundles, application secrets).
- Pivot on the same `source.ip` and user for follow-on API activity (exec, pod create, role changes, broad `list` on secrets).
- Validate against expected automation (CI, GitOps, backup, in-cluster controllers) before treating as malicious.

### False positives

- Controllers and Helm may legitimately read many secrets in one window; tune exclusions after baselining known automation.

## Setup

The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."""
references = [
    "https://attack.mitre.org/techniques/T1552/007/",
]
risk_score = 73
rule_id = "4780a3d6-e6a7-490c-9afb-9c5fbb220b9a"
severity = "high"
tags = [
    "Domain: Cloud",
    "Domain: Kubernetes",
    "Data Source: GCP",
    "Data Source: Google Cloud Platform",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"

query = '''
from logs-gcp.audit-* metadata _id, _index, _version
| where data_stream.dataset == "gcp.audit"
    and service.name == "k8s.io"
    and event.action == "io.k8s.core.v1.secrets.get"
    and source.ip is not null
    and client.user.email is not null
    and not to_string(source.ip) in ("127.0.0.1", "::1")
    and not (
      (client.user.email in ("system:kube-controller-manager", "system:kube-scheduler") or client.user.email like "system:serviceaccount:*")
      and event.outcome == "success"
    )
    and not gcp.audit.resource_name like "*sh.helm.release.*"
| stats
    Esql.gcp_audit_resource_name_count_distinct = count_distinct(gcp.audit.resource_name),
    Esql.gcp_audit_resource_name_values = values(gcp.audit.resource_name),
    Esql.event_outcome_values = values(event.outcome),
    Esql.timestamp_values = values(@timestamp)
  by client.user.email, source.ip, user_agent.original
| where Esql.gcp_audit_resource_name_count_distinct >= 3
| keep client.user.email, source.ip, user_agent.original, Esql.gcp_audit_resource_name_count_distinct, Esql.gcp_audit_resource_name_values, Esql.event_outcome_values, Esql.timestamp_values
'''

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

[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"

[[rule.threat.technique.subtechnique]]
id = "T1552.007"
name = "Container API"
reference = "https://attack.mitre.org/techniques/T1552/007/"

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

Stages and Predicates

Stage 1: from

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

Stage 2: where

| where data_stream.dataset == "gcp.audit"
    and service.name == "k8s.io"
    and event.action == "io.k8s.core.v1.secrets.get"
    and source.ip is not null
    and client.user.email is not null
    and not to_string(source.ip) in ("127.0.0.1", "::1")
    and not (
      (client.user.email in ("system:kube-controller-manager", "system:kube-scheduler") or client.user.email like "system:serviceaccount:*")
      and event.outcome == "success"
    )
    and not gcp.audit.resource_name like "*sh.helm.release.*"

Stage 3: stats

| stats
    Esql.gcp_audit_resource_name_count_distinct = count_distinct(gcp.audit.resource_name),
    Esql.gcp_audit_resource_name_values = values(gcp.audit.resource_name),
    Esql.event_outcome_values = values(event.outcome),
    Esql.timestamp_values = values(@timestamp)
  by client.user.email, source.ip, user_agent.original

Stage 4: where

| where Esql.gcp_audit_resource_name_count_distinct >= 3

Stage 5: keep

| keep client.user.email, source.ip, user_agent.original, Esql.gcp_audit_resource_name_count_distinct, Esql.gcp_audit_resource_name_values, Esql.event_outcome_values, Esql.timestamp_values

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

Output Fields

These fields are emitted when the rule matches.

FieldSource
client.user.emailKEEP client.user.email
source.ipKEEP source.ip
user_agent.originalKEEP user_agent.original
Esql.gcp_audit_resource_name_count_distinctKEEP Esql.gcp_audit_resource_name_count_distinct
Esql.gcp_audit_resource_name_valuesKEEP Esql.gcp_audit_resource_name_values
Esql.event_outcome_valuesKEEP Esql.event_outcome_values
Esql.timestamp_valuesKEEP Esql.timestamp_values

Kubectl Secrets Enumeration Across All Namespaces

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

This rule detects the use of the "kubectl get secrets --all-namespaces" command, which enumerates secret resources across the entire Kubernetes cluster. Attackers may use this command to identify accessible secrets in multiple namespaces, aiding credential discovery, privilege escalation, or lateral movement.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2026/03/26"
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel", "cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/05/11"

[rule]
author = ["Elastic"]
description = """
This rule detects the use of the "kubectl get secrets --all-namespaces" command, which enumerates secret resources
across the entire Kubernetes cluster. Attackers may use this command to identify accessible secrets in multiple
namespaces, aiding credential discovery, privilege escalation, or lateral movement.
"""
from = "now-9m"
index = [
    "auditbeat-*",
    "endgame-*",
    "logs-auditd_manager.auditd-*",
    "logs-crowdstrike.fdr*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-cloud_defend.process*",
]
language = "eql"
license = "Elastic License v2"
name = "Kubectl Secrets Enumeration Across All Namespaces"
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 Kubectl Secrets Enumeration Across All Namespaces

Kubectl allows users to query Kubernetes resources from the command line. Adversaries may use "kubectl get secrets --all-namespaces" or "kubectl get secrets -A" to enumerate secret objects across the cluster and identify valuable targets for credential access or privilege escalation. The detection rule identifies this broad secret discovery activity by monitoring kubectl executions that request secrets from all namespaces.

### Possible investigation steps

- Review the full process command line to confirm whether the command used "get secrets --all-namespaces" or the short form "-A", and determine whether additional output modifiers such as "-o yaml" or "-o json" were used.
- Identify the user account and host that launched the kubectl command and determine whether this activity aligns with approved administrative or automation workflows.
- Correlate the event with Kubernetes audit logs to determine what secret resources were listed and whether subsequent access, read, or modification activity followed.
- Examine related kubectl activity from the same user or host, especially commands involving "auth can-i", "--as", "--token", or kubeconfig changes, which may indicate privilege probing or impersonation.
- Investigate whether the same session later accessed sensitive resources, exported command output, or connected to external destinations that could indicate staging or exfiltration of discovered information.

### False positive analysis

- Cluster administrators or platform engineers may legitimately enumerate secrets across namespaces during troubleshooting, audits, or migration work. Create exceptions for known users, hosts, or automation contexts where appropriate.
- CI/CD or compliance tooling may run kubectl commands with "-A" to inventory cluster resources. Review these tools and exclude their specific execution patterns if they are expected.
- Security assessment or validation activity may intentionally enumerate secrets to verify access controls. Coordinate with security teams to document those activities and reduce unnecessary alerts.
- Development or lab environments may generate this behavior during testing. Consider environment-specific tuning if this activity is expected outside production.

### Response and remediation

- Validate whether the user or service account that executed the command should have cluster-wide visibility into secrets, and revoke or reduce permissions if the access is not justified.
- Review Kubernetes audit logs and API activity to determine whether any listed secrets were subsequently read, exported, or abused.
- Rotate any credentials, tokens, or certificates associated with sensitive secrets that may have been exposed to an unauthorized actor.
- Investigate adjacent activity from the same host or identity, including kubeconfig access, impersonation flags, direct API usage, or suspicious network connections.
- Escalate to incident response if the activity is unauthorized, originated from an unusual workstation, or was followed by secret reads, pod creation, or changes to RBAC bindings.
"""
references = [
    "https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get",
]
risk_score = 73
rule_id = "a87d49f0-24ae-4d6e-a0b4-5fd2f6188d6a"
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 or macOS system:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, 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",
  "Domain: Container",
  "Domain: Kubernetes",
  "OS: Linux",
  "OS: macOS",
  "Use Case: Threat Detection",
  "Tactic: Discovery",
  "Tactic: Credential Access",
  "Data Source: Elastic Defend",
  "Data Source: Elastic Endgame",
  "Data Source: Auditd Manager",
  "Data Source: Crowdstrike",
  "Data Source: SentinelOne",
  "Data Source: Elastic Defend for Containers",
  "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type in ("linux", "macos") and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.name == "kubectl" and process.args in ("get", "describe") and process.args in ("secret", "secrets") and
process.args in ("--all-namespaces", "-A")
'''

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

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

[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"

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

Stages and Predicates

Stage 1: process

process where host.os.type in ("linux", "macos") and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.name == "kubectl" and process.args in ("get", "describe") and process.args in ("secret", "secrets") and
process.args in ("--all-namespaces", "-A")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • ProcessRollup2 corpus 119 (elastic 119)
  • exec corpus 180 (elastic 180)
  • exec_event corpus 135 (elastic 135)
  • executed corpus 85 (elastic 85)
  • process_started corpus 77 (elastic 77)
  • start corpus 157 (elastic 157)
field:"EventType" kind:in
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argsin
  • --all-namespaces
  • -A corpus 6 (elastic 6)
  • describe corpus 3 (elastic 3)
  • get corpus 4 (elastic 4)
  • secret
  • secrets
field:"process.args" kind:in
process.nameeq
  • kubectl corpus 9 (elastic 9)
field:"process_basename" kind:eq value:"kubectl"

Kubernetes Forbidden Creation Request

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

This rule detects attempts to create resources in Kubernetes clusters that are forbidden by the authorization policy. It specifically looks for creation requests that are denied with a "forbid" decision, indicating that the user or service account does not have the necessary permissions to perform the action. This activity is commonly associated with adversaries attempting to create resources in a Kubernetes environment without proper authorization, which can lead to unauthorized access, manipulation of cluster resources, lateral movement and/or privilege escalation.

MITRE ATT&CK Coverage

TacticTechniques
ExecutionNo specific technique

Rule Body

[metadata]
creation_date = "2025/06/24"
integration = ["kubernetes"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
This rule detects attempts to create resources in Kubernetes clusters that are forbidden by the authorization policy. It
specifically looks for creation requests that are denied with a "forbid" decision, indicating that the user or service
account does not have the necessary permissions to perform the action. This activity is commonly associated with
adversaries attempting to create resources in a Kubernetes environment without proper authorization, which can lead to
unauthorized access, manipulation of cluster resources, lateral movement and/or privilege escalation.
"""
index = ["logs-kubernetes.audit_logs-*"]
language = "eql"
license = "Elastic License v2"
name = "Kubernetes Forbidden Creation Request"
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 Kubernetes Forbidden Creation Request

Kubernetes, a container orchestration platform, manages applications across clusters. It uses authorization policies to control resource creation. Adversaries may exploit misconfigurations or attempt unauthorized resource creation to gain access or escalate privileges. The detection rule identifies denied creation requests, signaling potential unauthorized attempts, by analyzing audit logs for forbidden decisions, aiding in threat detection and response.

### Possible investigation steps

- Review the audit logs to identify the user or service account associated with the forbidden creation request by examining the `kubernetes.audit.user.username` field.
- Check the `kubernetes.audit.objectRef.resource` field to determine which specific resource type the unauthorized creation attempt was targeting.
- Investigate the `kubernetes.audit.sourceIPs` field to trace the source IP address of the request, which may help identify the origin of the unauthorized attempt.
- Analyze the `kubernetes.audit.annotations.authorization_k8s_io/reason` field, if available, to understand why the request was forbidden, providing insights into potential misconfigurations or policy violations.
- Cross-reference the user or service account with existing role bindings and cluster role bindings to verify if there are any misconfigurations or missing permissions that could have led to the forbidden request.
- Review recent changes in the cluster's authorization policies or role assignments that might have inadvertently affected permissions, leading to the denied request.
- Consider correlating this event with other security alerts or logs to identify patterns or repeated unauthorized attempts, which could indicate a broader attack strategy.

### False positive analysis

- Service accounts with limited permissions may trigger false positives when attempting to create resources they are not authorized for. Review service account roles and permissions to ensure they align with intended access levels.
- Automated processes or scripts that attempt resource creation without proper permissions can result in false positives. Identify and adjust these processes to ensure they operate within their designated permissions.
- Developers testing new configurations or deployments might inadvertently cause forbidden creation requests. Implement a separate testing environment with appropriate permissions to minimize false positives in production.
- Changes in authorization policies can lead to temporary false positives as users adjust to new permissions. Communicate policy changes effectively and provide guidance on necessary adjustments to avoid unnecessary alerts.
- Regularly scheduled tasks or cron jobs that attempt resource creation without updated permissions can trigger false positives. Review and update these tasks to ensure they have the necessary access rights.

### Response and remediation

- Immediately isolate the affected Kubernetes cluster to prevent further unauthorized access or resource manipulation. This can be done by restricting network access or applying stricter firewall rules temporarily.
- Identify and revoke any unauthorized or suspicious service accounts or user credentials that attempted the forbidden creation request. Ensure that these accounts are disabled or have their permissions reduced to prevent further misuse.
- Review and update the Kubernetes Role-Based Access Control (RBAC) policies to ensure that only authorized users and service accounts have the necessary permissions to create resources. This includes verifying that least privilege principles are applied.
- Conduct a thorough audit of recent Kubernetes audit logs to identify any other unauthorized access attempts or suspicious activities that may have occurred around the same time as the detected alert.
- Escalate the incident to the security operations team for further investigation and to determine if there is a broader security incident or breach. Provide them with all relevant logs and findings.
- Implement additional monitoring and alerting for similar unauthorized creation attempts in the future. This can include setting up alerts for any "forbid" decisions in the audit logs to ensure rapid detection and response.
- Consider deploying additional security tools or services, such as intrusion detection systems or anomaly detection solutions, to enhance the security posture of the Kubernetes environment and prevent similar threats.
"""
risk_score = 47
rule_id = "ec81962e-4bc8-48e6-bfb0-545fc97d8f6a"
severity = "medium"
tags = [
    "Data Source: Kubernetes",
    "Domain: Kubernetes",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Resources: Investigation Guide"
    ]
timestamp_override = "event.ingested"
type = "eql"
query = '''
any where data_stream.dataset == "kubernetes.audit_logs" and kubernetes.audit.verb == "create" and
kubernetes.audit.stage == "ResponseComplete" and `kubernetes.audit.annotations.authorization_k8s_io/decision` == "forbid"
'''

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

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

Stages and Predicates

Stage 1: any

any where data_stream.dataset == "kubernetes.audit_logs" and kubernetes.audit.verb == "create" and
kubernetes.audit.stage == "ResponseComplete" and `kubernetes.audit.annotations.authorization_k8s_io/decision` == "forbid"

Indicators

These rows show field, operator, and value matches.

M365 Exchange Mailbox Audit Logging Bypass Added

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

Detects the occurrence of mailbox audit bypass associations. The mailbox audit is responsible for logging specified mailbox events (like accessing a folder or a message or permanently deleting a message). However, actions taken by some authorized accounts, such as accounts used by third-party tools or accounts used for lawful monitoring, can create a large number of mailbox audit log entries and may not be of interest to your organization. Because of this, administrators can create bypass associations, allowing certain accounts to perform their tasks without being logged. Attackers can abuse this allowlist mechanism to conceal actions taken, as the mailbox audit will log no activity done by the account.

Known False Positives

  • Legitimate allowlisting of noisy accounts

MITRE ATT&CK Coverage

TacticTechniques
Persistence
Defense Impairment

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2022/01/13"
integration = ["o365"]
maturity = "production"
updated_date = "2026/04/10"

[rule]
author = ["Elastic"]
description = """
Detects the occurrence of mailbox audit bypass associations. The mailbox audit is responsible for logging specified
mailbox events (like accessing a folder or a message or permanently deleting a message). However, actions taken by some
authorized accounts, such as accounts used by third-party tools or accounts used for lawful monitoring, can create a
large number of mailbox audit log entries and may not be of interest to your organization. Because of this,
administrators can create bypass associations, allowing certain accounts to perform their tasks without being logged.
Attackers can abuse this allowlist mechanism to conceal actions taken, as the mailbox audit will log no activity done by
the account.
"""
false_positives = ["Legitimate allowlisting of noisy accounts"]
from = "now-9m"
index = ["logs-o365.audit-*", "filebeat-*"]
language = "kuery"
license = "Elastic License v2"
name = "M365 Exchange Mailbox Audit Logging Bypass Added"
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 M365 Exchange Mailbox Audit Logging Bypass Added

In Microsoft 365 environments, mailbox audit logging is crucial for tracking user activities like accessing or deleting emails. However, administrators can exempt certain accounts from logging to reduce noise, which attackers might exploit to hide their actions. The detection rule identifies successful attempts to create such exemptions, signaling potential misuse of this bypass mechanism.

### Possible investigation steps

- Review the event logs for entries with event.dataset set to o365.audit and event.provider set to Exchange to confirm the presence of the Set-MailboxAuditBypassAssociation action.
- Identify the account associated with the event.action Set-MailboxAuditBypassAssociation and verify if it is a known and authorized account for creating audit bypass associations.
- Check the event.outcome field to ensure the action was successful and determine if there are any other related unsuccessful attempts that might indicate trial and error by an attacker.
- Investigate the history of the account involved in the bypass association to identify any unusual or suspicious activities, such as recent changes in permissions or unexpected login locations.
- Cross-reference the account with any known third-party tools or lawful monitoring accounts to determine if the bypass is legitimate or potentially malicious.
- Assess the risk and impact of the bypass by evaluating the types of activities that would no longer be logged for the account in question, considering the organization's security policies and compliance requirements.

### False positive analysis

- Authorized third-party tools may generate a high volume of mailbox audit log entries, leading to bypass associations being set. Review and document these tools to ensure they are legitimate and necessary for business operations.
- Accounts used for lawful monitoring might be exempted from logging to reduce noise. Verify that these accounts are properly documented and that their activities align with organizational policies.
- Regularly review the list of accounts with bypass associations to ensure that only necessary and approved accounts are included. Remove any accounts that no longer require exemptions.
- Implement a process for periodically auditing bypass associations to detect any unauthorized changes or additions, ensuring that only intended accounts are exempted from logging.
- Consider setting up alerts for any new bypass associations to quickly identify and investigate potential misuse or unauthorized changes.

### Response and remediation

- Immediately isolate the account associated with the successful Set-MailboxAuditBypassAssociation event to prevent further unauthorized actions.
- Review and revoke any unauthorized mailbox audit bypass associations to ensure all relevant activities are logged.
- Conduct a thorough audit of recent activities performed by the affected account to identify any suspicious or malicious actions that may have been concealed.
- Reset credentials for the compromised account and any other accounts that may have been affected to prevent further unauthorized access.
- Notify the security team and relevant stakeholders about the incident for awareness and further investigation.
- Implement additional monitoring for similar bypass attempts to enhance detection capabilities and prevent recurrence.
- Consider escalating the incident to a higher security tier or external cybersecurity experts if the scope of the breach is extensive or if internal resources are insufficient to handle the threat.

## Setup

The Office 365 Logs Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule."""
references = ["https://twitter.com/misconfig/status/1476144066807140355"]
risk_score = 47
rule_id = "675239ea-c1bc-4467-a6d3-b9e2cc7f676d"
severity = "medium"
tags = ["Domain: Cloud", "Data Source: Microsoft 365", "Tactic: Initial Access", "Tactic: Defense Evasion", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "query"

query = '''
data_stream.dataset:o365.audit and event.provider:Exchange and event.action:Set-MailboxAuditBypassAssociation and event.outcome:success
'''


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

[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"

[[rule.threat.technique.subtechnique]]
id = "T1562.001"
name = "Disable or Modify Tools"
reference = "https://attack.mitre.org/techniques/T1562/001/"

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

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

[[rule.threat.technique]]
id = "T1098"
name = "Account Manipulation"
reference = "https://attack.mitre.org/techniques/T1098/"

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

Stages and Predicates

Stage 1: query

data_stream.dataset:o365.audit and event.provider:Exchange and event.action:Set-MailboxAuditBypassAssociation and event.outcome:success

Indicators

These rows show field, operator, and value matches.

Potential Cookies Theft via Browser Debugging

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

Identifies the execution of a Chromium based browser with the debugging process argument, which may indicate an attempt to steal authentication cookies. An adversary may steal web application or service session cookies and use them to gain access web applications or Internet services as an authenticated user without needing credentials.

Known False Positives

  • Developers performing browsers plugin or extension debugging.

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

Rule Body

[metadata]
creation_date = "2020/12/21"
integration = ["endpoint", "windows", "system"]
maturity = "production"
updated_date = "2025/03/20"

[rule]
author = ["Elastic"]
description = """
Identifies the execution of a Chromium based browser with the debugging process argument, which may indicate an attempt
to steal authentication cookies. An adversary may steal web application or service session cookies and use them to gain
access web applications or Internet services as an authenticated user without needing credentials.
"""
false_positives = ["Developers performing browsers plugin or extension debugging."]
from = "now-9m"
index = [
    "auditbeat-*",
    "logs-endpoint.events.*",
    "logs-system.security*",
    "logs-windows.forwarded*",
    "logs-windows.sysmon_operational-*",
    "winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
max_signals = 33
name = "Potential Cookies Theft via Browser Debugging"
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 Cookies Theft via Browser Debugging

Chromium-based browsers support debugging features that allow developers to inspect and modify web applications. Adversaries can exploit these features to access session cookies, enabling unauthorized access to web services. The detection rule identifies suspicious browser processes using debugging arguments, which may indicate cookie theft attempts, by monitoring specific process names and arguments across different operating systems.

### Possible investigation steps

- Review the process details to confirm the presence of suspicious debugging arguments such as "--remote-debugging-port=*", "--remote-debugging-targets=*", or "--remote-debugging-pipe=*". Check if these arguments were used in conjunction with "--user-data-dir=*" and ensure "--remote-debugging-port=0" is not present.
- Identify the user account associated with the suspicious browser process to determine if it aligns with expected behavior or if it might be compromised.
- Investigate the source IP address and network activity associated with the process to identify any unusual or unauthorized access patterns.
- Check for any recent changes or anomalies in the user's account activity, such as unexpected logins or access to sensitive applications.
- Correlate the event with other security alerts or logs to identify if this activity is part of a broader attack pattern or campaign.
- If possible, capture and analyze the network traffic associated with the process to detect any data exfiltration attempts or communication with known malicious IP addresses.

### False positive analysis

- Development and testing activities may trigger the rule when developers use debugging features for legitimate purposes. To manage this, create exceptions for known developer machines or user accounts frequently involved in web application development.
- Automated testing frameworks that utilize browser debugging for testing web applications can also cause false positives. Identify and exclude processes initiated by these frameworks by specifying their unique process names or user accounts.
- Browser extensions or tools that rely on debugging ports for functionality might be flagged. Review and whitelist these extensions or tools if they are verified as safe and necessary for business operations.
- Remote support or troubleshooting sessions using debugging features can be mistaken for suspicious activity. Implement a policy to log and review such sessions, allowing exceptions for recognized support tools or personnel.
- Continuous integration/continuous deployment (CI/CD) pipelines that involve browser automation may inadvertently match the rule criteria. Exclude these processes by identifying and filtering based on the CI/CD system's user accounts or process identifiers.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or data exfiltration.
- Terminate any suspicious browser processes identified with debugging arguments to stop potential cookie theft in progress.
- Conduct a thorough review of access logs for the affected web applications or services to identify any unauthorized access attempts using stolen cookies.
- Invalidate all active sessions for the affected user accounts and force a re-authentication to ensure that any stolen session cookies are rendered useless.
- Implement stricter browser security policies, such as disabling remote debugging features in production environments, to prevent similar exploitation in the future.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems or data have been compromised.
- Enhance monitoring and alerting for similar suspicious browser activities by refining detection rules and incorporating additional threat intelligence."""
references = [
    "https://github.com/defaultnamehere/cookie_crimes",
    "https://embracethered.com/blog/posts/2020/cookie-crimes-on-mirosoft-edge/",
    "https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/post/multi/gather/chrome_cookies.md",
    "https://posts.specterops.io/hands-in-the-cookie-jar-dumping-cookies-with-chromiums-remote-debugger-port-34c4f468844e",
]
risk_score = 47
rule_id = "027ff9ea-85e7-42e3-99d2-bbb7069e02eb"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "OS: Windows",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Tactic: Credential Access",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
    "Data Source: Windows Security Event Logs",
    "Data Source: Sysmon",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where event.type in ("start", "process_started", "info") and
  process.name in (
             "Microsoft Edge",
             "chrome.exe",
             "Google Chrome",
             "google-chrome-stable",
             "google-chrome-beta",
             "google-chrome",
             "msedge.exe") and
   process.args : ("--remote-debugging-port=*",
                   "--remote-debugging-targets=*",
                   "--remote-debugging-pipe=*") and
   process.args : "--user-data-dir=*" and not process.args:"--remote-debugging-port=0"
'''


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1539"
name = "Steal Web Session Cookie"
reference = "https://attack.mitre.org/techniques/T1539/"


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

Stages and Predicates

Stage 1: process

process where event.type in ("start", "process_started", "info") and
  process.name in (
             "Microsoft Edge",
             "chrome.exe",
             "Google Chrome",
             "google-chrome-stable",
             "google-chrome-beta",
             "google-chrome",
             "msedge.exe") and
   process.args : ("--remote-debugging-port=*",
                   "--remote-debugging-targets=*",
                   "--remote-debugging-pipe=*") and
   process.args : "--user-data-dir=*" and not process.args:"--remote-debugging-port=0"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typein
  • info
  • process_started corpus 39 (elastic 39)
  • start corpus 40 (elastic 40)
field:"event.type" kind:in
process.argswildcard
  • --remote-debugging-pipe=* corpus 2 (elastic 2)
  • --remote-debugging-port=* corpus 2 (elastic 2)
  • --remote-debugging-targets=* corpus 2 (elastic 2)
  • --user-data-dir=* corpus 2 (elastic 2)
field:"process.args" kind:wildcard
process.namein
  • Google Chrome corpus 4 (elastic 4)
  • Microsoft Edge corpus 2 (elastic 2)
  • chrome.exe corpus 5 (elastic 5)
  • google-chrome corpus 3 (elastic 3)
  • google-chrome-beta
  • google-chrome-stable corpus 3 (elastic 3)
  • msedge.exe corpus 5 (elastic 5)
field:"process_basename" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq--remote-debugging-port=0excludes:process.args field:"process.args" value:"--remote-debugging-port=0"

Potential Process Creation via ShellCode

#
Source
github.com/elastic/protections-artifacts

Identifies the creation of a process where the creating thread's stack contains frames pointing outside any known executable image and using commonly used Windows APIs like WinExec. This is a common pattern for code injection using default offensive shellcode templates.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies the creation of a process where the creating thread's stack contains frames pointing outside any known
executable image and using commonly used Windows APIs like WinExec. This is a common pattern for code injection using
default offensive shellcode templates.
"""
id = "58b996a5-634c-4205-9ffa-a6f2b8ebc1ad"
license = "Elastic License v2"
name = "Potential Process Creation via ShellCode"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/upping-the-ante-detecting-in-memory-threats-with-kernel-call-stacks",
]
version = "1.0.20"

query = '''
process where event.action == "start" and

process.parent.thread.Ext.call_stack_contains_unbacked == true and

 (process.parent.thread.Ext.call_stack_summary : "*kernel32.dll|Unbacked*" and
  _arraysearch(process.parent.thread.Ext.call_stack, $entry, $entry.symbol_info : "*kernel32.dll!WinExec*")) and

not (process.code_signature.trusted == true and
     process.code_signature.subject_name : ("GIGA-BYTE TECHNOLOGY CO., LTD.", "Intuit Inc", "Ramsauer und Stuermer Software GmbH",
     "Aptean, Inc.", "MICRO-STAR INTERNATIONAL CO., LTD.")) and

not (process.executable : "C:\\Windows\\System32\\sc.exe" and process.parent.executable : "C:\\Windows\\System32\\svchost.exe" and
     process.command_line : "sc start LenovoPcManagerService") and
not process.executable :
                ("C:\\Program Files (x86)\\Ponds33\\Refined Method\\Main.exe",
                 "C:\\Program Files (x86)\\Ponds33\\Underdrain\\UDMain.exe",
                 "C:\\Program Files (x86)\\Ponds33\\NPCalc\\NPCalcMain.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.thread.Ext.call_stack_contains_unbacked == true and

 (process.parent.thread.Ext.call_stack_summary : "*kernel32.dll|Unbacked*" and
  _arraysearch(process.parent.thread.Ext.call_stack, $entry, $entry.symbol_info : "*kernel32.dll!WinExec*")) and

not (process.code_signature.trusted == true and
     process.code_signature.subject_name : ("GIGA-BYTE TECHNOLOGY CO., LTD.", "Intuit Inc", "Ramsauer und Stuermer Software GmbH",
     "Aptean, Inc.", "MICRO-STAR INTERNATIONAL CO., LTD.")) and

not (process.executable : "C:\\Windows\\System32\\sc.exe" and process.parent.executable : "C:\\Windows\\System32\\svchost.exe" and
     process.command_line : "sc start LenovoPcManagerService") and
not process.executable :
                ("C:\\Program Files (x86)\\Ponds33\\Refined Method\\Main.exe",
                 "C:\\Program Files (x86)\\Ponds33\\Underdrain\\UDMain.exe",
                 "C:\\Program Files (x86)\\Ponds33\\NPCalc\\NPCalcMain.exe")

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqGIGA-BYTE TECHNOLOGY CO., LTD., Intuit Inc, Ramsauer und Stuermer Software GmbH, Aptean, Inc., MICRO-STAR INTERNATIONAL CO., LTD.excludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.command_lineeqsc start LenovoPcManagerServiceexcludes:process.command_line field:"process.command_line" value:"sc start LenovoPcManagerService"
process.executableeqC:\Windows\System32\sc.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\System32\sc.exe"
process.parent.executableeqC:\Windows\System32\svchost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\svchost.exe"
process.executableeqC:\Program Files (x86)\Ponds33\Refined Method\Main.exe, C:\Program Files (x86)\Ponds33\Underdrain\UDMain.exe, C:\Program Files (x86)\Ponds33\NPCalc\NPCalcMain.exeexcludes:process.executable field:"process.executable" value:"C:\Program Files (x86)\Ponds33\Refined Method\Main.exe" field:"process.executable" value:"C:\Program Files (x86)\Ponds33\Underdrain\UDMain.exe" field:"process.executable" value:"C:\Program Files (x86)\Ponds33\NPCalc\NPCalcMain.exe"

Potential Sudo Hijacking

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

Identifies the creation of a sudo binary located at /usr/bin/sudo. Attackers may hijack the default sudo binary and replace it with a custom binary or script that can read the user's password in clear text to escalate privileges or enable persistence onto the system every time the sudo binary is executed.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/07/26"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/17"

[rule]
author = ["Elastic"]
description = """
Identifies the creation of a sudo binary located at /usr/bin/sudo. Attackers may hijack the default sudo binary and
replace it with a custom binary or script that can read the user's password in clear text to escalate privileges or
enable persistence onto the system every time the sudo binary is executed.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Sudo Hijacking"
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 Sudo Hijacking

Sudo is a critical utility in Linux environments, allowing users to execute commands with elevated privileges. Adversaries may exploit this by replacing the sudo binary with a malicious version to capture passwords or maintain persistence. The detection rule identifies suspicious creation or renaming of the sudo binary, excluding legitimate package management processes, to flag potential hijacking attempts.

### Possible investigation steps

- Review the file creation or rename event details to confirm the file path is either /usr/bin/sudo or /bin/sudo, as these are critical locations for the sudo binary.
- Check the process executable that triggered the event to ensure it is not part of the legitimate package management processes listed in the query, such as /bin/dpkg or /usr/bin/yum.
- Investigate the user account associated with the event to determine if the activity aligns with their typical behavior or if it appears suspicious.
- Examine the system logs around the time of the event for any unusual activity or errors that might indicate tampering or unauthorized access.
- Verify the integrity of the current sudo binary by comparing its hash with a known good version to detect any unauthorized modifications.
- Assess the system for any additional signs of compromise, such as unexpected network connections or new user accounts, which may indicate broader malicious activity.

### False positive analysis

- Package management processes can trigger false positives when legitimate updates or installations occur. To handle this, ensure that processes like dpkg, rpm, yum, and apt are included in the exclusion list as they are common package managers.
- Custom scripts or automation tools that modify the sudo binary for legitimate reasons may cause alerts. Review these scripts and consider adding their paths to the exclusion list if they are verified as safe.
- Temporary files or directories used during legitimate software installations or updates, such as those in /var/lib/dpkg or /tmp, can lead to false positives. Exclude these paths if they are part of a known and safe process.
- Development or testing environments where sudo binaries are frequently modified for testing purposes might trigger alerts. In such cases, consider excluding these environments from monitoring or adding specific exclusions for known safe modifications.
- Ensure that any process or executable that is known to interact with the sudo binary in a non-malicious way is added to the exclusion list to prevent unnecessary alerts.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or lateral movement by the attacker.
- Verify the integrity of the sudo binary by comparing its hash with a known good version from a trusted source. If compromised, replace it with the legitimate binary.
- Conduct a thorough review of system logs and the process execution history to identify any unauthorized changes or suspicious activities related to the sudo binary.
- Reset passwords for all user accounts on the affected system, especially those with elevated privileges, to mitigate potential credential theft.
- Implement additional monitoring on the affected system and similar environments to detect any further attempts to modify critical binaries or escalate privileges.
- Escalate the incident to the security operations team for a comprehensive investigation and to determine if other systems may be affected.
- Review and update access controls and permissions to ensure that only authorized personnel can modify critical system binaries."""
references = [
    "https://eapolsniper.github.io/2020/08/17/Sudo-Hijacking/",
    "https://www.elastic.co/security-labs/sequel-on-persistence-mechanisms",
]
risk_score = 47
rule_id = "88fdcb8c-60e5-46ee-9206-2663adf1b1ce"
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 = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Privilege Escalation",
    "Tactic: Persistence",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.action in ("creation", "rename") and
file.path in ("/usr/bin/sudo", "/bin/sudo") and not (
  process.name like ("python*", "platform-python*") or
  file.Ext.original.path in ("/usr/bin/sudo", "/bin/sudo") or
  process.executable in (
    "/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
    "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum", "/bin/dnf", "/usr/bin/dnf",
    "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic", "/bin/pacman", "/usr/bin/pacman",
    "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk", "/usr/local/sbin/apk", "/usr/bin/apt",
    "/usr/sbin/pacman", "/usr/bin/microdnf", "/usr/local/bin/dockerd", "/usr/local/bin/podman", "/usr/local/bin/dnf",
    "/kaniko/executor", "/proc/self/exe", "/usr/bin/apt-get", "/usr/bin/apt-cache", "/usr/bin/apt-mark",
    "./usr/bin/podman", "./usr/lib/snapd/snap-update-ns", "/kaniko/kaniko-executor", "/usr/libexec/packagekitd",
    "/usr/bin/dnf5", "/usr/lib/pamac/pamac-daemon", "./usr/libexec/snapd/snap-update-ns", "/usr/bin/update-alternatives",
    "/var/ossec/bin/wazuh-syscheckd", "/usr/local/bin/defender", "/usr/sbin/dnf", "/usr/local/bin/starship", "/bin/dnf4",
    "/usr/sbin/yum-cron", "/bin/buildah", "/usr/bin/buildah"
  ) or
  file.Ext.original.extension == "dpkg-new" or
  file.Ext.original.name like "sudo;*" or
  process.executable : (
    "/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/var/lib/docker/*",
    "./snap/snapd/*/usr/lib/snapd/snap-update-ns", "/opt/docker/overlay2/*/dockerd", 
    "/var/lib/containers/storage/overlay/*/dockerd", "/usr/libexec/platform-python*"
  ) or
  process.executable == null or
  (process.name == "sed" and file.name : "sed*")
)
'''

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

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

[[rule.threat.technique.subtechnique]]
id = "T1548.003"
name = "Sudo and Sudo Caching"
reference = "https://attack.mitre.org/techniques/T1548/003/"

[[rule.threat.technique]]
id = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"

[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 = "T1574"
name = "Hijack Execution Flow"
reference = "https://attack.mitre.org/techniques/T1574/"

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

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

[[rule.threat.technique]]
id = "T1056"
name = "Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/"

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

Stages and Predicates

Stage 1: file

file where host.os.type == "linux" and event.action in ("creation", "rename") and
file.path in ("/usr/bin/sudo", "/bin/sudo") and not (
  process.name like ("python*", "platform-python*") or
  file.Ext.original.path in ("/usr/bin/sudo", "/bin/sudo") or
  process.executable in (
    "/bin/dpkg", "/usr/bin/dpkg", "/bin/dockerd", "/usr/bin/dockerd", "/usr/sbin/dockerd", "/bin/microdnf",
    "/bin/rpm", "/usr/bin/rpm", "/bin/snapd", "/usr/bin/snapd", "/bin/yum", "/usr/bin/yum", "/bin/dnf", "/usr/bin/dnf",
    "/bin/podman", "/usr/bin/podman", "/bin/dnf-automatic", "/usr/bin/dnf-automatic", "/bin/pacman", "/usr/bin/pacman",
    "/usr/bin/dpkg-divert", "/bin/dpkg-divert", "/sbin/apk", "/usr/sbin/apk", "/usr/local/sbin/apk", "/usr/bin/apt",
    "/usr/sbin/pacman", "/usr/bin/microdnf", "/usr/local/bin/dockerd", "/usr/local/bin/podman", "/usr/local/bin/dnf",
    "/kaniko/executor", "/proc/self/exe", "/usr/bin/apt-get", "/usr/bin/apt-cache", "/usr/bin/apt-mark",
    "./usr/bin/podman", "./usr/lib/snapd/snap-update-ns", "/kaniko/kaniko-executor", "/usr/libexec/packagekitd",
    "/usr/bin/dnf5", "/usr/lib/pamac/pamac-daemon", "./usr/libexec/snapd/snap-update-ns", "/usr/bin/update-alternatives",
    "/var/ossec/bin/wazuh-syscheckd", "/usr/local/bin/defender", "/usr/sbin/dnf", "/usr/local/bin/starship", "/bin/dnf4",
    "/usr/sbin/yum-cron", "/bin/buildah", "/usr/bin/buildah"
  ) or
  file.Ext.original.extension == "dpkg-new" or
  file.Ext.original.name like "sudo;*" or
  process.executable : (
    "/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/var/lib/docker/*",
    "./snap/snapd/*/usr/lib/snapd/snap-update-ns", "/opt/docker/overlay2/*/dockerd", 
    "/var/lib/containers/storage/overlay/*/dockerd", "/usr/libexec/platform-python*"
  ) or
  process.executable == null or
  (process.name == "sed" and file.name : "sed*")
)

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionin
  • creation
  • rename
field:"EventType" kind:in
file.pathin
  • /bin/sudo
  • /usr/bin/sudo
field:"TargetFilename" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.namestarts_withsedexcludes:file.name field:"file.name" value:"sed"
process.nameeqsedexcludes:process.name field:"process.name" value:"sed"
file.Ext.original.extensioneqdpkg-newexcludes:file.Ext.original.extension field:"file.Ext.original.extension" value:"dpkg-new"
file.Ext.original.namestarts_withsudo;excludes:file.Ext.original.name field:"file.Ext.original.name" value:"sudo;"
file.Ext.original.pathin/bin/sudo, /usr/bin/sudoexcludes:file.Ext.original.path field:"file.Ext.original.path" value:"/bin/sudo" field:"file.Ext.original.path" value:"/usr/bin/sudo"
process.executablein./usr/bin/podman, ./usr/lib/snapd/snap-update-ns, ./usr/libexec/snapd/snap-update-ns, /bin/buildah, /bin/dnf, /bin/dnf-automatic, /bin/dnf4, /bin/dockerd, /bin/dpkg, /bin/dpkg-divert, /bin/microdnf, /bin/pacman, /bin/podman, /bin/rpm, /bin/snapd, /bin/yum, /kaniko/executor, /kaniko/kaniko-executor, /proc/self/exe, /sbin/apk, /usr/bin/apt, /usr/bin/apt-cache, /usr/bin/apt-get, /usr/bin/apt-mark, /usr/bin/buildah, /usr/bin/dnf, /usr/bin/dnf-automatic, /usr/bin/dnf5, /usr/bin/dockerd, /usr/bin/dpkg, /usr/bin/dpkg-divert, /usr/bin/microdnf, /usr/bin/pacman, /usr/bin/podman, /usr/bin/rpm, /usr/bin/snapd, /usr/bin/update-alternatives, /usr/bin/yum, /usr/lib/pamac/pamac-daemon, /usr/libexec/packagekitd, /usr/local/bin/defender, /usr/local/bin/dnf, /usr/local/bin/dockerd, /usr/local/bin/podman, /usr/local/bin/starship, /usr/local/sbin/apk, /usr/sbin/apk, /usr/sbin/dnf, /usr/sbin/dockerd, /usr/sbin/pacman, /usr/sbin/yum-cron, /var/ossec/bin/wazuh-syscheckdexcludes:process.executable
process.executableis_null(no value, null check)excludes:process.executable
process.executablewildcard/nix/store/*, /var/lib/dpkg/*, /tmp/vmis.*, /snap/*, /dev/fd/*, /var/lib/docker/*, ./snap/snapd/*/usr/lib/snapd/snap-update-ns, /opt/docker/overlay2/*/dockerd, /var/lib/containers/storage/overlay/*/dockerd, /usr/libexec/platform-python*excludes:process.executable
process.namestarts_withpython, platform-pythonexcludes:process.name field:"process.name" value:"python" field:"process.name" value:"platform-python"

PowerShell Empire Script Execution

#
Source
github.com/elastic/protections-artifacts

Identifies the execution of PowerShell scripts with keywords from known open source Empire penetration testing tool.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = "Identifies the execution of PowerShell scripts with keywords from known open source Empire penetration testing tool."
id = "a014e5b8-e793-46a4-a006-57c2f908ece1"
license = "Elastic License v2"
name = "PowerShell Empire Script Execution"
os_list = ["windows"]
version = "1.0.2"

query = '''
api where process.Ext.api.name == "AmsiScanBuffer" and
 (process.name in~ ("powershell.exe") or process.Ext.api.parameters.app_name == "PowerShell") and
  process.Ext.api.parameters.buffer :
               ("*%256*%256*-bxor*%256*",
                "*$data ($IV+$K)*|IEX*",
                "*:CurrentListenerName*:ControlServers*",
                "*/admin/get.php,/news.php,/login/process.php*",
                "*/login/process.php*",
                "If($GPF)*")
'''

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

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



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

[internal]
min_endpoint_version = "8.16.0"

Stages and Predicates

Stage 1: api

api where process.Ext.api.name == "AmsiScanBuffer" and
 (process.name in~ ("powershell.exe") or process.Ext.api.parameters.app_name == "PowerShell") and
  process.Ext.api.parameters.buffer :
               ("*%256*%256*-bxor*%256*",
                "*$data ($IV+$K)*|IEX*",
                "*:CurrentListenerName*:ControlServers*",
                "*/admin/get.php,/news.php,/login/process.php*",
                "*/login/process.php*",
                "If($GPF)*")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
process.Ext.api.nameeq
  • AmsiScanBuffer corpus 18 (elastic 18)
field:"process.Ext.api.name" kind:eq value:"AmsiScanBuffer"
process.Ext.api.parameters.app_nameeq
  • PowerShell corpus 10 (elastic 10)
field:"process.Ext.api.parameters.app_name" kind:eq value:"PowerShell"
process.Ext.api.parameters.bufferwildcard
  • *$data ($IV+$K)*|IEX*
  • *%256*%256*-bxor*%256*
  • */admin/get.php,/news.php,/login/process.php*
  • */login/process.php*
  • *:CurrentListenerName*:ControlServers*
  • If($GPF)*
field:"process.Ext.api.parameters.buffer" kind:wildcard
process.namein
  • powershell.exe corpus 187 (elastic 140, splunk 44, kusto 3)
field:"process_basename" kind:in value:"powershell.exe"

PowerShell Suspicious Discovery Related Windows API Functions

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

Detects PowerShell scripts that references native Windows API functions commonly used for discovery of users, groups, shares, sessions, domain trusts, and service security. Attackers use these APIs for situational awareness and targeting prior to lateral movement or collection.

Known False Positives

  • Legitimate PowerShell scripts that make use of these functions.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2021/10/13"
integration = ["windows"]
maturity = "production"
updated_date = "2026/03/30"

[rule]
author = ["Elastic"]
description = """
Detects PowerShell scripts that references native Windows API functions commonly used for discovery of users, groups,
shares, sessions, domain trusts, and service security. Attackers use these APIs for situational awareness and targeting
prior to lateral movement or collection.
"""
false_positives = ["Legitimate PowerShell scripts that make use of these functions."]
from = "now-9m"
index = ["winlogbeat-*", "logs-windows.powershell*"]
language = "kuery"
license = "Elastic License v2"
name = "PowerShell Suspicious Discovery Related Windows API Functions"
note = """## Triage and analysis

> **Disclaimer**:
> This guide was created by humans with the assistance of generative AI. While its contents have been manually curated to include the most valuable information, always validate assumptions and adjust procedures to match your internal runbooks and incident triage and response policies.

### Investigating PowerShell Suspicious Discovery Related Windows API Functions

This rule flags PowerShell script block content that references Windows API functions commonly used to enumerate users, groups, shares, sessions, domain trusts, and service security. These APIs are frequently accessed via native interop patterns (for example, runtime-compiled type definitions) and can be used to build an inventory of the environment before follow-on activity such as lateral movement or collection.

#### Key alert fields to review

- `user.name`, `user.domain`, `user.id`: Account execution context for correlation, prioritization, and scoping.
- `host.name`, `host.id`: Host execution context for correlation, prioritization, and scoping.
- `powershell.file.script_block_text`: Script block content that matched the detection logic.
- `powershell.file.script_block_id`, `powershell.sequence`, `powershell.total`: Script block metadata to pivot to other fragments or reconstruct full script content when split across multiple events.
- `file.path`, `file.directory`, `file.name`: File-origin context when the script block is sourced from an on-disk file.
- `powershell.file.script_block_length`: Script block length (size) context.

#### Possible investigation steps

- Establish context and expected behavior:
  - Review `host.name`/`host.id` to understand where the activity occurred and whether the host is expected to perform administrative discovery.
  - Review `user.name`, `user.domain`, and `user.id` to determine whether the executing identity aligns with expected administrative or automation activity for that host.
  - Use `powershell.file.script_block_length` (when present) as a quick indicator of complexity; unusually large blocks may indicate embedded helper libraries or inline compiled source.

- Review, reconstruct, and characterize the script content:
  - Inspect `powershell.file.script_block_text` and identify which API function name(s) are present and what discovery objective they imply.
  - If the script is fragmented, reconstruct it by grouping events on `powershell.file.script_block_id` and ordering by `powershell.sequence` until `powershell.total` is reached. Capture the complete reconstructed content for case notes.
  - Look for indicators of native API invocation rather than standard cmdlets, such as embedded type definitions, interop attributes, or inline compiled source. This can increase confidence that the script was designed to directly call Windows APIs.
  - Identify additional capabilities in the same script block (or neighboring fragments) that may indicate follow-on behavior, such as credential access, remote execution logic, output staging, or data access from remote resources.

- Map API functions to likely discovery intent:
  - Share and server discovery: `NetShareEnum`, `NetServerGetInfo`, `GetComputerNameEx`.
  - User and group discovery: `NetUserEnum`, `NetUserGetInfo`, `NetGroupEnum`, `NetGroupGetInfo`, `NetGroupGetUsers`, `NetLocalGroupEnum`, `NetLocalGroupGetMembers`, `GetUserNameEx`, `NetUserModalsGet`.
  - Session and workstation discovery: `NetSessionEnum`, `NetWkstaUserEnum`, `NetWkstaGetInfo`, `NetWkstaTransportEnum`, `WTSEnumerateSessionsEx`, `WTSQuerySessionInformation`, `LsaGetLogonSessionData`.
  - Domain trust and site discovery: `DsEnumerateDomainTrusts`, `LsaEnumerateTrustedDomains`, `DsGetSiteName`.
  - Service permission discovery: `QueryServiceObjectSecurity`.
  - Job discovery: `NetScheduleJobEnum`.

- Determine discovery scope and targets from the content:
  - Extract any referenced hostnames, domain names, share names, or service names directly from `powershell.file.script_block_text` (when present) and record them as potential discovery targets.
  - Look for indications of remote enumeration (for example, multiple target strings, iteration constructs, or repeated API calls with varying targets) versus single-host local discovery.
  - Prioritize cases that include higher-impact reconnaissance (trust enumeration, session enumeration, logon session data, or service security descriptor queries), especially when the account or host context is unusual.

- Validate script origin and execution source:
  - If file context is present, review `file.path`, `file.directory`, and `file.name` to understand whether the script block originated from an on-disk script and whether that location aligns with approved tooling.
  - Treat scripts originating from unexpected or user-writable locations, or scripts with unusual naming, as higher risk and scope for other related activity on the same host and by the same user.

- Scope for related activity using alert-available pivots:
  - Search for other script blocks with the same `powershell.file.script_block_id` to ensure no fragments are missed and to identify repeated execution.
  - Search for additional hits of the same `file.path`/`file.name` across hosts to determine whether the script is broadly deployed or opportunistically introduced.
  - Identify other occurrences of similar discovery content by pivoting on distinctive substrings within `powershell.file.script_block_text` (such as specific API function names) and the same `user.id` to detect a broader reconnaissance pattern.

- Correlate with adjacent telemetry (as available in your environment):
  - Process context: determine how PowerShell was started and whether the initiation method is consistent with expected activity for `user.name` on `host.name`.
  - Authentication and remote access: look for logons or remote session activity involving the same `user.name` around the alert time, especially if the script content suggests remote enumeration of servers or sessions.
  - Network and share access: review evidence of access to discovered targets (servers/shares) following the enumeration to identify potential collection from network shares.
  - Persistence or privilege escalation follow-on: if service security or job enumeration is present, look for subsequent changes consistent with service or scheduled job manipulation.

### False positive analysis

- Benign administrative discovery can occur during routine inventory, troubleshooting, or access validation, especially from dedicated administration hosts and by well-known administrative identities.
- False positives are more likely when the same script content appears regularly, is consistently associated with the same `file.path`/`file.name`, and is executed by expected `user.name` accounts on expected hosts.
- Prioritize as suspicious when the activity is new for the environment, originates from an unexpected script location, is executed by a non-administrative or unusual account, or appears across multiple hosts in a short period.

### Response and remediation

- If the activity is confirmed or strongly suspected malicious:
  - Contain the affected host and restrict the involved account to prevent further reconnaissance and follow-on actions.
  - Preserve evidence from the alert, including the fully reconstructed `powershell.file.script_block_text`, `powershell.file.script_block_id`, and any extracted target identifiers, along with `host.id` and `user.id` for reliable correlation.
  - Scope across the environment for additional executions using pivots on `user.id`, `host.id`, `file.path`/`file.name`, and distinctive content within `powershell.file.script_block_text`.
  - Review the enumerated targets (hosts, shares, users/groups, trusts, services, sessions) for unauthorized access attempts and follow-on activity such as network share access, credential misuse, or lateral movement.

- If the activity is determined to be legitimate but unexpected:
  - Identify the script owner and document the business purpose, expected execution scope (hosts/users), and expected cadence.
  - Reduce future noise by baselining approved scripts and execution contexts, and ensure logging and monitoring coverage remains sufficient to investigate future occurrences.
"""
references = [
    "https://github.com/BC-SECURITY/Empire/blob/9259e5106986847d2bb770c4289c0c0f1adf2344/data/module_source/situational_awareness/network/powerview.ps1#L21413",
    "https://github.com/atc-project/atc-data/blob/master/docs/Logging_Policies/LP_0109_windows_powershell_script_block_log.md",
]
risk_score = 21
rule_id = "61ac3638-40a3-44b2-855a-985636ca985e"
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
"""
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Discovery",
    "Tactic: Collection",
    "Tactic: Execution",
    "Resources: Investigation Guide",
    "Data Source: PowerShell Logs",
]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.category:process and host.os.type:windows and
  powershell.file.script_block_text : (
    NetShareEnum or
    NetWkstaUserEnum or
    NetSessionEnum or
    NetLocalGroupEnum or
    NetLocalGroupGetMembers or
    DsGetSiteName or
    DsEnumerateDomainTrusts or
    WTSEnumerateSessionsEx or
    WTSQuerySessionInformation or
    LsaGetLogonSessionData or
    QueryServiceObjectSecurity or
    GetComputerNameEx or
    NetWkstaGetInfo or
    GetUserNameEx or
    NetUserEnum or
    NetUserGetInfo or
    NetGroupEnum or
    NetGroupGetInfo or
    NetGroupGetUsers or
    NetWkstaTransportEnum or
    NetServerGetInfo or
    LsaEnumerateTrustedDomains  or
    NetScheduleJobEnum or
    NetUserModalsGet
  ) and
  not powershell.file.script_block_text : (
    ("DsGetSiteName" and ("DiscoverWindowsComputerProperties.ps1" and "param($SourceType, $SourceId, $ManagedEntityId, $ComputerIdentity)")) or
    ("# Copyright: (c) 2018, Ansible Project" and "#Requires -Module Ansible.ModuleUtils.AddType" and "#AnsibleRequires -CSharpUtil Ansible.Basic") or
    ("Ansible.Windows.Setup" and "Ansible.Windows.Setup" and "NativeMethods.NetWkstaGetInfo(null, 100, out netBuffer);")
  ) and
  not file.directory: "C:\Program Files (x86)\Automox\WDK\Win32\WinSession"
'''


[[rule.filters]]

[rule.filters.meta]
negate = true
[rule.filters.query.wildcard."file.path"]
case_insensitive = true
value = "?:\\\\ProgramData\\\\Microsoft\\\\Windows Defender Advanced Threat Protection\\\\DataCollection\\\\*"
[[rule.threat]]
framework = "MITRE ATT&CK"

[[rule.threat.technique]]
id = "T1007"
name = "System Service Discovery"
reference = "https://attack.mitre.org/techniques/T1007/"

[[rule.threat.technique]]
id = "T1016"
name = "System Network Configuration Discovery"
reference = "https://attack.mitre.org/techniques/T1016/"

[[rule.threat.technique]]
id = "T1033"
name = "System Owner/User Discovery"
reference = "https://attack.mitre.org/techniques/T1033/"

[[rule.threat.technique]]
id = "T1069"
name = "Permission Groups Discovery"
reference = "https://attack.mitre.org/techniques/T1069/"

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

[[rule.threat.technique.subtechnique]]
id = "T1069.002"
name = "Domain Groups"
reference = "https://attack.mitre.org/techniques/T1069/002/"

[[rule.threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"

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

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

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

[[rule.threat.technique]]
id = "T1135"
name = "Network Share Discovery"
reference = "https://attack.mitre.org/techniques/T1135/"

[[rule.threat.technique]]
id = "T1201"
name = "Password Policy Discovery"
reference = "https://attack.mitre.org/techniques/T1201/"

[[rule.threat.technique]]
id = "T1482"
name = "Domain Trust Discovery"
reference = "https://attack.mitre.org/techniques/T1482/"

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

[[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]]
id = "T1106"
name = "Native API"
reference = "https://attack.mitre.org/techniques/T1106/"

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

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

[[rule.threat.technique]]
id = "T1039"
name = "Data from Network Shared Drive"
reference = "https://attack.mitre.org/techniques/T1039/"

[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[rule.investigation_fields]
field_names = [
    "@timestamp",
    "user.name",
    "user.id",
    "user.domain",
    "powershell.file.script_block_text",
    "powershell.file.script_block_id",
    "powershell.sequence",
    "powershell.total",
    "file.path",
    "file.directory",
    "file.name",
    "process.pid",
    "host.name",
    "host.id",
    "powershell.file.script_block_length"
]

Stages and Predicates

Stage 1: query

event.category:process and host.os.type:windows and
  powershell.file.script_block_text : (
    NetShareEnum or
    NetWkstaUserEnum or
    NetSessionEnum or
    NetLocalGroupEnum or
    NetLocalGroupGetMembers or
    DsGetSiteName or
    DsEnumerateDomainTrusts or
    WTSEnumerateSessionsEx or
    WTSQuerySessionInformation or
    LsaGetLogonSessionData or
    QueryServiceObjectSecurity or
    GetComputerNameEx or
    NetWkstaGetInfo or
    GetUserNameEx or
    NetUserEnum or
    NetUserGetInfo or
    NetGroupEnum or
    NetGroupGetInfo or
    NetGroupGetUsers or
    NetWkstaTransportEnum or
    NetServerGetInfo or
    LsaEnumerateTrustedDomains  or
    NetScheduleJobEnum or
    NetUserModalsGet
  ) and
  not powershell.file.script_block_text : (
    ("DsGetSiteName" and ("DiscoverWindowsComputerProperties.ps1" and "param($SourceType, $SourceId, $ManagedEntityId, $ComputerIdentity)")) or
    ("# Copyright: (c) 2018, Ansible Project" and "#Requires -Module Ansible.ModuleUtils.AddType" and "#AnsibleRequires -CSharpUtil Ansible.Basic") or
    ("Ansible.Windows.Setup" and "Ansible.Windows.Setup" and "NativeMethods.NetWkstaGetInfo(null, 100, out netBuffer);")
  ) and
  not file.directory: "C:\Program Files (x86)\Automox\WDK\Win32\WinSession"

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
  • DsEnumerateDomainTrusts
  • DsGetSiteName
  • GetComputerNameEx
  • GetUserNameEx
  • LsaEnumerateTrustedDomains
  • LsaGetLogonSessionData
  • NetGroupEnum
  • NetGroupGetInfo
  • NetGroupGetUsers
  • NetLocalGroupEnum
  • NetLocalGroupGetMembers
  • NetScheduleJobEnum
  • NetServerGetInfo
  • NetSessionEnum
  • NetShareEnum
  • NetUserEnum
  • NetUserGetInfo
  • NetUserModalsGet
  • NetWkstaGetInfo
  • NetWkstaTransportEnum
  • NetWkstaUserEnum
  • QueryServiceObjectSecurity
  • WTSEnumerateSessionsEx
  • WTSQuerySessionInformation
field:"ScriptBlockText" kind:in

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
powershell.file.script_block_texteq# Copyright: (c) 2018, Ansible Projectexcludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"# Copyright: (c) 2018, Ansible Project"
powershell.file.script_block_texteq#AnsibleRequires -CSharpUtil Ansible.Basicexcludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"#AnsibleRequires -CSharpUtil Ansible.Basic"
powershell.file.script_block_texteq#Requires -Module Ansible.ModuleUtils.AddTypeexcludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"#Requires -Module Ansible.ModuleUtils.AddType"
powershell.file.script_block_texteqAnsible.Windows.Setupexcludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"Ansible.Windows.Setup"
powershell.file.script_block_texteqNativeMethods.NetWkstaGetInfo(null, 100, out netBuffer);excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"NativeMethods.NetWkstaGetInfo(null, 100, out netBuffer);"
powershell.file.script_block_texteqDiscoverWindowsComputerProperties.ps1excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"DiscoverWindowsComputerProperties.ps1"
powershell.file.script_block_texteqDsGetSiteNameexcludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"DsGetSiteName"
powershell.file.script_block_texteqparam($SourceType, $SourceId, $ManagedEntityId, $ComputerIdentity)excludes:powershell.file.script_block_text field:"powershell.file.script_block_text" value:"param($SourceType, $SourceId, $ManagedEntityId, $ComputerIdentity)"
file.directoryeqC:\Program Files (x86)\Automox\WDK\Win32\WinSessionexcludes:file.directory field:"file.directory" value:"C:\Program Files (x86)\Automox\WDK\Win32\WinSession"

Ransomware - Prevented - Elastic Defend

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

Generates a detection alert each time an Elastic Defend alert for ransomware are received. Enabling this rule allows you to immediately begin investigating your Endpoint ransomware alerts. This rule identifies Elastic Defend ransomware preventions only, and does not include detection only alerts.

MITRE ATT&CK Coverage

TacticTechniques
Impact

Rule Body

[metadata]
creation_date = "2024/03/24"
integration = ["endpoint"]
maturity = "production"
promotion = true
updated_date = "2025/07/02"

[rule]
author = ["Elastic"]
description = """
Generates a detection alert each time an Elastic Defend alert for ransomware are received. Enabling this rule allows you
to immediately begin investigating your Endpoint ransomware alerts. This rule identifies Elastic Defend ransomware
preventions only, and does not include detection only alerts.
"""
enabled = false
from = "now-2m"
index = ["logs-endpoint.alerts-*"]
interval = "1m"
language = "kuery"
license = "Elastic License v2"
max_signals = 1000
name = "Ransomware - Prevented - Elastic Defend"
note = """## Triage and analysis

### Investigating Ransomware - Prevented - Elastic Defend

Ransomware protection adds a dedicated layer of detection and prevention against ransomware attacks. Our Ransomware protection consists of 3 subtypes: `behavioral`, `canary files`, and `MBR`. Our behavioral ransomware protection monitors the low level file system activity of all processes on the system to identify generic file encryption techniques. We include signals such as file header information, entropy calculations, known and suspicious extensions, and more to make verdicts. Canary files serve as a high confidence short-cut to other behavior techniques. Our endpoint places hidden files in select directories on the system and will trigger on any process attempting to tamper with the files. Finally, we protect the Master Boot Record (MBR) with our kernel minifilter driver to prevent this type of ransomware attack.

Generally, our ransomware protection is tuned to have extremely low false positives rates. We understand how alarming and disruptive ransomware false positives can be which has factored into its design goals. More likely than not, if this protection fires, it is a true positive. However, certain categories of software do behave similarly to ransomware from the perspective of this protection. That includes installers and backup software, which can make a large number of modifications to documents (especially during a restore operation). Further, encryption or system utilities which modify the system’s MBR may also trigger our MBR protection.

### Possible investigation steps

- The `Ransomware.files` field provides details about files modification (paths, entropy, extension and file headers).
- Investigate the metadata and the activity of the process or processes that triggered the alert.
- Assess whether this activity is prevalent in your environment by looking for similar occurrences across hosts.
- Some Ransomware attacks tend to execute the operation on multiple hosts at the same time for maximum impact.
- Verify the activity of the `user.name` associated with the alert (local or remote actity, privileged or standard user).
- Quickly identifying the compromised credentials is critical to remediate Ransomware attacks.
- Verify if there are any other alert types (Behavior or Memory Threat) associated with the same host or user or process within the same time.

### False positive analysis

- Installers and backup software, which can make a large number of modifications to documents (especially during a restore operation).
- Encryption or system utilities which modify the system’s MBR may also trigger our MBR protection.

### Response and Remediation

- Immediate Isolation and Containment: Quickly disconnect affected systems from the network, including both wired and wireless connections, to prevent the ransomware from spreading. This includes disabling network cards and removing network cables if necessary, while keeping the systems powered on for forensic purposes.
- Activate Incident Response Team and Plan: Assemble your incident response team and implement your incident response plan. Contact necessary stakeholders including IT security, legal counsel, and executive management. Document all actions taken from the moment of detection.
Initial Assessment and Evidence Preservation: Identify the scope of the infection and the type of ransomware.
- Take screenshots of ransom messages and create disk images of affected systems. Record all observable indicators of compromise (IOCs) before any remediation begins.
- Business Impact Analysis: Evaluate which critical business operations are affected and establish priority systems for recovery. Determine regulatory reporting requirements based on the type of data potentially compromised.
- Secure Backup Verification: Identify and verify the integrity of your latest clean backups. Check backup systems for potential compromise and ensure they were disconnected during the attack to prevent encryption of backup data.
- System Recovery Preparation: Build a clean environment for recovery operations, including secured networks and validated clean systems. Prepare tools and resources needed for system restoration.
- Malware Eradication: Remove the ransomware from infected systems using appropriate security tools. This may involve complete system rebuilds from known clean sources rather than attempting to clean infected systems.
- Data Restoration: Begin restoring systems from verified clean backups, starting with the most critical business operations. Implement additional security controls and monitoring during the restoration process.
- Security Posture Strengthening: Update all security systems including firewalls, antivirus, and endpoint protection. Reset all credentials across the organization and implement additional access controls like multi-factor authentication where needed.
- Post-Incident Activities: Conduct a detailed post-incident analysis to identify how the ransomware entered the environment. Update security policies and incident response plans based on lessons learned, and provide additional security awareness training to staff.
"""
references = [
    "https://github.com/elastic/protections-artifacts/tree/main/ransomware",
    "https://docs.elastic.co/en/integrations/endpoint",
]
risk_score = 73
rule_id = "10f3d520-ea35-11ee-a417-f661ea17fbce"
rule_name_override = "message"
setup = """## Setup

### Elastic Defend Alerts
This rule is designed to capture specific alerts generated by Elastic Defend.

To capture all the Elastic Defend alerts, it is recommended to use all of the Elastic Defend feature-specific protection rules:

Behavior - Detected - Elastic Defend (UUID: 0f615fe4-eaa2-11ee-ae33-f661ea17fbce)
Behavior - Prevented - Elastic Defend (UUID: eb804972-ea34-11ee-a417-f661ea17fbce)
Malicious File - Detected - Elastic Defend (UUID: f2c3caa6-ea34-11ee-a417-f661ea17fbce)
Malicious File - Prevented - Elastic Defend (UUID: f87e6122-ea34-11ee-a417-f661ea17fbce)
Memory Threat - Detected - Elastic Defend (UUID: 017de1e4-ea35-11ee-a417-f661ea17fbce)
Memory Threat - Prevented - Elastic Defend (UUID: 06f3a26c-ea35-11ee-a417-f661ea17fbce)
Ransomware - Detected - Elastic Defend (UUID: 0c74cd7e-ea35-11ee-a417-f661ea17fbce)
Ransomware - Prevented - Elastic Defend (UUID: 10f3d520-ea35-11ee-a417-f661ea17fbce)

To avoid generating duplicate alerts, you should enable either all feature-specific protection rules or the Endpoint Security (Elastic Defend) rule (UUID: 9a1a2dae-0b5f-4c3d-8305-a268d404c306).

### Additional notes

For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "high"
tags = ["Data Source: Elastic Defend", "Tactic: Impact", "Resources: Investigation Guide"]
timestamp_override = "event.ingested"
type = "query"

query = '''
event.kind : alert and event.code : ransomware and event.type : denied and event.outcome : success
'''


[[rule.exceptions_list]]
id = "endpoint_list"
list_id = "endpoint_list"
namespace_type = "agnostic"
type = "endpoint"

[[rule.risk_score_mapping]]
field = "event.risk_score"
operator = "equals"
value = ""

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "low"
value = "21"

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "medium"
value = "47"

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "high"
value = "73"

[[rule.severity_mapping]]
field = "event.severity"
operator = "equals"
severity = "critical"
value = "99"

[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1486"
name = "Data Encrypted for Impact"
reference = "https://attack.mitre.org/techniques/T1486/"


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

Stages and Predicates

Stage 1: query

event.kind : alert and event.code : ransomware and event.type : denied and event.outcome : success

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.codeeq
  • ransomware corpus 2 (elastic 2)
field:"EventID" kind:eq value:"ransomware"
event.kindeq
  • alert corpus 35 (elastic 35)
field:"event.kind" kind:eq value:"alert"
event.outcomeeq
  • success corpus 306 (elastic 306)
field:"event.outcome" kind:eq value:"success"
event.typeeq
  • denied corpus 8 (elastic 8)
field:"event.type" kind:eq value:"denied"

Rapid7 Threat Command CVEs Correlation

#
Status
production
Severity
high
Group by
vulnerability.id
Author
Elastic
Source
github.com/elastic/detection-rules

This rule is triggered when CVEs collected from the Rapid7 Threat Command Integration have a match against vulnerabilities that were found in the customer environment.

Rule Body

[metadata]
creation_date = "2024/05/29"
integration = ["ti_rapid7_threat_command"]
maturity = "production"
updated_date = "2025/04/22"

[rule]
author = ["Elastic"]
description = """
This rule is triggered when CVEs collected from the Rapid7 Threat Command Integration have a match against
vulnerabilities that were found in the customer environment.
"""
from = "now-35m"
index = ["auditbeat-*", "endgame-*", "filebeat-*", "logs-*", "packetbeat-*", "winlogbeat-*"]
interval = "30m"
language = "kuery"
license = "Elastic License v2"
max_signals = 1000
name = "Rapid7 Threat Command CVEs Correlation"
note = """## Triage and analysis

### Investigating Rapid7 Threat Command CVEs Correlation

Rapid7 Threat Command CVEs Correlation rule allows matching CVEs from user indices within the vulnerabilities collected from Rapid7 Threat Command integrations.

The matches will be based on the latest values of CVEs from the last 180 days. So it's essential to validate the data and review the results by investigating the associated activity to determine if it requires further investigation.

If a vulnerability matches a local observation, the following enriched fields will be generated to identify the vulnerability, field, and type matched.

- `threat.indicator.matched.atomic` - this identifies the atomic vulnerability that matched the local observation
- `threat.indicator.matched.field` - this identifies the vulnerability field that matched the local observation
- `threat.indicator.matched.type` - this identifies the vulnerability type that matched the local observation

Additional investigation can be done by reviewing the source of the activity and considering the history of the vulnerability that was matched. This can help understand if the activity is related to legitimate behavior.

- Investigation can be validated and reviewed based on the data that was matched and by viewing the source of that activity.
- Consider the history of the vulnerability that was matched. Has it happened before? Is it happening on multiple machines? These kinds of questions can help understand if the activity is related to legitimate behavior.
- Consider the user and their role within the company: is this something related to their job or work function?
"""
references = [
    "https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-threatintel.html",
    "https://docs.elastic.co/integrations/ti_rapid7_threat_command",
]
risk_score = 73
rule_id = "3a657da0-1df2-11ef-a327-f661ea17fbcc"
setup = """
## Setup

This rule needs threat intelligence indicators to work.
Threat intelligence indicators can be collected using an [Elastic Agent integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#agent-ti-integration),
the [Threat Intel module](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#ti-mod-integration),
or a [custom integration](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html#custom-ti-integration).

More information can be found [here](https://www.elastic.co/guide/en/security/current/es-threat-intel-integrations.html).

### Additional notes

For information on troubleshooting the maximum alerts warning please refer to this [guide](https://www.elastic.co/guide/en/security/current/alerts-ui-monitor.html#troubleshoot-max-alerts).
"""
severity = "high"
tags = [
    "OS: Windows",
    "Data Source: Elastic Endgame",
    "Data Source: Windows",
    "Data Source: Network",
    "Data Source: Rapid7 Threat Command",
    "Rule Type: Threat Match",
    "Resources: Investigation Guide",
    "Use Case: Vulnerability",
    "Use Case: Asset Visibility",
    "Use Case: Continuous Monitoring",
]
threat_index = ["logs-ti_rapid7_threat_command_latest.vulnerability"]
threat_indicator_path = "rapid7.tc.vulnerability"
threat_language = "kuery"
timestamp_override = "event.ingested"
type = "threat_match"

query = '''
vulnerability.id : *
'''



threat_query = '''
@timestamp >= "now-30d/d" and vulnerability.id : * and event.module: ti_rapid7_threat_command
'''


[[rule.filters]]

[rule.filters."$state"]
store = "appState"
[rule.filters.meta]
disabled = false
key = "rapid7.tc.vulnerability.id"
negate = true
type = "exists"
[rule.filters.query.exists]
field = "rapid7.tc.vulnerability.id"
[[rule.threat_mapping]]

[[rule.threat_mapping.entries]]
field = "vulnerability.id"
type = "mapping"
value = "vulnerability.id"


Stages and Predicates

Stage 1: threat_match:event

vulnerability.id:*

Stage 2: threat_match:indicator

@timestamp >= "now-30d/d" and event.module:"ti_rapid7_threat_command" and vulnerability.id:*

Indicators

These rows show field, operator, and value matches.

Sensitive File Copy via Ditto

#
Source
github.com/elastic/protections-artifacts

Detects ditto binary copying sensitive files like keychains, browser data, and shell history. This technique is used by malware for credential harvesting and data collection.

MITRE ATT&CK Coverage

TacticTechniques
Collection

Telemetry Coverage

Rule Body

[rule]
description = """
Detects ditto binary copying sensitive files like keychains, browser data, and shell history. This technique is used by
malware for credential harvesting and data collection.
"""
id = "b1cf09db-d619-49f8-96cf-ff82abaac79f"
license = "Elastic License v2"
name = "Sensitive File Copy via Ditto"
os_list = ["macos"]
reference = [
    "https://www.sentinelone.com/labs/macos-nimdoor-dprk-threat-actors-target-web3-and-crypto-platforms-with-nim-based-malware/",
]
version = "1.0.3"

query = '''
process where event.type == "start" and event.action == "exec" and process.name == "ditto" and 
 process.args_count == 3 and process.args like~ ("/Users/*/Library/Application Support/Google/Chrome/Default/*",
                                                 "/Library/Keychains/System.keychain", 
                                                 "/Users/*/Library/Keychains/login.keychain-db", 
                                                 "/Users/*/.zsh_history", 
                                                 "/Users/*/.bash_history")
'''

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1005"
name = "Data from Local System"
reference = "https://attack.mitre.org/techniques/T1005/"


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

[internal]
min_endpoint_version = "8.11.1"

Stages and Predicates

Stage 1: process

process where event.type == "start" and event.action == "exec" and process.name == "ditto" and 
 process.args_count == 3 and process.args like~ ("/Users/*/Library/Application Support/Google/Chrome/Default/*",
                                                 "/Library/Keychains/System.keychain", 
                                                 "/Users/*/Library/Keychains/login.keychain-db", 
                                                 "/Users/*/.zsh_history", 
                                                 "/Users/*/.bash_history")

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.argswildcard
  • /Library/Keychains/System.keychain
  • /Users/*/.bash_history corpus 2 (elastic 2)
  • /Users/*/.zsh_history corpus 2 (elastic 2)
  • /Users/*/Library/Application Support/Google/Chrome/Default/*
  • /Users/*/Library/Keychains/login.keychain-db
field:"process.args" kind:wildcard
process.args_counteq
  • 3 transforms: number corpus 22 (elastic 22)
field:"process.args_count" kind:eq value:"3"
process.nameeq
  • ditto corpus 2 (elastic 2)
field:"process_basename" kind:eq value:"ditto"

SIP Provider Modification

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

Identifies modifications to the registered Subject Interface Package (SIP) providers. SIP providers are used by the Windows cryptographic system to validate file signatures on the system. This may be an attempt to bypass signature validation checks or inject code into critical processes.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2021/01/20"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"

[rule]
author = ["Elastic"]
description = """
Identifies modifications to the registered Subject Interface Package (SIP) providers. SIP providers are used by the
Windows cryptographic system to validate file signatures on the system. This may be an attempt to bypass signature
validation checks or inject code into critical processes.
"""
from = "now-9m"
index = [
    "logs-endpoint.events.registry-*",
    "endgame-*",
    "logs-windows.sysmon_operational-*",
    "winlogbeat-*",
    "logs-m365_defender.event-*",
    "logs-sentinel_one_cloud_funnel.*",
    "logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "SIP Provider Modification"
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 SIP Provider Modification

Subject Interface Package (SIP) providers are integral to Windows' cryptographic system, ensuring file signature validation. Adversaries may modify SIP providers to bypass these checks, facilitating unauthorized code execution. The detection rule identifies suspicious registry changes linked to SIP providers, excluding benign processes, to flag potential defense evasion attempts.

### Possible investigation steps

- Review the registry path and value changes to confirm if they match the suspicious patterns specified in the query, such as modifications under the paths related to CryptSIPDllPutSignedDataMsg or Trust FinalPolicy.
- Identify the process responsible for the registry change by examining the process name and compare it against the exclusions in the query, ensuring it is not a benign process like msiexec.exe or regsvr32.exe.
- Investigate the DLL file specified in the registry change to determine its legitimacy, checking its digital signature and origin.
- Correlate the event with other security logs or alerts from data sources like Sysmon or Microsoft Defender XDR to identify any related suspicious activities or patterns.
- Assess the risk context by considering the host's role and any recent changes or incidents that might explain the registry modification, ensuring it aligns with expected behavior or authorized changes.

### False positive analysis

- Installation or update processes like msiexec.exe may trigger registry changes as part of legitimate software installations. Exclude these by adding exceptions for msiexec.exe when registry data strings include mso.dll.
- System maintenance tasks using regsvr32.exe might modify SIP provider-related registry entries. Exclude regsvr32.exe when registry data strings match WINTRUST.DLL to prevent false alerts.
- Regular updates or patches from trusted software vendors may alter SIP provider registry entries. Monitor and document these changes to establish a baseline of expected behavior, allowing for informed exclusions.
- Security software or endpoint protection solutions might interact with SIP provider settings as part of their normal operation. Identify and whitelist these processes to reduce unnecessary alerts.
- Custom enterprise applications with legitimate needs to modify cryptographic settings should be reviewed and, if verified as safe, added to an exclusion list to prevent disruption.

### Response and remediation

- Immediately isolate the affected system from the network to prevent further unauthorized access or code execution.
- Terminate any suspicious processes identified in the alert, such as those not typically associated with legitimate SIP provider modifications.
- Restore the modified registry entries to their original state using a known good backup or by manually correcting the entries to ensure the integrity of the SIP providers.
- Conduct a thorough scan of the affected system using updated antivirus and anti-malware tools to identify and remove any malicious software that may have been introduced.
- Review and update endpoint protection policies to ensure that similar unauthorized modifications are detected and blocked in the future.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
- Document the incident details, including the steps taken for containment and remediation, to enhance future response efforts and update threat intelligence databases."""
references = ["https://github.com/mattifestation/PoCSubjectInterfacePackage"]
risk_score = 47
rule_id = "f2c7b914-eda3-40c2-96ac-d23ef91776ca"
severity = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Use Case: Threat Detection",
    "Tactic: Defense Evasion",
    "Data Source: Elastic Endgame",
    "Data Source: Elastic Defend",
    "Data Source: Sysmon",
    "Data Source: Microsoft Defender XDR",
    "Data Source: SentinelOne",
    "Data Source: Crowdstrike",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
registry where host.os.type == "windows" and event.type == "change" and registry.value : ("Dll", "$Dll") and
  registry.path: (
    "*\\SOFTWARE\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllPutSignedDataMsg\\{*}\\Dll",
    "*\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllPutSignedDataMsg\\{*}\\Dll",
    "*\\SOFTWARE\\Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{*}\\$Dll",
    "*\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{*}\\$Dll"
    ) and
  registry.data.strings:"*.dll" and
  not (process.name : "msiexec.exe" and registry.data.strings : "mso.dll") and
  not (process.name : "regsvr32.exe" and registry.data.strings == "WINTRUST.DLL")
'''

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 Registry Events](https://ela.st/sysmon-event-reg-setup)
"""


[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"
[[rule.threat.technique.subtechnique]]
id = "T1553.003"
name = "SIP and Trust Provider Hijacking"
reference = "https://attack.mitre.org/techniques/T1553/003/"



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

Stages and Predicates

Stage 1: registry

registry where host.os.type == "windows" and event.type == "change" and registry.value : ("Dll", "$Dll") and
  registry.path: (
    "*\\SOFTWARE\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllPutSignedDataMsg\\{*}\\Dll",
    "*\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptSIPDllPutSignedDataMsg\\{*}\\Dll",
    "*\\SOFTWARE\\Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{*}\\$Dll",
    "*\\SOFTWARE\\WOW6432Node\\Microsoft\\Cryptography\\Providers\\Trust\\FinalPolicy\\{*}\\$Dll"
    ) and
  registry.data.strings:"*.dll" and
  not (process.name : "msiexec.exe" and registry.data.strings : "mso.dll") and
  not (process.name : "regsvr32.exe" and registry.data.strings == "WINTRUST.DLL")

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • change corpus 89 (elastic 89)
field:"event.type" kind:eq value:"change"
registry.data.stringswildcard
  • *.dll corpus 9 (sigma 4, elastic 4, splunk 1)
field:"Details" kind:wildcard value:"*.dll"
registry.pathwildcard
  • *\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptSIPDllPutSignedDataMsg\{*}\Dll
  • *\SOFTWARE\Microsoft\Cryptography\Providers\Trust\FinalPolicy\{*}\$Dll
  • *\SOFTWARE\WOW6432Node\Microsoft\Cryptography\OID\EncodingType 0\CryptSIPDllPutSignedDataMsg\{*}\Dll
  • *\SOFTWARE\WOW6432Node\Microsoft\Cryptography\Providers\Trust\FinalPolicy\{*}\$Dll
field:"TargetObject" kind:wildcard
registry.valuewildcard
  • $Dll
  • Dll corpus 2 (elastic 2)
field:"registry_value_name" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Suspicious Curl from macOS Application

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

Detects the use of curl by a macOS application binary to connect to a raw IP URI and download a second stage payload. Threat actors often utilize a benign looking or legitimate application as a first stage dropper. Curl is commonly used as it doesn't enforce Gatekeeper checks.

MITRE ATT&CK Coverage

Telemetry Coverage

Rule Body

[metadata]
creation_date = "2026/01/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/08/03"

[rule]
author = ["Elastic"]
description = """
Detects the use of curl by a macOS application binary to connect to a raw IP URI and download a second 
stage payload. Threat actors often utilize a benign looking or legitimate application as a first stage 
dropper. Curl is commonly used as it doesn't enforce Gatekeeper checks.
"""
from = "now-9m"
index = ["logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Curl from macOS Application"
references = [
    "https://objective-see.org/blog/blog_0x71.html#-vpn-trojan-covid",
    "https://attack.mitre.org/techniques/T1105/"
]
risk_score = 73
rule_id = "6da6f80f-fe41-4814-8010-453e6164bd40"
severity = "high"
tags = [
    "Domain: Endpoint",
    "OS: macOS",
    "Use Case: Threat Detection",
    "Tactic: Command and Control",
    "Data Source: Elastic Defend",
    "Resources: Investigation Guide"
]
timestamp_override = "event.ingested"
type = "eql"
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 Suspicious Curl from macOS Application

Trojanized macOS applications often use curl to download second-stage payloads from attacker-controlled infrastructure. By leveraging curl instead of direct downloads, these malicious applications can bypass Gatekeeper quarantine checks and evade built-in macOS security mechanisms. This detection rule identifies when applications from the /Applications directory spawn curl to connect to raw IP addresses, which is highly indicative of malicious payload retrieval activity.

### Possible investigation steps

- Review the process.Ext.effective_parent.executable field to identify which application spawned the curl process and assess whether this application is expected to make network downloads.
- Examine the process.args fields to extract the destination IP address and URL path being accessed, and research these indicators in threat intelligence databases.
- Analyze the process.parent.command_line to understand the full context of how curl was invoked, including any output file paths that may indicate where payloads were written.
- Check the code signature of the parent application using the process.code_signature fields to determine if it is validly signed and if the signature matches known good versions.
- Investigate the origin of the suspicious application by reviewing installation logs, download history, and any recent DMG or PKG files that may have delivered the trojanized application.
- Search for any files created on disk around the time of the curl execution to identify downloaded payloads that may have been staged for execution.
- Correlate with other events on the same host to identify if the downloaded payload was subsequently executed.

### False positive analysis

- Some legitimate applications may use curl for software updates or telemetry data collection. Verify the destination IP against the application vendor's known infrastructure.
- Development tools and IDEs may download dependencies or packages via curl during normal operations. Review the context and confirm with development teams.
- Homebrew and package managers may spawn curl from application contexts during installations. Verify if package management activities were expected.
- Add verified legitimate applications to the exclusion list in the query after confirming their behavior is expected.

### Response and remediation

- Immediately quarantine the suspicious application by moving it to a secure location and removing it from /Applications to prevent further execution.
- Block the destination IP address at the network perimeter and on endpoint firewalls to prevent additional downloads.
- Search the file system for any payloads that may have been downloaded and quarantine them for analysis.
- Conduct a full malware scan on the affected system to identify any persistence mechanisms or additional malware components.
- Report the trojanized application to Apple Security and relevant threat intelligence sharing platforms.
- Review other systems in the environment for the same trojanized application to determine the scope of potential compromise.
- Investigate the delivery mechanism to understand how the trojanized application was installed and prevent future infections.
"""
query = '''
process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and 
  process.name in ("curl", "nscurl") and 
  process.args in ("-o", "--output", "--download", "-dl", "-dir", "--directory") and
  process.args regex~ """https?:\/\/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]{1,5})?\/.*""" and 
  process.parent.name like~ ("bash", "sh", "zsh", "osascript", "tclsh*", "python*") and
  process.Ext.effective_parent.executable like "/Applications/*" and
  process.args_count <= 10 and 
  not process.args like "/Applications/*" and
  not process.Ext.effective_parent.executable in ("/Applications/iTerm.app/Contents/MacOS/iTerm2",
                                                   "/Applications/Visual Studio Code.app/Contents/MacOS/Electron", 
                                                   "/Applications/Warp.app/Contents/MacOS/stable")
'''

[[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.subtechnique]]
id = "T1071.001"
name = "Web Protocols"
reference = "https://attack.mitre.org/techniques/T1071/001/"

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

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

[[rule.threat.technique]]
id = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"

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

[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 == "macos" and event.type == "start" and event.action == "exec" and 
  process.name in ("curl", "nscurl") and 
  process.args in ("-o", "--output", "--download", "-dl", "-dir", "--directory") and
  process.args regex~ """https?:\/\/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]{1,5})?\/.*""" and 
  process.parent.name like~ ("bash", "sh", "zsh", "osascript", "tclsh*", "python*") and
  process.Ext.effective_parent.executable like "/Applications/*" and
  process.args_count <= 10 and 
  not process.args like "/Applications/*" and
  not process.Ext.effective_parent.executable in ("/Applications/iTerm.app/Contents/MacOS/iTerm2",
                                                   "/Applications/Visual Studio Code.app/Contents/MacOS/Electron", 
                                                   "/Applications/Warp.app/Contents/MacOS/stable")

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.Ext.effective_parent.executablewildcard
  • /Applications/*
field:"process.Ext.effective_parent.executable" kind:wildcard value:"/Applications/*"
process.argsin
  • --directory corpus 3 (elastic 3)
  • --download corpus 4 (elastic 4)
  • --output corpus 11 (elastic 11)
  • -dir corpus 3 (elastic 3)
  • -dl corpus 4 (elastic 4)
  • -o corpus 17 (elastic 17)
field:"process.args" kind:in
process.argsregex_match
  • https?:\/\/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}(:[0-9]{1,5})?\/.*
field:"process.args" kind:regex_match value:"https?:\/\/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}(:[0-9]{1,5})?\/.*"
process.args_countle
  • 10 transforms: number
field:"process.args_count" kind:le value:"10"
process.namein
  • curl corpus 82 (elastic 82)
  • nscurl corpus 41 (elastic 41)
field:"process_basename" kind:in
process.parent.namewildcard
  • bash corpus 14 (elastic 14)
  • osascript corpus 12 (elastic 12)
  • python* corpus 20 (elastic 20)
  • sh corpus 14 (elastic 14)
  • tclsh* corpus 6 (elastic 6)
  • zsh corpus 14 (elastic 14)
field:"parent_process_basename" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Suspicious File Quarantine Removal via Find

#
Time window
3s
Sequence by
Effective_process.entity_id, process.parent.entity_id
Source
github.com/elastic/protections-artifacts

Detects when the Find command is executed with the exec option in order to execute the Xattr command for removal of the file quarantine bit.

MITRE ATT&CK Coverage

TacticTechniques
Defense Impairment

Telemetry Coverage

Rule Body

[rule]
description = """
Detects when the Find command is executed with the exec option in order to execute the Xattr command for removal of the
file quarantine bit.
"""
id = "c43102bc-f307-48a4-bfc5-a02444b3fed2"
license = "Elastic License v2"
name = "Suspicious File Quarantine Removal via Find"
os_list = ["macos"]
version = "1.0.4"

query = '''
sequence with maxspan=3s
[process where event.type == "start" and event.action == "exec" and process.name == "find" and 
  process.args in~ ("-exec", "-execdir") and 
  process.args like~ "*com.apple.quarantine*"] by process.parent.entity_id
[file where event.action == "extended_attributes_delete" and 
  process.executable like "/usr/bin/xattr"] by Effective_process.entity_id
'''

min_endpoint_version = "8.11.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "Effective_process.entity_id"
state = 1

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1553"
name = "Subvert Trust Controls"
reference = "https://attack.mitre.org/techniques/T1553/"
[[threat.technique.subtechnique]]
id = "T1553.001"
name = "Gatekeeper Bypass"
reference = "https://attack.mitre.org/techniques/T1553/001/"



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

[internal]
min_endpoint_version = "8.11.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 3s, correlated by Effective_process.entity_id, process.parent.entity_id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and process.name == "find" and 
  process.args in~ ("-exec", "-execdir") and 
  process.args like~ "*com.apple.quarantine*"] by process.parent.entity_id

Stage 2: file

[file where event.action == "extended_attributes_delete" and 
  process.executable like "/usr/bin/xattr"] by Effective_process.entity_id

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec corpus 547 (elastic 547)
  • extended_attributes_delete corpus 3 (elastic 3)
field:"EventType" kind:eq
event.typeeq
  • start corpus 1036 (elastic 1036)
field:"event.type" kind:eq value:"start"
process.argsin
  • -exec
  • -execdir
field:"process.args" kind:in
process.argswildcard
  • *com.apple.quarantine*
field:"process.args" kind:wildcard value:"*com.apple.quarantine*"
process.executablewildcard
  • /usr/bin/xattr
field:"Image" kind:wildcard value:"/usr/bin/xattr"
process.nameeq
  • find corpus 8 (elastic 8)
field:"process_basename" kind:eq value:"find"

Suspicious Lua Command Execution

#
Source
github.com/elastic/protections-artifacts

This rule monitors for suspicious Lua command executions by detecting the start of a Lua process with a command line argument that contains keywords commonly used by attackers to execute malicious code. These command line arguments include operations to execute code, create subprocesses, and encode or decode data.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
This rule monitors for suspicious Lua command executions by detecting the start of a Lua process with a command line
argument that contains keywords commonly used by attackers to execute malicious code. These command line arguments
include operations to execute code, create subprocesses, and encode or decode data.
"""
id = "5383342f-7ddd-46c6-90dc-349499df90f1"
license = "Elastic License v2"
name = "Suspicious Lua Command Execution"
os_list = ["linux"]
version = "1.0.5"

query = '''
process where event.type == "start" and event.action == "exec" and
process.executable like ("/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*") and
process.args == "-e" and process.command_line like~ (
  "*os.execute(*", "*io.popen(*", "*load(*", "*loadstring(*", "*dofile(*",
  "*package.loadlib(*", "*base64.decode(*", "*base64.encode(*", "*zlib.inflate(*",
  "*zlib.deflate(*", "*zlib.decompress(*", "*zlib.compress(*", "*socket.bind(*",
  "*socket.connect(*", "*socket.receive(*", "*socket.send(*", "*socket.tcp(*",
  "*socket.udp(*", "*socket.listen(*", "*socket.accept(*", "*net.http.request(*",
  "*net.http.get(*", "*net.http.post(*", "*http.request(*", "*http.get(*", "*http.post(*"
) and not (
  process.parent.name in ("make", "configure") or
  process.command_line in ("lua -e require('cjson')", "lua -e require('socket')") or
  process.command_line like "*no_such_lib*"
)
'''

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

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

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



[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.executable like ("/bin/lua*", "/usr/bin/lua*", "/usr/local/bin/lua*") and
process.args == "-e" and process.command_line like~ (
  "*os.execute(*", "*io.popen(*", "*load(*", "*loadstring(*", "*dofile(*",
  "*package.loadlib(*", "*base64.decode(*", "*base64.encode(*", "*zlib.inflate(*",
  "*zlib.deflate(*", "*zlib.decompress(*", "*zlib.compress(*", "*socket.bind(*",
  "*socket.connect(*", "*socket.receive(*", "*socket.send(*", "*socket.tcp(*",
  "*socket.udp(*", "*socket.listen(*", "*socket.accept(*", "*net.http.request(*",
  "*net.http.get(*", "*net.http.post(*", "*http.request(*", "*http.get(*", "*http.post(*"
) and not (
  process.parent.name in ("make", "configure") or
  process.command_line in ("lua -e require('cjson')", "lua -e require('socket')") or
  process.command_line like "*no_such_lib*"
)

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.argseq
  • -e
field:"process.args" kind:eq value:"-e"
process.command_linewildcard
  • *base64.decode(*
  • *base64.encode(*
  • *dofile(*
  • *http.get(*
  • *http.post(*
  • *http.request(*
  • *io.popen(*
  • *load(*
  • *loadstring(*
  • *net.http.get(*
  • *net.http.post(*
  • *net.http.request(*
  • *os.execute(*
  • *package.loadlib(*
  • *socket.accept(*
  • *socket.bind(*
  • *socket.connect(*
  • *socket.listen(*
  • *socket.receive(*
  • *socket.send(*
  • *socket.tcp(*
  • *socket.udp(*
  • *zlib.compress(*
  • *zlib.decompress(*
  • *zlib.deflate(*
  • *zlib.inflate(*
field:"CommandLine" kind:wildcard
process.executablewildcard
  • /bin/lua*
  • /usr/bin/lua*
  • /usr/local/bin/lua*
field:"Image" kind:wildcard

Exclusions

The rule actively suppresses these predicates.

Suspicious OpenSSL Execution via macOS Application

#
Time window
30s
Sequence by
process.parent.entity_id
Source
github.com/elastic/protections-artifacts

Detects a suspicious sequence of events where a shell (bash, sh, or zsh) is used to launch an application from the /Applications directory, followed by the execution of the 'openssl' command. This pattern could indicate potential malicious activity, such as a shell script attempting to use openssl to perform encryption or decryption operations, exfiltrating sensitive data, or interacting with command and control servers. Monitoring for such sequences can help identify potentially compromised systems or unauthorized activities. This rule alerts on Shlayer malware activity.

MITRE ATT&CK Coverage

Rule Body

[rule]
description = """
Detects a suspicious sequence of events where a shell (bash, sh, or zsh) is used to launch an application from the
/Applications directory, followed by the execution of the 'openssl' command. This pattern could indicate potential
malicious activity, such as a shell script attempting to use openssl to perform encryption or decryption operations,
exfiltrating sensitive data, or interacting with command and control servers. Monitoring for such sequences can help
identify potentially compromised systems or unauthorized activities. This rule alerts on Shlayer malware activity.
"""
id = "8f00ad1b-d04a-466e-819b-39cd2a80b877"
license = "Elastic License v2"
name = "Suspicious OpenSSL Execution via macOS Application"
os_list = ["macos"]
reference = ["https://objective-see.org/blog/blog_0x70.html", "https://attack.mitre.org/techniques/T1140/"]
version = "1.0.20"

query = '''
sequence by process.parent.entity_id with maxspan=30s
[process where event.type == "start" and (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
  process.args like ("*/bin/bash", "*/bin/sh", "*/bin/zsh", "*/bin/dash", "*/bin/csh", "*/bin/tcsh", "*/bin/ksh", "*/bin/tclsh*", "*/bin/fish") and
  process.args like ("/Applications/*", "/Volumes/*") and
  process.args_count <= 2] 
[process where event.type == "start" and process.name == "openssl" and
  not process.parent.executable like "/Library/PrivilegedHelperTools/com.amazonaws.acvc.helper" and
  not process.Ext.effective_parent.executable like ("/usr/local/jamf/*",
                                                    "/Applications/AWS VPN Client/AWS VPN Client.app/Contents/Resources/openvpn/openssl",
                                                    "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon")]
'''

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

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

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


[[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 = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"

[[threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"


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

[internal]
min_endpoint_version = "8.5.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 30s, correlated by process.parent.entity_id.

Stage 1: process

[process where event.type == "start" and (process.name in ("bash", "sh", "zsh", "dash", "csh", "tcsh", "ksh", "tclsh", "fish") or process.name like "tclsh*") and
  process.args like ("*/bin/bash", "*/bin/sh", "*/bin/zsh", "*/bin/dash", "*/bin/csh", "*/bin/tcsh", "*/bin/ksh", "*/bin/tclsh*", "*/bin/fish") and
  process.args like ("/Applications/*", "/Volumes/*") and
  process.args_count <= 2]

Stage 2: process

[process where event.type == "start" and process.name == "openssl" and
  not process.parent.executable like "/Library/PrivilegedHelperTools/com.amazonaws.acvc.helper" and
  not process.Ext.effective_parent.executable like ("/usr/local/jamf/*",
                                                    "/Applications/AWS VPN Client/AWS VPN Client.app/Contents/Resources/openvpn/openssl",
                                                    "/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon")]

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argswildcard
  • */bin/bash
  • */bin/csh
  • */bin/dash
  • */bin/fish
  • */bin/ksh
  • */bin/sh
  • */bin/tclsh*
  • */bin/tcsh
  • */bin/zsh
  • /Applications/*
  • /Volumes/*
field:"process.args" kind:wildcard
process.args_countle
  • 2 transforms: number
field:"process.args_count" kind:le value:"2"
process.nameeq
  • openssl
field:"process_basename" kind:eq value:"openssl"
process.namein
  • bash
  • csh
  • dash
  • fish
  • ksh
  • sh
  • tclsh
  • tcsh
  • zsh
field:"process_basename" kind:in
process.namewildcard
  • tclsh*
field:"process_basename" kind:wildcard value:"tclsh*"

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.Ext.effective_parent.executablewildcard/usr/local/jamf/*, /Applications/AWS VPN Client/AWS VPN Client.app/Contents/Resources/openvpn/openssl, /Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemonexcludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"/usr/local/jamf/*" field:"process.Ext.effective_parent.executable" value:"/Applications/AWS VPN Client/AWS VPN Client.app/Contents/Resources/openvpn/openssl" field:"process.Ext.effective_parent.executable" value:"/Library/Application Support/JAMF/Jamf.app/Contents/MacOS/JamfDaemon.app/Contents/MacOS/JamfDaemon"
process.parent.executableeq/Library/PrivilegedHelperTools/com.amazonaws.acvc.helperexcludes:process.parent.executable field:"process.parent.executable" value:"/Library/PrivilegedHelperTools/com.amazonaws.acvc.helper"

Suspicious Remote Memory Allocation

#
Source
github.com/elastic/protections-artifacts

Identifies attempts to allocate remote memory with RWX permissions, this behavior is often associated with remote process injection preparation.

MITRE ATT&CK Coverage

TacticTechniques
Stealth

Rule Body

[rule]
description = """
Identifies attempts to allocate remote memory with RWX permissions, this behavior is often associated with remote
process injection preparation.
"""
id = "b2104624-d0e8-4864-8266-605056c6469a"
license = "Elastic License v2"
name = "Suspicious Remote Memory Allocation"
os_list = ["windows"]
reference = [
    "https://www.elastic.co/security-labs/doubling-down-etw-callstacks",
    "https://www.elastic.co/security-labs/pikabot-i-choose-you",
]
version = "1.0.22"

query = '''
api where process.Ext.api.name == "VirtualAllocEx" and process.executable != null and 
  process.Ext.api.parameters.protection == "RWX" and process.Ext.api.parameters.size >= 10000 and 
  process.thread.Ext.call_stack_summary like "?*" and not user.id in ("S-1-5-19", "S-1-5-20") and
  process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
  not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe", "?:\\Windows\\*") and
       process.code_signature.trusted == true and not process.code_signature.subject_name like "Microsoft*") and
  not (process.executable : "?:\\Windows\\System32\\RPC\\OSD\\osdservice.exe" and user.id == "S-1-5-18" and
       process.code_signature.subject_name == "Microsoft Windows Hardware Compatibility Publisher") and
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.symbol_info : ("?:\\Program Files\\*.dll*", 
                                         "?:\\Program Files (x86)\\*.dll*", 
                                         "?:\\windows\\system32\\*\\tmmon*.dll*", 
                                         "?:\\Windows\\SysWOW64\\esensordbi.dll*", 
                                         "?:\\Windows\\System32\\esensordbi.dll*", 
                                         "?:\\Windows\\System32\\umppc*.dll*", 
                                         "?:\\Windows\\FireEye\\AppMonitorDll*.dll*", 
                                         "?:\\Windows\\apppatch\\AppPatch*\\exploitblocker.dll*", 
                                         "?:\\windows\\system32\\hmpalert.dll!*",
                                         "*ntdll.dll!NtCreateUserProcess*",
                                         "*\\kernelbase.dll+0x*",
                                         "?:\\windows\\system32\\wlidsvc.dll!SvchostPushServiceGlobals*",
                                         "?:\\windows\\system32\\appxdeploymentserver.dll!*",
                                         "?:\\windows\\system32\\webruntimemanager.dll!CreateMessagePortEventDispatcher*",
                                         "?:\\windows\\systemapps\\microsoft.aad.brokerplugin_*\\aad.core.dll!DllGetActivationFactory*",
                                         "?:\\windows\\system32\\driverstore\\filerepository\\iigd_dch.inf_amd64_*\\igd12um64icl.dll*")) and
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance like "Kernel*") and
  /* Cynet MemScanner, xSecuritas, Mcafee */
   not _arraysearch(process.thread.Ext.call_stack, $entry,
                    $entry.callsite_trailing_bytes in
                         ("48898424e80300004883bc24e803000000750eff94247e030000898424f0030000eb30488d8c2430010000ff94248e03000048898424e80300004883bc24e803",
                          "8bd885db751eff55c88945f8eb168d8592fdffff50ff55d08bd885db7506ff55c88945f856ff55bc85db0f847601000080bd82fcffff0074508b45fc05a00000",
                          "488b55a8c6420c01833d8bbeb25f007406ff1593c7b25f8945b4488bcce82c000000908b45b4488b55a8c6420c01488b55a8488b8d70ffffff48894a10488d65", 
                          "2048894538488b4d1048c1e103488b7d38488b7550f3a44c8b4d284d8b49484c8b45284d8b4040488b5528488b5220488b4d28488b8988000000ff95a0000000")) and
   not (process.name : "rundll32.exe" and process.parent.executable : "?:\\Users\\*\\AppData\\Local\\Temp\\SNXAC\\STAProxy.exe" and
        process.command_line : "*\\Users\\*\\AppData\\Local\\Temp\\snxac\\*\\sta.dll*") and 
   not (process.code_signature.trusted == true and 
        process.code_signature.subject_name in
              ("GEOVISION INC.", "COMPUTACION EN ACCION SA DE CV", "Crownalytics, LLC", "Johannes Schindelin", 
               "INCA Internet Co.,Ltd.", "Mark Straver", "Micro Systemation AB (publ)", "HardestCodesEst OU",
               "MUSARUBRA US LLC", "Fleischhacker GmbH & Co. KG Laboreinrichtungen Medizintechnik")) and
   not (process.executable : "?:\\Users\\*\\AppData\\Local\\Mozilla Firefox\\firefox.exe" and 
        process.code_signature.subject_name == "Mozilla Corporation" and process.code_signature.trusted == true) and
   not (process.executable : "?:\\Program Files (x86)\\Steam\\steamapps\\common\\*.exe" and process.code_signature.trusted == true) and 
   not (process.executable : "?:\\Program Files (x86)\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe" and 
        process.parent.executable : ("?:\\Windows\\System32\\SecurityHealthSystray.exe", "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\FileCoAuth.exe") and 
        process.Ext.api.summary : "VirtualAllocEx*microsoftedgeupdate.exe,*") and 
   not process.parent.executable :
               ("?:\\Program Files (x86)\\Embarcadero\\Studio\\*\\bin\\bds.exe",
                "?:\\Program Files\\Embarcadero\\Studio\\*\\bin\\bds.exe",
                "?:\\Program Files (x86)\\Microsoft Visual Studio\\*\\Professional\\Common?\\IDE\\devenv.exe") 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",
                                          "FastTrack Software ApS",  "FastTrack Software Aps", "Promon AS", "PC Matic, Inc")) and
   not process.thread.Ext.call_stack_final_user_module.hash.sha256 in ("b4f289b5bf0beb59e7ba8d00b45ffaa582114c22a959bb8912cd8b903748f91b",
                                                                       "b950277c03155ffef055fd2fb6c9afe2022ac6402f8e04ece92f34bedf5bc194",
                                                                       "289ccce952e8a5ad4eae60fbfcfc239a2c6a45386655466ce45f77c9422533da",
                                                                       "8d80ea047a89300017544fc28a402c6f45b7369413c51c7b352af69db503d9bb",
                                                                       "b88d6fdb2641981675e1066f0767a8f263c5c4dcc5fccddbb948cdbe4165aef4",
                                                                       "90db33e5c6f2d0e3f60de07821413a24d31ceec26c83b447ff3a3607ebc67079",
                                                                       "73395b6c3fa9fa73e8e3665f108b3a92c564da9c1b9ce7834832adbb5e658a87",
                                                                       "4a81edc822ee7e6fb1ca1813f4c917f11b4366d33fd55c294d6509b4d4c0d80e",
                                                                       "d355b62cc7dc5b8f3ee5e95a8ddddc818f6f84c5a16799d78b1cb3d786e2bb80",
                                                                       "07d6c3a19a8e3e243e9545a41dd30a9ee1e9ad79cdd6d446c229d689e5ab574a") and
   not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry,
                    $entry.trusted == true and not $entry.subject_name in ("Microsoft Corporation", "Microsoft Windows"))
'''

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 = "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 == "VirtualAllocEx" and process.executable != null and
  process.Ext.api.parameters.protection == "RWX" and process.Ext.api.parameters.size >= 10000 and
  process.thread.Ext.call_stack_summary like "?*" and not user.id in ("S-1-5-19", "S-1-5-20") and
  process.thread.Ext.call_stack_final_user_module.hash.sha256 != null and
  not (process.executable : ("?:\\Program Files\\*.exe", "?:\\Program Files (x86)\\*.exe", "?:\\Windows\\*") and
       process.code_signature.trusted == true and not process.code_signature.subject_name like "Microsoft*") and
  not (process.executable : "?:\\Windows\\System32\\RPC\\OSD\\osdservice.exe" and user.id == "S-1-5-18" and
       process.code_signature.subject_name == "Microsoft Windows Hardware Compatibility Publisher") and
  not _arraysearch(process.thread.Ext.call_stack, $entry,
                   $entry.symbol_info : ("?:\\Program Files\\*.dll*",
                                         "?:\\Program Files (x86)\\*.dll*",
                                         "?:\\windows\\system32\\*\\tmmon*.dll*",
                                         "?:\\Windows\\SysWOW64\\esensordbi.dll*",
                                         "?:\\Windows\\System32\\esensordbi.dll*",
                                         "?:\\Windows\\System32\\umppc*.dll*",
                                         "?:\\Windows\\FireEye\\AppMonitorDll*.dll*",
                                         "?:\\Windows\\apppatch\\AppPatch*\\exploitblocker.dll*",
                                         "?:\\windows\\system32\\hmpalert.dll!*",
                                         "*ntdll.dll!NtCreateUserProcess*",
                                         "*\\kernelbase.dll+0x*",
                                         "?:\\windows\\system32\\wlidsvc.dll!SvchostPushServiceGlobals*",
                                         "?:\\windows\\system32\\appxdeploymentserver.dll!*",
                                         "?:\\windows\\system32\\webruntimemanager.dll!CreateMessagePortEventDispatcher*",
                                         "?:\\windows\\systemapps\\microsoft.aad.brokerplugin_*\\aad.core.dll!DllGetActivationFactory*",
                                         "?:\\windows\\system32\\driverstore\\filerepository\\iigd_dch.inf_amd64_*\\igd12um64icl.dll*")) and
  not _arraysearch(process.thread.Ext.call_stack, $entry, $entry.protection_provenance like "Kernel*") and
   not _arraysearch(process.thread.Ext.call_stack, $entry,
                    $entry.callsite_trailing_bytes in
                         ("48898424e80300004883bc24e803000000750eff94247e030000898424f0030000eb30488d8c2430010000ff94248e03000048898424e80300004883bc24e803",
                          "8bd885db751eff55c88945f8eb168d8592fdffff50ff55d08bd885db7506ff55c88945f856ff55bc85db0f847601000080bd82fcffff0074508b45fc05a00000",
                          "488b55a8c6420c01833d8bbeb25f007406ff1593c7b25f8945b4488bcce82c000000908b45b4488b55a8c6420c01488b55a8488b8d70ffffff48894a10488d65",
                          "2048894538488b4d1048c1e103488b7d38488b7550f3a44c8b4d284d8b49484c8b45284d8b4040488b5528488b5220488b4d28488b8988000000ff95a0000000")) and
   not (process.name : "rundll32.exe" and process.parent.executable : "?:\\Users\\*\\AppData\\Local\\Temp\\SNXAC\\STAProxy.exe" and
        process.command_line : "*\\Users\\*\\AppData\\Local\\Temp\\snxac\\*\\sta.dll*") and
   not (process.code_signature.trusted == true and
        process.code_signature.subject_name in
              ("GEOVISION INC.", "COMPUTACION EN ACCION SA DE CV", "Crownalytics, LLC", "Johannes Schindelin",
               "INCA Internet Co.,Ltd.", "Mark Straver", "Micro Systemation AB (publ)", "HardestCodesEst OU",
               "MUSARUBRA US LLC", "Fleischhacker GmbH & Co. KG Laboreinrichtungen Medizintechnik")) and
   not (process.executable : "?:\\Users\\*\\AppData\\Local\\Mozilla Firefox\\firefox.exe" and
        process.code_signature.subject_name == "Mozilla Corporation" and process.code_signature.trusted == true) and
   not (process.executable : "?:\\Program Files (x86)\\Steam\\steamapps\\common\\*.exe" and process.code_signature.trusted == true) and
   not (process.executable : "?:\\Program Files (x86)\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe" and
        process.parent.executable : ("?:\\Windows\\System32\\SecurityHealthSystray.exe", "?:\\Users\\*\\AppData\\Local\\Microsoft\\OneDrive\\*\\FileCoAuth.exe") and
        process.Ext.api.summary : "VirtualAllocEx*microsoftedgeupdate.exe,*") and
   not process.parent.executable :
               ("?:\\Program Files (x86)\\Embarcadero\\Studio\\*\\bin\\bds.exe",
                "?:\\Program Files\\Embarcadero\\Studio\\*\\bin\\bds.exe",
                "?:\\Program Files (x86)\\Microsoft Visual Studio\\*\\Professional\\Common?\\IDE\\devenv.exe") 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",
                                          "FastTrack Software ApS",  "FastTrack Software Aps", "Promon AS", "PC Matic, Inc")) and
   not process.thread.Ext.call_stack_final_user_module.hash.sha256 in ("b4f289b5bf0beb59e7ba8d00b45ffaa582114c22a959bb8912cd8b903748f91b",
                                                                       "b950277c03155ffef055fd2fb6c9afe2022ac6402f8e04ece92f34bedf5bc194",
                                                                       "289ccce952e8a5ad4eae60fbfcfc239a2c6a45386655466ce45f77c9422533da",
                                                                       "8d80ea047a89300017544fc28a402c6f45b7369413c51c7b352af69db503d9bb",
                                                                       "b88d6fdb2641981675e1066f0767a8f263c5c4dcc5fccddbb948cdbe4165aef4",
                                                                       "90db33e5c6f2d0e3f60de07821413a24d31ceec26c83b447ff3a3607ebc67079",
                                                                       "73395b6c3fa9fa73e8e3665f108b3a92c564da9c1b9ce7834832adbb5e658a87",
                                                                       "4a81edc822ee7e6fb1ca1813f4c917f11b4366d33fd55c294d6509b4d4c0d80e",
                                                                       "d355b62cc7dc5b8f3ee5e95a8ddddc818f6f84c5a16799d78b1cb3d786e2bb80",
                                                                       "07d6c3a19a8e3e243e9545a41dd30a9ee1e9ad79cdd6d446c229d689e5ab574a") and
   not _arraysearch(process.thread.Ext.call_stack_final_user_module.code_signature, $entry,
                    $entry.trusted == true and not $entry.subject_name in ("Microsoft Corporation", "Microsoft Windows"))

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.code_signature.subject_namestarts_withMicrosoftexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executablewildcard?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Windows\*excludes:process.executable field:"process.executable" value:"?:\Program Files\*.exe" field:"process.executable" value:"?:\Program Files (x86)\*.exe" field:"process.executable" value:"?:\Windows\*"
process.Ext.api.summarywildcardVirtualAllocEx*microsoftedgeupdate.exe,*excludes:process.Ext.api.summary field:"process.Ext.api.summary" value:"VirtualAllocEx*microsoftedgeupdate.exe,*"
process.executableeq?:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files (x86)\Microsoft\EdgeUpdate\MicrosoftEdgeUpdate.exe"
process.parent.executablewildcard?:\Windows\System32\SecurityHealthSystray.exe, ?:\Users\*\AppData\Local\Microsoft\OneDrive\*\FileCoAuth.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\SecurityHealthSystray.exe" field:"process.parent.executable" value:"?:\Users\*\AppData\Local\Microsoft\OneDrive\*\FileCoAuth.exe"
process.code_signature.subject_nameeqMicrosoft Windows Hardware Compatibility Publisherexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft Windows Hardware Compatibility Publisher"
process.executableeq?:\Windows\System32\RPC\OSD\osdservice.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\RPC\OSD\osdservice.exe"
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"
process.code_signature.subject_nameeqMozilla Corporationexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Mozilla Corporation"
process.executablewildcard?:\Users\*\AppData\Local\Mozilla Firefox\firefox.exeexcludes:process.executable field:"process.executable" value:"?:\Users\*\AppData\Local\Mozilla Firefox\firefox.exe"
process.code_signature.subject_nameinCOMPUTACION EN ACCION SA DE CV, Crownalytics, LLC, Fleischhacker GmbH & Co. KG Laboreinrichtungen Medizintechnik, GEOVISION INC., HardestCodesEst OU, INCA Internet Co.,Ltd., Johannes Schindelin, MUSARUBRA US LLC, Mark Straver, Micro Systemation AB (publ)excludes:process.code_signature.subject_name
process.executablewildcard?:\Program Files (x86)\Steam\steamapps\common\*.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files (x86)\Steam\steamapps\common\*.exe"
process.command_linewildcard*\Users\*\AppData\Local\Temp\snxac\*\sta.dll*excludes:process.command_line field:"process.command_line" value:"*\Users\*\AppData\Local\Temp\snxac\*\sta.dll*"
process.nameeqrundll32.exeexcludes:process.name field:"process.name" value:"rundll32.exe"
process.parent.executablewildcard?:\Users\*\AppData\Local\Temp\SNXAC\STAProxy.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Users\*\AppData\Local\Temp\SNXAC\STAProxy.exe"
process.thread.Ext.call_stackarray_any(no value, null check)excludes:process.thread.Ext.call_stack
process.parent.executablewildcard?:\Program Files (x86)\Embarcadero\Studio\*\bin\bds.exe, ?:\Program Files\Embarcadero\Studio\*\bin\bds.exe, ?:\Program Files (x86)\Microsoft Visual Studio\*\Professional\Common?\IDE\devenv.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\Embarcadero\Studio\*\bin\bds.exe" field:"process.parent.executable" value:"?:\Program Files\Embarcadero\Studio\*\bin\bds.exe" field:"process.parent.executable" value:"?:\Program Files (x86)\Microsoft Visual Studio\*\Professional\Common?\IDE\devenv.exe"
process.thread.Ext.call_stack_final_user_module.hash.sha256in07d6c3a19a8e3e243e9545a41dd30a9ee1e9ad79cdd6d446c229d689e5ab574a, 289ccce952e8a5ad4eae60fbfcfc239a2c6a45386655466ce45f77c9422533da, 4a81edc822ee7e6fb1ca1813f4c917f11b4366d33fd55c294d6509b4d4c0d80e, 73395b6c3fa9fa73e8e3665f108b3a92c564da9c1b9ce7834832adbb5e658a87, 8d80ea047a89300017544fc28a402c6f45b7369413c51c7b352af69db503d9bb, 90db33e5c6f2d0e3f60de07821413a24d31ceec26c83b447ff3a3607ebc67079, b4f289b5bf0beb59e7ba8d00b45ffaa582114c22a959bb8912cd8b903748f91b, b88d6fdb2641981675e1066f0767a8f263c5c4dcc5fccddbb948cdbe4165aef4, b950277c03155ffef055fd2fb6c9afe2022ac6402f8e04ece92f34bedf5bc194, d355b62cc7dc5b8f3ee5e95a8ddddc818f6f84c5a16799d78b1cb3d786e2bb80excludes:process.thread.Ext.call_stack_final_user_module.hash.sha256
user.idinS-1-5-19, S-1-5-20excludes:user.id field:"user.id" value:"S-1-5-19" field:"user.id" value:"S-1-5-20"

Unusual Process Spawned by a Host

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

A machine learning job has detected a suspicious Windows process. This process has been classified as suspicious in two ways. It was predicted to be suspicious by the ProblemChild supervised ML model, and it was found to be an unusual process, on a host that does not commonly manifest malicious activity. Such a process may be an instance of suspicious or malicious activity, possibly involving LOLbins, that may be resistant to detection using conventional search rules.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2023/09/19"
integration = ["problemchild", "endpoint"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"

[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job has detected a suspicious Windows process. This process has been classified as suspicious in two
ways. It was predicted to be suspicious by the ProblemChild supervised ML model, and it was found to be an unusual
process, on a host that does not commonly manifest malicious activity. Such a process may be an instance of suspicious
or malicious activity, possibly involving LOLbins, that may be resistant to detection using conventional search rules.
"""
from = "now-45m"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "problem_child_rare_process_by_host_ea"
name = "Unusual Process Spawned by a Host"
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 Unusual Process Spawned by a Host

The detection rule leverages machine learning to identify atypical processes on Windows systems, focusing on those that deviate from normal behavior. Adversaries often exploit legitimate system tools, known as LOLbins, to evade detection. This rule uses the ProblemChild ML model to flag processes that are both statistically unusual and potentially malicious, enhancing detection of stealthy attacks that bypass traditional methods.

### Possible investigation steps

- Review the process details flagged by the ProblemChild ML model, including the process name, path, and command line arguments, to understand its nature and potential purpose.
- Check the parent process of the flagged process to determine if it was spawned by a legitimate application or a known LOLbin, which might indicate a Living off the Land attack.
- Investigate the host's historical activity to assess whether this process or similar ones have been executed previously, focusing on any patterns of unusual behavior.
- Correlate the process activity with user logins and network connections to identify any suspicious user behavior or external communications that coincide with the process execution.
- Examine the system's security logs for any related alerts or anomalies around the time the process was detected, which might provide additional context or evidence of malicious activity.

### False positive analysis

- Routine administrative tasks may trigger false positives if they involve unusual processes or tools not commonly used on the host. Users can create exceptions for these known tasks to prevent unnecessary alerts.
- Software updates or installations can spawn processes that are atypical but benign. Identifying and excluding these processes during known maintenance windows can reduce false positives.
- Custom scripts or automation tools that mimic LOLbins behavior might be flagged. Users should document and whitelist these scripts if they are verified as safe and necessary for operations.
- Legitimate third-party applications that use system binaries in uncommon ways may be misclassified. Regularly review and update the list of approved applications to ensure they are not mistakenly flagged.
- Temporary spikes in unusual processes due to legitimate business activities, such as end-of-quarter reporting, can be managed by adjusting the detection thresholds or temporarily disabling the rule during these periods.

### Response and remediation

- Isolate the affected host from the network to prevent further spread or communication with potential command and control servers.
- Terminate the suspicious process identified by the ProblemChild ML model to halt any ongoing malicious activity.
- Conduct a thorough review of the process's parent and child processes to identify any additional malicious activity or persistence mechanisms.
- Remove any identified LOLbins or unauthorized tools used by the adversary from the system to prevent further exploitation.
- Restore the affected system from a known good backup if any system integrity issues are detected.
- Update endpoint protection and monitoring tools to ensure they can detect similar threats in the future, focusing on the specific techniques used in this incident.
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are affected."""
references = [
    "https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
    "https://docs.elastic.co/en/integrations/problemchild",
    "https://www.elastic.co/security-labs/detecting-living-off-the-land-attacks-with-new-elastic-integration",
]
risk_score = 21
rule_id = "56004189-4e69-4a39-b4a9-195329d226e9"
setup = """## Setup

The rule requires the Living off the Land (LotL) Attack Detection integration assets to be installed, as well as Windows process events collected by integrations such as Elastic Defend or Winlogbeat.

### LotL Attack Detection Setup
The LotL Attack Detection integration detects living-off-the-land activity in Windows process events.

#### Prerequisite Requirements:
- Fleet is required for LotL Attack Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- Windows process events collected by the [Elastic Defend](https://docs.elastic.co/en/integrations/endpoint) integration or Winlogbeat(https://www.elastic.co/guide/en/beats/winlogbeat/current/_winlogbeat_overview.html).
- To install Elastic Defend, refer to the [documentation](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
- To set up and run Winlogbeat, follow [this](https://www.elastic.co/guide/en/beats/winlogbeat/current/winlogbeat-installation-configuration.html) guide.

#### The following steps should be executed to install assets associated with the LotL Attack Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Living off the Land Attack Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
    "Domain: Endpoint",
    "OS: Windows",
    "Data Source: Elastic Defend",
    "Data Source: Elastic Endgame",
    "Use Case: Living off the Land Attack Detection",
    "Rule Type: ML",
    "Rule Type: Machine Learning",
    "Tactic: Defense Evasion",
    "Resources: Investigation Guide",
]
type = "machine_learning"
[[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.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

Web Server Spawned via Python

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

This rule identifies when a web server is spawned via Python. Attackers may use Python to spawn a web server to exfiltrate/infiltrate data or to move laterally within a network.

MITRE ATT&CK Coverage

Rule Body

[metadata]
creation_date = "2024/11/04"
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2025/12/19"

[rule]
author = ["Elastic"]
description = """
This rule identifies when a web server is spawned via Python. Attackers may use Python to spawn a web server to
exfiltrate/infiltrate data or to move laterally within a network.
"""
from = "now-9m"
index = [
    "endgame-*",
    "logs-crowdstrike.fdr*",
    "logs-endpoint.events.process*",
    "logs-sentinel_one_cloud_funnel.*",
]
language = "eql"
license = "Elastic License v2"
name = "Web Server 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 Web Server Spawned via Python

Python's built-in HTTP server module allows quick web server deployment, often used for testing or file sharing. Adversaries exploit this to exfiltrate data or facilitate lateral movement within networks. The detection rule identifies processes starting a Python-based server, focusing on command patterns and shell usage, to flag potential misuse on Linux systems.

### Possible investigation steps

- Review the process details to confirm the presence of a Python-based web server by checking the process name and arguments, specifically looking for "python" with "http.server" or "SimpleHTTPServer".
- Investigate the user account associated with the process to determine if it is a known or expected user for running such services.
- Examine the command line used to start the process for any unusual or suspicious patterns, especially if it involves shell usage like "bash" or "sh" with the command line containing "python -m http.server".
- Check the network activity from the host to identify any unusual outbound connections or data transfers that could indicate data exfiltration.
- Correlate the event with other logs or alerts from the same host to identify any preceding or subsequent suspicious activities that might suggest lateral movement or further exploitation attempts.
- Assess the host's security posture and recent changes to determine if there are any vulnerabilities or misconfigurations that could have been exploited to spawn the web server.

### False positive analysis

- Development and testing environments often use Python's HTTP server for legitimate purposes such as serving static files or testing web applications. To manage this, create exceptions for known development servers by excluding specific hostnames or IP addresses.
- Automated scripts or cron jobs may start a Python web server for routine tasks like file distribution within a controlled environment. Identify these scripts and exclude their execution paths or user accounts from the detection rule.
- Educational or training sessions might involve participants using Python's HTTP server to learn web technologies. Exclude these activities by setting time-based exceptions during scheduled training periods.
- System administrators might use Python's HTTP server for quick file transfers or troubleshooting. Document these use cases and exclude the associated user accounts or process command lines from triggering alerts.
- Internal tools or utilities developed in-house may rely on Python's HTTP server for functionality. Review these tools and exclude their specific command patterns or execution contexts from the detection rule.

### Response and remediation

- Immediately isolate the affected host from the network to prevent further data exfiltration or lateral movement.
- Terminate the suspicious Python process identified by the detection rule to stop the unauthorized web server.
- Conduct a forensic analysis of the affected system to identify any data that may have been accessed or exfiltrated and to determine the initial access vector.
- Review and secure any exposed credentials or sensitive data that may have been compromised during the incident.
- Apply patches and updates to the affected system and any related software to mitigate vulnerabilities that may have been exploited.
- Implement network segmentation to limit the ability of unauthorized processes to communicate across the network.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to ensure comprehensive remediation and recovery actions are taken."""
risk_score = 47
rule_id = "99c2b626-de44-4322-b1f9-157ca408c17e"
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 = "medium"
tags = [
    "Domain: Endpoint",
    "OS: Linux",
    "Use Case: Threat Detection",
    "Tactic: Execution",
    "Data Source: Elastic Defend",
    "Data Source: Crowdstrike",
    "Data Source: SentinelOne",
    "Data Source: Elastic Endgame",
    "Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
(
  (process.name like "python*" and process.args in ("http.server", "SimpleHTTPServer")) or
  (
    process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
    process.command_line like~ "*python* -m http.server*"
  )
) and
not process.parent.executable == "/usr/lib/systemd/systemd"
'''

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

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

[[rule.threat.technique]]
id = "T1570"
name = "Lateral Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1570/"

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

Stages and Predicates

Stage 1: process

process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
(
  (process.name like "python*" and process.args in ("http.server", "SimpleHTTPServer")) or
  (
    process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
    process.command_line like~ "*python* -m http.server*"
  )
) and
not process.parent.executable == "/usr/lib/systemd/systemd"

Indicators

These rows show field, operator, and value matches.

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.parent.executableeq/usr/lib/systemd/systemdexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/lib/systemd/systemd"

Back to all Elastic rules