Detection rules › Elastic

Scheduled Task from a Removable or Mounted ISO Device

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

Identifies a process running from a mounted ISO or USB device or its descendants creating a new scheduled task for persistence. Adversaries may use this technique to maintain persistence on an endpoint.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies a process running from a mounted ISO or USB device or its descendants creating a new scheduled task for
persistence. Adversaries may use this technique to maintain persistence on an endpoint.
"""
id = "3c12c648-e29f-4bff-9157-b07f2cbddf1a"
license = "Elastic License v2"
name = "Scheduled Task from a Removable or Mounted ISO Device"
os_list = ["windows"]
reference = ["https://docs.microsoft.com/en-us/windows/win32/taskschd/daily-trigger-example--xml-"]
version = "1.0.22"

query = '''
sequence with maxspan=5m
 [process where event.action == "start" and
  (
   (process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and not process.executable : "C:\\*") or

   descendant of [process where event.action == "start" and
   process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and not process.executable : "C:\\*"]
   ) and
   not process.executable : ("?:\\Program Files\\Microsoft Office\\root\\Integration\\Addons\\OneDriveSetup.exe",
                             "?:\\Program Files (x86)\\Microsoft Office\\root\\Integration\\Addons\\OneDriveSetup.exe",
                             "?:\\Program Files (x86)\\AnVir Task Manager\\AnVir.exe",
                             "?:\\$WINDOWS.~BT\\Sources\\SetupHost.exe") and
   not (process.code_signature.subject_name : ("Global Security Center", "The MathWorks, Inc.") and process.code_signature.trusted == true) and
   not process.hash.sha256 : ("0069d5e4690d717377410d56b56fc543edb333eb099eb591fbe561fd36c4feea",
                              "e720b05e5bc033c8cd48be3d88bf29af9ba51eeed489d6ef23d64f8b99d5648c",
                              "98935483ec3a9d55b45a095e1dc5a98c894aec51131390c914bf6950905629ab") and
   not (process.name : "powershell.exe" and process.parent.executable : "C:\\Program Files\\Wireshark\\npcap-*.exe") and
   not (process.name : "schtasks.exe" and process.args : "Schneider Electric\\Power Monitoring Expert\\*"
        and process.args : "*C:\\Program Files (x86)\\Schneider Electric\\Power Monitoring Expert\\*") and
   not (process.executable : "?:\\Program Files\\Internet Explorer\\iexplore.exe" and process.args : "Bootstrap\\Log\\*\\SqlDiscoveryReport.htm")
 ] by process.entity_id
[file where event.action : "creation" and process.name : "svchost.exe" and
  file.path : ("?:\\Windows\\Tasks\\*", "?:\\Windows\\System32\\Tasks\\*")] by Effective_process.entity_id
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1091"
name = "Replication Through Removable Media"
reference = "https://attack.mitre.org/techniques/T1091/"


[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[threat.technique.subtechnique]]
id = "T1053.005"
name = "Scheduled Task"
reference = "https://attack.mitre.org/techniques/T1053/005/"



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

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and
  (
   (process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and not process.executable : "C:\\*") or

   descendant of [process where event.action == "start" and
   process.Ext.device.product_id : ("Virtual DVD-ROM", "Virtual Disk", "USB *") and not process.executable : "C:\\*"]
   ) and
   not process.executable : ("?:\\Program Files\\Microsoft Office\\root\\Integration\\Addons\\OneDriveSetup.exe",
                             "?:\\Program Files (x86)\\Microsoft Office\\root\\Integration\\Addons\\OneDriveSetup.exe",
                             "?:\\Program Files (x86)\\AnVir Task Manager\\AnVir.exe",
                             "?:\\$WINDOWS.~BT\\Sources\\SetupHost.exe") and
   not (process.code_signature.subject_name : ("Global Security Center", "The MathWorks, Inc.") and process.code_signature.trusted == true) and
   not process.hash.sha256 : ("0069d5e4690d717377410d56b56fc543edb333eb099eb591fbe561fd36c4feea",
                              "e720b05e5bc033c8cd48be3d88bf29af9ba51eeed489d6ef23d64f8b99d5648c",
                              "98935483ec3a9d55b45a095e1dc5a98c894aec51131390c914bf6950905629ab") and
   not (process.name : "powershell.exe" and process.parent.executable : "C:\\Program Files\\Wireshark\\npcap-*.exe") and
   not (process.name : "schtasks.exe" and process.args : "Schneider Electric\\Power Monitoring Expert\\*"
        and process.args : "*C:\\Program Files (x86)\\Schneider Electric\\Power Monitoring Expert\\*") and
   not (process.executable : "?:\\Program Files\\Internet Explorer\\iexplore.exe" and process.args : "Bootstrap\\Log\\*\\SqlDiscoveryReport.htm")
 ] by process.entity_id

Stage 2: file

[file where event.action : "creation" and process.name : "svchost.exe" and
  file.path : ("?:\\Windows\\Tasks\\*", "?:\\Windows\\System32\\Tasks\\*")] by Effective_process.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argsmatchC:\Program Files (x86)\Schneider Electric\Power Monitoring Expert\excludes:process.args field:"process.args" value:"C:\Program Files (x86)\Schneider Electric\Power Monitoring Expert\"
process.argsstarts_withSchneider Electric\Power Monitoring Expert\excludes:process.args field:"process.args" value:"Schneider Electric\Power Monitoring Expert\"
process.nameeqschtasks.exeexcludes:process.name field:"process.name" value:"schtasks.exe"
process.argswildcardBootstrap\Log\*\SqlDiscoveryReport.htmexcludes:process.args field:"process.args" value:"Bootstrap\Log\*\SqlDiscoveryReport.htm"
process.executableeq?:\Program Files\Internet Explorer\iexplore.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files\Internet Explorer\iexplore.exe"
process.code_signature.subject_nameeqGlobal Security Center, The MathWorks, Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Global Security Center" field:"process.code_signature.subject_name" value:"The MathWorks, Inc."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.nameeqpowershell.exeexcludes:process.name field:"process.name" value:"powershell.exe"
process.parent.executablewildcardC:\Program Files\Wireshark\npcap-*.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Wireshark\npcap-*.exe"
process.executableeq?:\Program Files\Microsoft Office\root\Integration\Addons\OneDriveSetup.exe, ?:\Program Files (x86)\Microsoft Office\root\Integration\Addons\OneDriveSetup.exe, ?:\Program Files (x86)\AnVir Task Manager\AnVir.exe, ?:\$WINDOWS.~BT\Sources\SetupHost.exeexcludes:process.executable
process.hash.sha256eq0069d5e4690d717377410d56b56fc543edb333eb099eb591fbe561fd36c4feea, e720b05e5bc033c8cd48be3d88bf29af9ba51eeed489d6ef23d64f8b99d5648c, 98935483ec3a9d55b45a095e1dc5a98c894aec51131390c914bf6950905629abexcludes:process.hash.sha256 field:"process.hash.sha256" value:"0069d5e4690d717377410d56b56fc543edb333eb099eb591fbe561fd36c4feea" field:"process.hash.sha256" value:"e720b05e5bc033c8cd48be3d88bf29af9ba51eeed489d6ef23d64f8b99d5648c" field:"process.hash.sha256" value:"98935483ec3a9d55b45a095e1dc5a98c894aec51131390c914bf6950905629ab"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionwildcard
  • creation corpus 58 (elastic 58)
field:"EventType" kind:wildcard value:"creation"
file.pathwildcard
  • ?:\Windows\System32\Tasks\* corpus 6 (elastic 6)
  • ?:\Windows\Tasks\* corpus 7 (elastic 7)
field:"TargetFilename" kind:wildcard
process.Ext.device.product_idwildcard
  • USB *
  • Virtual DVD-ROM corpus 13 (elastic 13)
  • Virtual Disk corpus 13 (elastic 13)
field:"process.Ext.device.product_id" kind:wildcard
process.namewildcard
  • svchost.exe corpus 24 (elastic 22, splunk 2)
field:"process_name" kind:wildcard value:"svchost.exe"