Detection rules › Elastic

Suspicious Executable File Creation

Source
github.com/elastic/protections-artifacts

Identifies the creation of an executable file by a signed Microsoft binary proxy utility such as MSHTA.exe, CertReq.exe, CertUtil.exe or Common Microsoft Documents processes like WinWord and Excel.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the creation of an executable file by a signed Microsoft binary proxy utility such as MSHTA.exe, CertReq.exe,
CertUtil.exe or Common Microsoft Documents processes like WinWord and Excel.
"""
id = "37c54ca7-e96d-4fd5-92d3-08cab38516b7"
license = "Elastic License v2"
name = "Suspicious Executable File Creation"
os_list = ["windows"]
version = "1.0.26"

query = '''
file where event.action != "deletion" and not user.id : "S-1-5-18" and

 (file.extension : ("exe", "pif", "scr", "iso", "rar", "zip", "7z", "img", "vhd", "js", "vbs", "wsh", "hta",
                    "cpl", "jse", "vbe", "cmd", "dll") or

  file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and

 (
   process.name : ("CertUtil.exe", "CertReq.exe") or

   (process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
   file.path :
       ("?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*",
        "?:\\Users\\Public\\*",
        "?:\\ProgramData\\*",
        "?:\\Users\\Public\\*",
        "?:\\Users\\*\\Documents\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Users\\*\\Music\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Windows\\Tasks\\*",
        "?:\\Windows\\System32\\tasks\\*"))
  ) and

  /* MS Office often downloads js file types in the INETCache folder */
  not (file.extension : "js" and process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
       file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*" and

       /* avoid bypass via fake js file extension */
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and

  not (file.extension : ("zip", "rar", "7z") and process.executable : "?:\\Program Files*\\Microsoft Office\\*.exe" and
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and
  not (process.name : ("winword.exe", "POWERPNT.EXE") and file.path : "C:\\ProgramData\\CanonIJFAX\\*\\CNCARGU.DLL") and
  not (process.name : "POWERPNT.EXE" and file.extension :("dll", "tmp") and
       file.path : ("C:\\ProgramData\\UpSlide\\UnpackBinaries\\*", "c:\\programdata\\seagull\\drivers\\temp\\*.tmp")) and
  not (process.name : "certutil.exe" and
       file.path : ("?:\\Windows\\Installer\\*",
                    "?:\\Program Files\\Sales Pro Suite*.exe",
                    "?:\\Users\\*\\AppData\\Local\\Packages\\microsoft.windows.search_*\\AC\\AppCache\\*.js")) and
  not (process.name : ("excel.exe", "winword.exe") and
       file.path : ("?:\\ProgramData\\Seagull\\Drivers\\Temp\\ss#*.tmp",
                    "C:\\ProgramData\\SafeNet Sentinel\\Sentinel RMS Development Kit\\System\\*.dll",
                    "?:\\ProgramData\\TeamMate\\Integration\\*",
                    "?:\\ProgramData\\FactSet\\OnlineComponents\\*",
                    "?:\\ProgramData\\UpSlide\\UnpackBinaries\\*.dll",
                    "C:\\ProgramData\\Agilent\\Temp\\tmp*.tmp",
                    "?:\\ProgramData\\TeamMate\\*",
                    "?:\\ProgramData\\Sophos\\AutoUpdate\\*",
                    "C:\\Users\\Public\\Tegus Toolkit Addin\\Downloads\\Installation\\Application Files\\CanalystToolkitAddin_*"))
'''

min_endpoint_version = "7.16.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 = "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 = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"


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

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Stage 1: file

file where event.action != "deletion" and not user.id : "S-1-5-18" and
 (file.extension : ("exe", "pif", "scr", "iso", "rar", "zip", "7z", "img", "vhd", "js", "vbs", "wsh", "hta",
                    "cpl", "jse", "vbe", "cmd", "dll") or
  file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*", "3c736372697074206c616e6775616765", "76617220*")) and
 (
   process.name : ("CertUtil.exe", "CertReq.exe") or
   (process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
   file.path :
       ("?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*",
        "?:\\Users\\Public\\*",
        "?:\\ProgramData\\*",
        "?:\\Users\\Public\\*",
        "?:\\Users\\*\\Documents\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Users\\*\\Music\\*",
        "?:\\Users\\*\\Pictures\\*",
        "?:\\Windows\\Tasks\\*",
        "?:\\Windows\\System32\\tasks\\*"))
  ) and
  not (file.extension : "js" and process.name : ("winword.exe", "excel.exe", "powerpnt.exe") and
       file.path : "?:\\Users\\*\\AppData\\Local\\Microsoft\\Windows\\INetCache\\IE\\*" and
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and
  not (file.extension : ("zip", "rar", "7z") and process.executable : "?:\\Program Files*\\Microsoft Office\\*.exe" and
       not file.Ext.header_bytes : ("4d5a*", "TVqQ*", "406563686F*")) and
  not (process.name : ("winword.exe", "POWERPNT.EXE") and file.path : "C:\\ProgramData\\CanonIJFAX\\*\\CNCARGU.DLL") and
  not (process.name : "POWERPNT.EXE" and file.extension :("dll", "tmp") and
       file.path : ("C:\\ProgramData\\UpSlide\\UnpackBinaries\\*", "c:\\programdata\\seagull\\drivers\\temp\\*.tmp")) and
  not (process.name : "certutil.exe" and
       file.path : ("?:\\Windows\\Installer\\*",
                    "?:\\Program Files\\Sales Pro Suite*.exe",
                    "?:\\Users\\*\\AppData\\Local\\Packages\\microsoft.windows.search_*\\AC\\AppCache\\*.js")) and
  not (process.name : ("excel.exe", "winword.exe") and
       file.path : ("?:\\ProgramData\\Seagull\\Drivers\\Temp\\ss#*.tmp",
                    "C:\\ProgramData\\SafeNet Sentinel\\Sentinel RMS Development Kit\\System\\*.dll",
                    "?:\\ProgramData\\TeamMate\\Integration\\*",
                    "?:\\ProgramData\\FactSet\\OnlineComponents\\*",
                    "?:\\ProgramData\\UpSlide\\UnpackBinaries\\*.dll",
                    "C:\\ProgramData\\Agilent\\Temp\\tmp*.tmp",
                    "?:\\ProgramData\\TeamMate\\*",
                    "?:\\ProgramData\\Sophos\\AutoUpdate\\*",
                    "C:\\Users\\Public\\Tegus Toolkit Addin\\Downloads\\Installation\\Application Files\\CanalystToolkitAddin_*"))

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.Ext.header_bytesstarts_with4d5a, TVqQ, 406563686Fexcludes:file.Ext.header_bytes field:"file.Ext.header_bytes" value:"4d5a" field:"file.Ext.header_bytes" value:"TVqQ" field:"file.Ext.header_bytes" value:"406563686F"
file.extensioneqjsexcludes:file.extension field:"file.extension" value:"js"
file.pathwildcard?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\*excludes:file.path field:"file.path" value:"?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\*"
process.nameeqwinword.exe, excel.exe, powerpnt.exeexcludes:process.name field:"process.name" value:"winword.exe" field:"process.name" value:"excel.exe" field:"process.name" value:"powerpnt.exe"
file.extensioneqzip, rar, 7zexcludes:file.extension field:"file.extension" value:"zip" field:"file.extension" value:"rar" field:"file.extension" value:"7z"
process.executablewildcard?:\Program Files*\Microsoft Office\*.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files*\Microsoft Office\*.exe"
file.extensioneqdll, tmpexcludes:file.extension field:"file.extension" value:"dll" field:"file.extension" value:"tmp"
file.pathwildcardC:\ProgramData\UpSlide\UnpackBinaries\*, c:\programdata\seagull\drivers\temp\*.tmpexcludes:file.path field:"file.path" value:"C:\ProgramData\UpSlide\UnpackBinaries\*" field:"file.path" value:"c:\programdata\seagull\drivers\temp\*.tmp"
process.nameeqPOWERPNT.EXEexcludes:process.name field:"process.name" value:"POWERPNT.EXE"
file.pathwildcard?:\ProgramData\Seagull\Drivers\Temp\ss#*.tmp, C:\ProgramData\SafeNet Sentinel\Sentinel RMS Development Kit\System\*.dll, ?:\ProgramData\TeamMate\Integration\*, ?:\ProgramData\FactSet\OnlineComponents\*, ?:\ProgramData\UpSlide\UnpackBinaries\*.dll, C:\ProgramData\Agilent\Temp\tmp*.tmp, ?:\ProgramData\TeamMate\*, ?:\ProgramData\Sophos\AutoUpdate\*, C:\Users\Public\Tegus Toolkit Addin\Downloads\Installation\Application Files\CanalystToolkitAddin_*excludes:file.path
process.nameeqexcel.exe, winword.exeexcludes:process.name field:"process.name" value:"excel.exe" field:"process.name" value:"winword.exe"
file.pathwildcard?:\Windows\Installer\*, ?:\Program Files\Sales Pro Suite*.exe, ?:\Users\*\AppData\Local\Packages\microsoft.windows.search_*\AC\AppCache\*.jsexcludes:file.path field:"file.path" value:"?:\Windows\Installer\*" field:"file.path" value:"?:\Program Files\Sales Pro Suite*.exe" field:"file.path" value:"?:\Users\*\AppData\Local\Packages\microsoft.windows.search_*\AC\AppCache\*.js"
process.nameeqcertutil.exeexcludes:process.name field:"process.name" value:"certutil.exe"
file.pathwildcardC:\ProgramData\CanonIJFAX\*\CNCARGU.DLLexcludes:file.path field:"file.path" value:"C:\ProgramData\CanonIJFAX\*\CNCARGU.DLL"
process.nameeqwinword.exe, POWERPNT.EXEexcludes:process.name field:"process.name" value:"winword.exe" field:"process.name" value:"POWERPNT.EXE"
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actionne
  • deletion corpus 86 (elastic 86)
field:"EventType" kind:ne value:"deletion"
file.Ext.header_byteswildcard
  • 3c736372697074206c616e6775616765
  • 406563686F*
  • 4d5a* corpus 46 (elastic 46)
  • 76617220*
  • TVqQ*
field:"file.Ext.header_bytes" kind:wildcard
file.extensionwildcard
  • 7z corpus 3 (elastic 3)
  • cmd corpus 15 (elastic 15)
  • cpl corpus 19 (elastic 19)
  • dll corpus 33 (elastic 33)
  • exe corpus 32 (elastic 32)
  • hta corpus 20 (elastic 20)
  • img corpus 4 (elastic 4)
  • iso corpus 4 (elastic 4)
  • js corpus 23 (elastic 23)
  • jse corpus 18 (elastic 18)
  • pif corpus 18 (elastic 18)
  • rar corpus 4 (elastic 4)
  • scr corpus 17 (elastic 17)
  • vbe corpus 18 (elastic 18)
  • vbs corpus 19 (elastic 19)
  • vhd corpus 3 (elastic 3)
  • wsh corpus 16 (elastic 16)
  • zip corpus 4 (elastic 4)
field:"file.extension" kind:wildcard
file.pathwildcard
  • ?:\ProgramData\* corpus 2 (elastic 2)
  • ?:\Users\*\AppData\Local\Microsoft\Windows\INetCache\IE\* corpus 3 (elastic 3)
  • ?:\Users\*\Documents\*
  • ?:\Users\*\Music\*
  • ?:\Users\*\Pictures\*
  • ?:\Users\Public\*
  • ?:\Windows\System32\tasks\* corpus 6 (elastic 6)
  • ?:\Windows\Tasks\* corpus 7 (elastic 7)
field:"TargetFilename" kind:wildcard
process.namewildcard
  • CertReq.exe corpus 20 (elastic 20)
  • CertUtil.exe corpus 44 (elastic 38, splunk 6)
  • excel.exe corpus 34 (elastic 34)
  • powerpnt.exe corpus 31 (elastic 31)
  • winword.exe corpus 35 (elastic 35)
field:"process_name" kind:wildcard