Detection rules › Elastic

Persistence via Extensible Firmware Modification

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

Identifies the modification of the Extensible Firmware Interface (EFI) files. Advanced adversaries may abuse Pre-OS Boot mechanisms as a way to establish persistence in a system.

MITRE ATT&CK coverage

TacticTechniques
Persistence
Impact

Rule body

[rule]
description = """
Identifies the modification of the Extensible Firmware Interface (EFI) files. Advanced adversaries may abuse Pre-OS Boot
mechanisms as a way to establish persistence in a system.
"""
id = "22fbd47a-8c72-4117-9355-f07fdcd9c0f4"
license = "Elastic License v2"
name = "Persistence via Extensible Firmware Modification"
os_list = ["windows"]
reference = [
    "https://github.com/Cr4sh/s6_pcie_microblaze/blob/master/python/payloads/DmaBackdoorHv/bootkit_installer.ps1",
    "https://securelist.com/finspy-unseen-findings/104322/",
]
version = "1.0.32"

query = '''
sequence by process.entity_id
 [process where event.action == "start" and
  not (process.pe.original_file_name :
         ("SetupHost.exe", "wbengine.exe", "BitLockerWizardElev.exe", "BitLockerDeviceEncryption.exe",
          "omadmclient.exe", "TSManager.exe", "SETUPPLATFORM.EXE", "RECOVERYDRIVE.EXE") and process.code_signature.subject_name like "Microsoft *" and
          process.code_signature.trusted == true) and

  not process.hash.sha256 : 
             ("07abbd7cd2693bc7b99c030ca86767d14e89a4c834cf9b5ae40ccf322ca81280", 
              "eee7c0e92277ada0e4d57a0a2ef30f102bf6b311ba0a891f3db28fa0d5ee8f56", 
              "ffac39846b01ad8d9b1074108ace1e148b8d1805b7790e15fe8975f1a4dac5df", 
              "e9373fdb8824e4431aba0c1df68ccc6ae098dab635f3504f7ee6efdfd97462da",
              "c4207f4d040a7588a45e76aef8e1cc9d8499e35f199a31c838ee4867a6d25870",
              "4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7",
              "0d0f9f92a8117090d710f28bd26753d4127a1b241b42fb0cc3688bc70a073965",
              "7519024820f8575d20cf2c14e573ba48049dc5766e3d5714c5f7a6c790c505a3",
              "4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7",
              "4342faa5ba84fd6a2142f7d3797cf301b6d73894ab49138eb83497498c06910c",
              "8c128cfd25a5d3c5b1f47da3f4d4964144af22b9fc76ffe7c67c1f5d0817b5ee",
              "a6f0f7ceae685165ac142231215d8c1ee196d61723e26597b3eed65931f2296d", 
              "ee2317208b909c46b7c73b74f07f5be68717dc704398ec3434e8ba353e2cdd04", 
              "a62316c113c92f88a042cf84ed589f8eab1ec9de99e3e2da65ad982a9653103e", 
              "0def9f7030a3f2b8a3e13cc755df45179237353018f2742b91193a3b0a488656", 
              "dadf1bfc7471d3c51a9a8f57f791b44785947324496711f54ba42257559b6fdb",
              "4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7",
              "dadf1bfc7471d3c51a9a8f57f791b44785947324496711f54ba42257559b6fdb",
              "8d39e6e50c2ef7aa7a62c3b57ee30a6a3e751ec1e288415f7a9b729126e10bc7") and

  not (process.executable : "?:\\Windows\\System32\\bcdedit.exe" and process.args : "/export") and 
  
  not process.parent.executable :
           ("?:\\Program Files (x86)\\Microsoft Intune Management Extension\\AgentExecutor.exe",
            "?:\\Program Files (x86)\\ISO to USB\\isotousb.exe", 
            "?:\\Program Files (x86)\\baramundi\\BMA\\BDSRun.exe", 
            "?:\\Program Files (x86)\\Dell\\UpdateService\\ServiceShell.exe", 
            "?:\\Program Files (x86)\\OmniBack\\bin\\vbda.exe") and
  
  not (process.executable : "?:\\Windows\\HP\\Installer.exe" and process.args : "-bestsize" and process.args : "-uefisupport") and 

  not (process.code_signature.subject_name :
           ("Akeo Consulting", "HP Inc.", "Dell Inc", "Dell Technologies Inc.", "Veritas Technologies LLC", "Insyde Software Corp.", "Huawei Technologies Co., Ltd.", "FUJITSU CLIENT COMPUTING LIMITED", "Micro Focus Group Limited", "ESET, spol. s r.o.") and
       process.code_signature.trusted == true) and

  not (process.executable : "?:\\WINDOWS\\System32\\svchost.exe" and process.args : "BDESVC" and process.parent.name : "services.exe") and

  not (process.executable : "?:\\Windows\\System32\\bcdboot.exe" and process.args : "/sysrepair" and process.parent.name : "svchost.exe") and

  not (process.executable : "?:\\Windows\\System32\\bcdboot.exe" and process.args : "/f" and process.args : "?:\\Windows") and

  not (process.executable : ("?:\\Windows\\System32\\taskhostw.exe", "?:\\Windows\\System32\\AggregatorHost.exe", "?:\\Windows\\UUS\\amd64\\wuaucltcore.exe") and process.parent.executable : "?:\\Windows\\System32\\svchost.exe")
  ]
 [file where event.action != "deletion" and file.path :"\\Device\\HarddiskVolume*\\EFI\\*" and

  file.size > 0 and 

  not (process.name : ("powershell.exe", "wsmprovhost.exe") and file.path : ("\\Device\\HarddiskVolume*\\EFI\\HP\\DEVFW\\*", "\\Device\\HarddiskVolume*\\EFI\\Microsoft\\Boot\\SecConfig.efi")) and

  not (process.executable : "?:\\Windows\\System32\\wbem\\WmiPrvSE.exe" and file.path : "\\Device\\HarddiskVolume*\\EFI\\*.log")]
 until [process where event.action == "end"]
'''

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1542"
name = "Pre-OS Boot"
reference = "https://attack.mitre.org/techniques/T1542/"


[threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1495"
name = "Firmware Corruption"
reference = "https://attack.mitre.org/techniques/T1495/"


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

[internal]
min_endpoint_version = "8.4.0"

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
  not (process.pe.original_file_name :
         ("SetupHost.exe", "wbengine.exe", "BitLockerWizardElev.exe", "BitLockerDeviceEncryption.exe",
          "omadmclient.exe", "TSManager.exe", "SETUPPLATFORM.EXE", "RECOVERYDRIVE.EXE") and process.code_signature.subject_name like "Microsoft *" and
          process.code_signature.trusted == true) and

  not process.hash.sha256 : 
             ("07abbd7cd2693bc7b99c030ca86767d14e89a4c834cf9b5ae40ccf322ca81280", 
              "eee7c0e92277ada0e4d57a0a2ef30f102bf6b311ba0a891f3db28fa0d5ee8f56", 
              "ffac39846b01ad8d9b1074108ace1e148b8d1805b7790e15fe8975f1a4dac5df", 
              "e9373fdb8824e4431aba0c1df68ccc6ae098dab635f3504f7ee6efdfd97462da",
              "c4207f4d040a7588a45e76aef8e1cc9d8499e35f199a31c838ee4867a6d25870",
              "4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7",
              "0d0f9f92a8117090d710f28bd26753d4127a1b241b42fb0cc3688bc70a073965",
              "7519024820f8575d20cf2c14e573ba48049dc5766e3d5714c5f7a6c790c505a3",
              "4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7",
              "4342faa5ba84fd6a2142f7d3797cf301b6d73894ab49138eb83497498c06910c",
              "8c128cfd25a5d3c5b1f47da3f4d4964144af22b9fc76ffe7c67c1f5d0817b5ee",
              "a6f0f7ceae685165ac142231215d8c1ee196d61723e26597b3eed65931f2296d", 
              "ee2317208b909c46b7c73b74f07f5be68717dc704398ec3434e8ba353e2cdd04", 
              "a62316c113c92f88a042cf84ed589f8eab1ec9de99e3e2da65ad982a9653103e", 
              "0def9f7030a3f2b8a3e13cc755df45179237353018f2742b91193a3b0a488656", 
              "dadf1bfc7471d3c51a9a8f57f791b44785947324496711f54ba42257559b6fdb",
              "4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7",
              "dadf1bfc7471d3c51a9a8f57f791b44785947324496711f54ba42257559b6fdb",
              "8d39e6e50c2ef7aa7a62c3b57ee30a6a3e751ec1e288415f7a9b729126e10bc7") and

  not (process.executable : "?:\\Windows\\System32\\bcdedit.exe" and process.args : "/export") and 
  
  not process.parent.executable :
           ("?:\\Program Files (x86)\\Microsoft Intune Management Extension\\AgentExecutor.exe",
            "?:\\Program Files (x86)\\ISO to USB\\isotousb.exe", 
            "?:\\Program Files (x86)\\baramundi\\BMA\\BDSRun.exe", 
            "?:\\Program Files (x86)\\Dell\\UpdateService\\ServiceShell.exe", 
            "?:\\Program Files (x86)\\OmniBack\\bin\\vbda.exe") and
  
  not (process.executable : "?:\\Windows\\HP\\Installer.exe" and process.args : "-bestsize" and process.args : "-uefisupport") and 

  not (process.code_signature.subject_name :
           ("Akeo Consulting", "HP Inc.", "Dell Inc", "Dell Technologies Inc.", "Veritas Technologies LLC", "Insyde Software Corp.", "Huawei Technologies Co., Ltd.", "FUJITSU CLIENT COMPUTING LIMITED", "Micro Focus Group Limited", "ESET, spol. s r.o.") and
       process.code_signature.trusted == true) and

  not (process.executable : "?:\\WINDOWS\\System32\\svchost.exe" and process.args : "BDESVC" and process.parent.name : "services.exe") and

  not (process.executable : "?:\\Windows\\System32\\bcdboot.exe" and process.args : "/sysrepair" and process.parent.name : "svchost.exe") and

  not (process.executable : "?:\\Windows\\System32\\bcdboot.exe" and process.args : "/f" and process.args : "?:\\Windows") and

  not (process.executable : ("?:\\Windows\\System32\\taskhostw.exe", "?:\\Windows\\System32\\AggregatorHost.exe", "?:\\Windows\\UUS\\amd64\\wuaucltcore.exe") and process.parent.executable : "?:\\Windows\\System32\\svchost.exe")
  ]

Stage 2: file

[file where event.action != "deletion" and file.path :"\\Device\\HarddiskVolume*\\EFI\\*" and

  file.size > 0 and 

  not (process.name : ("powershell.exe", "wsmprovhost.exe") and file.path : ("\\Device\\HarddiskVolume*\\EFI\\HP\\DEVFW\\*", "\\Device\\HarddiskVolume*\\EFI\\Microsoft\\Boot\\SecConfig.efi")) and

  not (process.executable : "?:\\Windows\\System32\\wbem\\WmiPrvSE.exe" and file.path : "\\Device\\HarddiskVolume*\\EFI\\*.log")]

Until: process

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

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

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq-bestsizeexcludes:process.args field:"process.args" value:"-bestsize"
process.argseq-uefisupportexcludes:process.args field:"process.args" value:"-uefisupport"
process.executableeq?:\Windows\HP\Installer.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\HP\Installer.exe"
process.argseq/exportexcludes:process.args field:"process.args" value:"/export"
process.executableeq?:\Windows\System32\bcdedit.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\bcdedit.exe"
process.argseq/fexcludes:process.args field:"process.args" value:"/f"
process.argseq?:\Windowsexcludes:process.args field:"process.args" value:"?:\Windows"
process.executableeq?:\Windows\System32\bcdboot.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\bcdboot.exe"
process.argseq/sysrepairexcludes:process.args field:"process.args" value:"/sysrepair"
process.parent.nameeqsvchost.exeexcludes:process.parent.name field:"process.parent.name" value:"svchost.exe"
process.argseqBDESVCexcludes:process.args field:"process.args" value:"BDESVC"
process.executableeq?:\WINDOWS\System32\svchost.exeexcludes:process.executable field:"process.executable" value:"?:\WINDOWS\System32\svchost.exe"
process.parent.nameeqservices.exeexcludes:process.parent.name field:"process.parent.name" value:"services.exe"
process.code_signature.subject_nameeqAkeo Consulting, HP Inc., Dell Inc, Dell Technologies Inc., Veritas Technologies LLC, Insyde Software Corp., Huawei Technologies Co., Ltd., FUJITSU CLIENT COMPUTING LIMITED, Micro Focus Group Limited, ESET, spol. s r.o.excludes:process.code_signature.subject_name
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.code_signature.subject_namestarts_withMicrosoft excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft "
process.pe.original_file_nameeqSetupHost.exe, wbengine.exe, BitLockerWizardElev.exe, BitLockerDeviceEncryption.exe, omadmclient.exe, TSManager.exe, SETUPPLATFORM.EXE, RECOVERYDRIVE.EXEexcludes:process.pe.original_file_name
process.executableeq?:\Windows\System32\taskhostw.exe, ?:\Windows\System32\AggregatorHost.exe, ?:\Windows\UUS\amd64\wuaucltcore.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\taskhostw.exe" field:"process.executable" value:"?:\Windows\System32\AggregatorHost.exe" field:"process.executable" value:"?:\Windows\UUS\amd64\wuaucltcore.exe"
process.parent.executableeq?:\Windows\System32\svchost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\svchost.exe"
process.hash.sha256eq07abbd7cd2693bc7b99c030ca86767d14e89a4c834cf9b5ae40ccf322ca81280, eee7c0e92277ada0e4d57a0a2ef30f102bf6b311ba0a891f3db28fa0d5ee8f56, ffac39846b01ad8d9b1074108ace1e148b8d1805b7790e15fe8975f1a4dac5df, e9373fdb8824e4431aba0c1df68ccc6ae098dab635f3504f7ee6efdfd97462da, c4207f4d040a7588a45e76aef8e1cc9d8499e35f199a31c838ee4867a6d25870, 4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7, 0d0f9f92a8117090d710f28bd26753d4127a1b241b42fb0cc3688bc70a073965, 7519024820f8575d20cf2c14e573ba48049dc5766e3d5714c5f7a6c790c505a3, 4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7, 4342faa5ba84fd6a2142f7d3797cf301b6d73894ab49138eb83497498c06910c, 8c128cfd25a5d3c5b1f47da3f4d4964144af22b9fc76ffe7c67c1f5d0817b5ee, a6f0f7ceae685165ac142231215d8c1ee196d61723e26597b3eed65931f2296d, ee2317208b909c46b7c73b74f07f5be68717dc704398ec3434e8ba353e2cdd04, a62316c113c92f88a042cf84ed589f8eab1ec9de99e3e2da65ad982a9653103e, 0def9f7030a3f2b8a3e13cc755df45179237353018f2742b91193a3b0a488656, dadf1bfc7471d3c51a9a8f57f791b44785947324496711f54ba42257559b6fdb, 4ab2db239193ff9578bcc781779b0d43a3aa5262bb217699009f4190cab216a7, dadf1bfc7471d3c51a9a8f57f791b44785947324496711f54ba42257559b6fdb, 8d39e6e50c2ef7aa7a62c3b57ee30a6a3e751ec1e288415f7a9b729126e10bc7excludes:process.hash.sha256
process.parent.executableeq?:\Program Files (x86)\Microsoft Intune Management Extension\AgentExecutor.exe, ?:\Program Files (x86)\ISO to USB\isotousb.exe, ?:\Program Files (x86)\baramundi\BMA\BDSRun.exe, ?:\Program Files (x86)\Dell\UpdateService\ServiceShell.exe, ?:\Program Files (x86)\OmniBack\bin\vbda.exeexcludes:process.parent.executable
file.pathwildcard\Device\HarddiskVolume*\EFI\*.logexcludes:file.path field:"file.path" value:"\Device\HarddiskVolume*\EFI\*.log"
process.executableeq?:\Windows\System32\wbem\WmiPrvSE.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\wbem\WmiPrvSE.exe"
file.pathwildcard\Device\HarddiskVolume*\EFI\HP\DEVFW\*, \Device\HarddiskVolume*\EFI\Microsoft\Boot\SecConfig.efiexcludes:file.path field:"file.path" value:"\Device\HarddiskVolume*\EFI\HP\DEVFW\*" field:"file.path" value:"\Device\HarddiskVolume*\EFI\Microsoft\Boot\SecConfig.efi"
process.nameeqpowershell.exe, wsmprovhost.exeexcludes:process.name field:"process.name" value:"powershell.exe" field:"process.name" value:"wsmprovhost.exe"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • end corpus 18 (elastic 18)
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq
event.actionne
  • deletion corpus 86 (elastic 86)
field:"EventType" kind:ne value:"deletion"
file.pathwildcard
  • \Device\HarddiskVolume*\EFI\*
field:"TargetFilename" kind:wildcard value:"\Device\HarddiskVolume*\EFI\*"
file.sizegt
  • 0 transforms: number corpus 3 (elastic 3)
field:"file.size" kind:gt value:"0"