Outbound Scheduled Task Activity via PowerShell

edit

Identifies the PowerShell process loading the Task Scheduler COM DLL followed by an outbound RPC network connection within a short time period. This may indicate lateral movement or remote discovery via scheduled tasks.

Rule type: eql

Rule indices:

  • winlogbeat-*
  • logs-endpoint.events.*
  • logs-windows.*

Severity: medium

Risk score: 47

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

References:

Tags:

  • Elastic
  • Host
  • Windows
  • Threat Detection
  • Execution

Version: 100 (version history)

Added (Elastic Stack release): 7.11.0

Last modified (Elastic Stack release): 8.5.0

Rule authors: Elastic

Rule license: Elastic License v2

Potential false positives

edit

Legitimate scheduled tasks may be created during installation of new software.

Rule query

edit
sequence by host.id, process.entity_id with maxspan = 5s [any where
(event.category == "library" or (event.category == "process" and
event.action : "Image loaded*")) and (dll.name : "taskschd.dll" or
file.name : "taskschd.dll") and process.name : ("powershell.exe",
"pwsh.exe", "powershell_ise.exe")] [network where process.name :
("powershell.exe", "pwsh.exe", "powershell_ise.exe") and
destination.port == 135 and not destination.address in ("127.0.0.1",
"::1")]

Threat mapping

edit

Framework: MITRE ATT&CKTM

Rule version history

edit
Version 100 (8.5.0 release)
  • Formatting only
Version 6 (8.4.0 release)
  • Updated query, changed from:

    sequence by host.id, process.entity_id with maxspan = 5s [library
    where dll.name : "taskschd.dll" and process.name : ("powershell.exe",
    "pwsh.exe", "powershell_ise.exe")] [network where process.name :
    ("powershell.exe", "pwsh.exe", "powershell_ise.exe") and
    destination.port == 135 and not destination.address in ("127.0.0.1",
    "::1")]
Version 4 (7.16.0 release)
  • Updated query, changed from:

    sequence by host.id, process.entity_id with maxspan = 5s [library
    where dll.name : "taskschd.dll" and process.name : ("powershell.exe",
    "pwsh.exe")] [network where process.name : ("powershell.exe",
    "pwsh.exe") and destination.port == 135 and not destination.address in
    ("127.0.0.1", "::1")]
Version 2 (7.12.0 release)
  • Updated query, changed from:

    sequence by host.id, process.entity_id with maxspan = 5s [library
    where file.name: "taskschd.dll" and process.name: ("powershell.exe",
    "pwsh.exe")] [network where process.name : ("powershell.exe",
    "pwsh.exe") and destination.port == 135 and not destination.address in
    ("127.0.0.1", "::1")]