Detection rules › Elastic

Unsigned DLL from Suspicious Directory

Source
github.com/elastic/protections-artifacts

Identifies a Windows trusted program running from locations often abused by adversaries to masquerade as a trusted program and loading a recently dropped DLL. This behavior may indicate an attempt to evade defenses via side-loading a malicious DLL within the memory space of a signed processes.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies a Windows trusted program running from locations often abused by adversaries to masquerade as a trusted
program and loading a recently dropped DLL. This behavior may indicate an attempt to evade defenses via side-loading a
malicious DLL within the memory space of a signed processes.
"""
id = "971462bd-6f34-4199-b79b-b5e26644a177"
license = "Elastic License v2"
name = "Unsigned DLL from Suspicious Directory"
os_list = ["windows"]
version = "1.0.13"

query = '''
library where

 process.code_signature.trusted == true and dll.path != null and

  dll.Ext.relative_file_creation_time <= 500 and

  not dll.code_signature.status : ("trusted", "errorCode_endpoint*") and

      /* Suspicious Paths */
      dll.path : ("?:\\PerfLogs\\*.dll",
                  "?:\\Users\\*\\Pictures\\*.dll",
                  "?:\\Users\\*\\Music\\*.dll",
                  "?:\\Users\\Public\\*.dll",
                  "?:\\Windows\\Tasks\\*.dll",
                  "?:\\Windows\\System32\\Tasks\\*.dll",
                  "?:\\Intel\\*.dll",
                  "?:\\AMD\\Temp\\*.dll",
                  "?:\\Windows\\AppReadiness\\*.dll",
                  "?:\\Windows\\ServiceState\\*.dll",
                  "?:\\Windows\\security\\*.dll",
                  "?:\\Windows\\System\\*.dll",
                  "?:\\Windows\\IdentityCRL\\*.dll",
                  "?:\\Windows\\Branding\\*.dll",
                  "?:\\Windows\\csc\\*.dll",
                  "?:\\Windows\\DigitalLocker\\*.dll",
                  "?:\\Windows\\en-US\\*.dll",
                  "?:\\Windows\\wlansvc\\*.dll",
                  "?:\\Windows\\Prefetch\\*.dll",
                  "?:\\Windows\\Fonts\\*.dll",
                  "?:\\Windows\\diagnostics\\*.dll",
                  "?:\\Windows\\TAPI\\*.dll",
                  "?:\\Windows\\INF\\*.dll",
                  "?:\\windows\\tracing\\*.dll",
                  "?:\\windows\\IME\\*.dll",
                  "?:\\Windows\\Performance\\*.dll",
                  "?:\\windows\\intel\\*.dll",
                  "?:\\windows\\ms\\*.dll",
                  "?:\\Windows\\dot3svc\\*.dll",
                  "?:\\Windows\\ServiceProfiles\\*.dll",
                  "?:\\Windows\\panther\\*.dll",
                  "?:\\Windows\\RemotePackages\\*.dll",
                  "?:\\Windows\\OCR\\*.dll",
                  "?:\\Windows\\appcompat\\*.dll",
                  "?:\\Windows\\apppatch\\*.dll",
                  "?:\\Windows\\addins\\*.dll",
                  "?:\\Windows\\Setup\\*.dll",
                  "?:\\Windows\\Help\\*.dll",
                  "?:\\Windows\\SKB\\*.dll",
                  "?:\\Windows\\Vss\\*.dll",
                  "?:\\Windows\\Web\\*.dll",
                  "?:\\Windows\\servicing\\*.dll",
                  "?:\\Windows\\CbsTemp\\*.dll",
                  "?:\\Windows\\Logs\\*.dll",
                  "?:\\Windows\\WaaS\\*.dll",
                  "?:\\Windows\\twain_32\\*.dll",
                  "?:\\Windows\\ShellExperiences\\*.dll",
                  "?:\\Windows\\ShellComponents\\*.dll",
                  "?:\\Windows\\PLA\\*.dll",
                  "?:\\Windows\\Migration\\*.dll",
                  "?:\\Windows\\debug\\*.dll",
                  "?:\\Windows\\hp\\*.dll",
                  "?:\\Windows\\Cursors\\*.dll",
                  "?:\\Windows\\Containers\\*.dll",
                  "?:\\Windows\\Boot\\*.dll",
                  "?:\\Windows\\bcastdvr\\*.dll",
                  "?:\\Windows\\TextInput\\*.dll",
                  "?:\\Windows\\schemas\\*.dll",
                  "?:\\Windows\\SchCache\\*.dll",
                  "?:\\Windows\\Resources\\*.dll",
                  "?:\\Windows\\rescache\\*.dll",
                  "?:\\Windows\\Provisioning\\*.dll",
                  "?:\\Windows\\PrintDialog\\*.dll",
                  "?:\\Windows\\PolicyDefinitions\\*.dll",
                  "?:\\Windows\\media\\*.dll",
                  "?:\\Windows\\Globalization\\*.dll",
                  "?:\\Windows\\L2Schemas\\*.dll",
                  "?:\\Windows\\LiveKernelReports\\*.dll",
                  "?:\\Windows\\ModemLogs\\*.dll",
                  "?:\\Windows\\ImmersiveControlPanel\\*.dll",
                  "?:\\$Recycle.Bin\\*.dll",
                  "?:\\aaAntiRansomElastic-DO-NOT-TOUCH-*") and

	 /* DLL loaded from the process.executable current directory */
	 endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1))) and

	 not (process.code_signature.trusted == true and process.code_signature.subject_name : ("PFU LIMITED", "SEIKO EPSON CORPORATION") and
	      process.executable : "?:\\Windows\\twain_32\\*.exe") and

	 not (process.code_signature.trusted == true and
	      process.code_signature.subject_name :
	              ("Bedford, Freeman & Worth Publishing Group, LLC",
	               "Delta Electronics, Inc.",
	               "Hangzhou Hikvision Digital Tech.Co.,Ltd")) and
	 not dll.hash.sha256 : "7aea82c8c38a88e7c66ccae246367c261a6c230b5ce4540c7970c8eb1d8dc6ca"
'''

min_endpoint_version = "8.10.0"
reputation = true
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[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 = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"


[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: library

library where
 process.code_signature.trusted == true and dll.path != null and
  dll.Ext.relative_file_creation_time <= 500 and
  not dll.code_signature.status : ("trusted", "errorCode_endpoint*") and
      dll.path : ("?:\\PerfLogs\\*.dll",
                  "?:\\Users\\*\\Pictures\\*.dll",
                  "?:\\Users\\*\\Music\\*.dll",
                  "?:\\Users\\Public\\*.dll",
                  "?:\\Windows\\Tasks\\*.dll",
                  "?:\\Windows\\System32\\Tasks\\*.dll",
                  "?:\\Intel\\*.dll",
                  "?:\\AMD\\Temp\\*.dll",
                  "?:\\Windows\\AppReadiness\\*.dll",
                  "?:\\Windows\\ServiceState\\*.dll",
                  "?:\\Windows\\security\\*.dll",
                  "?:\\Windows\\System\\*.dll",
                  "?:\\Windows\\IdentityCRL\\*.dll",
                  "?:\\Windows\\Branding\\*.dll",
                  "?:\\Windows\\csc\\*.dll",
                  "?:\\Windows\\DigitalLocker\\*.dll",
                  "?:\\Windows\\en-US\\*.dll",
                  "?:\\Windows\\wlansvc\\*.dll",
                  "?:\\Windows\\Prefetch\\*.dll",
                  "?:\\Windows\\Fonts\\*.dll",
                  "?:\\Windows\\diagnostics\\*.dll",
                  "?:\\Windows\\TAPI\\*.dll",
                  "?:\\Windows\\INF\\*.dll",
                  "?:\\windows\\tracing\\*.dll",
                  "?:\\windows\\IME\\*.dll",
                  "?:\\Windows\\Performance\\*.dll",
                  "?:\\windows\\intel\\*.dll",
                  "?:\\windows\\ms\\*.dll",
                  "?:\\Windows\\dot3svc\\*.dll",
                  "?:\\Windows\\ServiceProfiles\\*.dll",
                  "?:\\Windows\\panther\\*.dll",
                  "?:\\Windows\\RemotePackages\\*.dll",
                  "?:\\Windows\\OCR\\*.dll",
                  "?:\\Windows\\appcompat\\*.dll",
                  "?:\\Windows\\apppatch\\*.dll",
                  "?:\\Windows\\addins\\*.dll",
                  "?:\\Windows\\Setup\\*.dll",
                  "?:\\Windows\\Help\\*.dll",
                  "?:\\Windows\\SKB\\*.dll",
                  "?:\\Windows\\Vss\\*.dll",
                  "?:\\Windows\\Web\\*.dll",
                  "?:\\Windows\\servicing\\*.dll",
                  "?:\\Windows\\CbsTemp\\*.dll",
                  "?:\\Windows\\Logs\\*.dll",
                  "?:\\Windows\\WaaS\\*.dll",
                  "?:\\Windows\\twain_32\\*.dll",
                  "?:\\Windows\\ShellExperiences\\*.dll",
                  "?:\\Windows\\ShellComponents\\*.dll",
                  "?:\\Windows\\PLA\\*.dll",
                  "?:\\Windows\\Migration\\*.dll",
                  "?:\\Windows\\debug\\*.dll",
                  "?:\\Windows\\hp\\*.dll",
                  "?:\\Windows\\Cursors\\*.dll",
                  "?:\\Windows\\Containers\\*.dll",
                  "?:\\Windows\\Boot\\*.dll",
                  "?:\\Windows\\bcastdvr\\*.dll",
                  "?:\\Windows\\TextInput\\*.dll",
                  "?:\\Windows\\schemas\\*.dll",
                  "?:\\Windows\\SchCache\\*.dll",
                  "?:\\Windows\\Resources\\*.dll",
                  "?:\\Windows\\rescache\\*.dll",
                  "?:\\Windows\\Provisioning\\*.dll",
                  "?:\\Windows\\PrintDialog\\*.dll",
                  "?:\\Windows\\PolicyDefinitions\\*.dll",
                  "?:\\Windows\\media\\*.dll",
                  "?:\\Windows\\Globalization\\*.dll",
                  "?:\\Windows\\L2Schemas\\*.dll",
                  "?:\\Windows\\LiveKernelReports\\*.dll",
                  "?:\\Windows\\ModemLogs\\*.dll",
                  "?:\\Windows\\ImmersiveControlPanel\\*.dll",
                  "?:\\$Recycle.Bin\\*.dll",
                  "?:\\aaAntiRansomElastic-DO-NOT-TOUCH-*") and
	 endswith~(substring(dll.path, 0, length(dll.path) - (length(dll.name) + 1)), substring(process.executable, 0, length(process.executable) - (length(process.name) + 1))) and
	 not (process.code_signature.trusted == true and process.code_signature.subject_name : ("PFU LIMITED", "SEIKO EPSON CORPORATION") and
	      process.executable : "?:\\Windows\\twain_32\\*.exe") and
	 not (process.code_signature.trusted == true and
	      process.code_signature.subject_name :
	              ("Bedford, Freeman & Worth Publishing Group, LLC",
	               "Delta Electronics, Inc.",
	               "Hangzhou Hikvision Digital Tech.Co.,Ltd")) and
	 not dll.hash.sha256 : "7aea82c8c38a88e7c66ccae246367c261a6c230b5ce4540c7970c8eb1d8dc6ca"

Exclusions

The rule actively suppresses these predicates.

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
dll.Ext.relative_file_creation_timele
  • 500 transforms: number corpus 11 (elastic 11)
field:"dll.Ext.relative_file_creation_time" kind:le value:"500"
dll.pathis_not_null
  • (no value, null check)
field:"ImageLoaded" kind:is_not_null
dll.pathwildcard
  • ?:\$Recycle.Bin\*.dll corpus 2 (elastic 2)
  • ?:\AMD\Temp\*.dll corpus 2 (elastic 2)
  • ?:\Intel\*.dll corpus 2 (elastic 2)
  • ?:\PerfLogs\*.dll corpus 2 (elastic 2)
  • ?:\Users\*\Music\*.dll corpus 2 (elastic 2)
  • ?:\Users\*\Pictures\*.dll corpus 2 (elastic 2)
  • ?:\Users\Public\*.dll corpus 2 (elastic 2)
  • ?:\Windows\AppReadiness\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Boot\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Branding\*.dll corpus 2 (elastic 2)
  • ?:\Windows\CbsTemp\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Containers\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Cursors\*.dll corpus 2 (elastic 2)
  • ?:\Windows\DigitalLocker\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Fonts\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Globalization\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Help\*.dll corpus 2 (elastic 2)
  • ?:\Windows\INF\*.dll corpus 2 (elastic 2)
  • ?:\Windows\IdentityCRL\*.dll corpus 2 (elastic 2)
  • ?:\Windows\ImmersiveControlPanel\*.dll corpus 2 (elastic 2)
  • ?:\Windows\L2Schemas\*.dll corpus 2 (elastic 2)
  • ?:\Windows\LiveKernelReports\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Logs\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Migration\*.dll corpus 2 (elastic 2)
  • ?:\Windows\ModemLogs\*.dll corpus 2 (elastic 2)
  • ?:\Windows\OCR\*.dll corpus 2 (elastic 2)
  • ?:\Windows\PLA\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Performance\*.dll corpus 2 (elastic 2)
  • ?:\Windows\PolicyDefinitions\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Prefetch\*.dll corpus 2 (elastic 2)
  • ?:\Windows\PrintDialog\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Provisioning\*.dll corpus 2 (elastic 2)
  • ?:\Windows\RemotePackages\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Resources\*.dll corpus 2 (elastic 2)
  • ?:\Windows\SKB\*.dll corpus 2 (elastic 2)
  • ?:\Windows\SchCache\*.dll corpus 2 (elastic 2)
  • ?:\Windows\ServiceProfiles\*.dll corpus 2 (elastic 2)
  • ?:\Windows\ServiceState\*.dll corpus 2 (elastic 2)
  • ?:\Windows\Setup\*.dll corpus 2 (elastic 2)
  • ?:\Windows\ShellComponents\*.dll corpus 2 (elastic 2)
  • +32 more values (see full rule source)
field:"ImageLoaded" kind:wildcard
process.code_signature.trustedeq
  • true transforms: boolean corpus 14 (elastic 14)
field:"process.code_signature.trusted" kind:eq value:"true"