Detection rules › Elastic

Potential Evasion via Oversized Image Load

Time window
1m
Sequence by
dll.path, file.path
Source
github.com/elastic/protections-artifacts

Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This can be done without affecting the functionality or behavior of a binary, but can increase the size of the binary beyond what some security tools are capable of handling due to file size limitations

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Adversaries may use binary padding to add junk data and change the on-disk representation of malware. This can be done
without affecting the functionality or behavior of a binary, but can increase the size of the binary beyond what some
security tools are capable of handling due to file size limitations
"""
id = "65a402ff-904b-4d14-b7aa-fa0c5ae575f8"
license = "Elastic License v2"
name = "Potential Evasion via Oversized Image Load"
os_list = ["windows"]
reference = [
    "https://attack.mitre.org/techniques/T1027/001/",
    "https://www.elastic.co/security-labs/Hunting-for-Suspicious-Windows-Libraries-for-Execution-and-Evasion",
]
version = "1.0.27"

query = '''
sequence with maxspan=1m
 [file where event.action != "deletion" and
   /* over 100MB in size */
   file.size >= 100000000 and file.Ext.header_bytes : "4d5a*" and not file.extension : "exe" and
   not user.id : "S-1-5-18" and
  not (process.code_signature.subject_name in ("Trend Micro, Inc.",  "Azul Systems, Inc.", "Wargaming Group Limited",
      "Avigilon Corporation", "Duck Duck Go, Inc.", "Wargaming Group Limited", "Griff Gate Pte. Ltd.", "Corsair Memory, Inc.",
      "Anaconda, Inc.") and
       process.code_signature.status == "trusted") and
  not process.executable : ("C:\\ProgramData\\slicer.org\\Slicer *\\bin\\python-real.exe", "C:\\Program Files\\burpsuite_enterprise\\jres\\*\\bin\\java.exe") and
  not file.path : "C:\\ProgramData\\*\\PyQt5\\Qt5\\bin\\Qt5WebEngineCore.dll"
  ] by file.path
 [library where
    (
     process.name : ("rundll32.exe", "regsvr32.exe", "svchost.exe") or
     process.executable :
               ("?:\\Users\\Public\\*",
                "?:\\ProgramData\\*",
                "?:\\Windows\\Temp\\*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\7z*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\Rar*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\BNZ.*")
     )
    and not dll.code_signature.trusted == true and
    not dll.code_signature.status : "errorExpired" and
    not user.id : "S-1-5-18" and
    not (process.name : "regsvr32.exe" and dll.path : "C:\\Oracle\\*.dll") and
    not (dll.name : "Qt5WebEngineCore.dll" and process.code_signature.subject_name == "Pitney Bowes Inc.")] by dll.path
'''

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique.subtechnique]]
id = "T1027.001"
name = "Binary Padding"
reference = "https://attack.mitre.org/techniques/T1027/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 1m, correlated by dll.path, file.path.

Stage 1: file

[file where event.action != "deletion" and
   file.size >= 100000000 and file.Ext.header_bytes : "4d5a*" and not file.extension : "exe" and
   not user.id : "S-1-5-18" and
  not (process.code_signature.subject_name in ("Trend Micro, Inc.",  "Azul Systems, Inc.", "Wargaming Group Limited",
      "Avigilon Corporation", "Duck Duck Go, Inc.", "Wargaming Group Limited", "Griff Gate Pte. Ltd.", "Corsair Memory, Inc.",
      "Anaconda, Inc.") and
       process.code_signature.status == "trusted") and
  not process.executable : ("C:\\ProgramData\\slicer.org\\Slicer *\\bin\\python-real.exe", "C:\\Program Files\\burpsuite_enterprise\\jres\\*\\bin\\java.exe") and
  not file.path : "C:\\ProgramData\\*\\PyQt5\\Qt5\\bin\\Qt5WebEngineCore.dll"
  ] by file.path

Stage 2: library

[library where
    (
     process.name : ("rundll32.exe", "regsvr32.exe", "svchost.exe") or
     process.executable :
               ("?:\\Users\\Public\\*",
                "?:\\ProgramData\\*",
                "?:\\Windows\\Temp\\*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\Temp?_*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\7z*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\Rar*",
                "?:\\Users\\*\\AppData\\Local\\Temp\\BNZ.*")
     )
    and not dll.code_signature.trusted == true and
    not dll.code_signature.status : "errorExpired" and
    not user.id : "S-1-5-18" and
    not (process.name : "regsvr32.exe" and dll.path : "C:\\Oracle\\*.dll") and
    not (dll.name : "Qt5WebEngineCore.dll" and process.code_signature.subject_name == "Pitney Bowes Inc.")] by dll.path

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.statuseqtrustedexcludes:process.code_signature.status field:"process.code_signature.status" value:"trusted"
process.code_signature.subject_nameinAnaconda, Inc., Avigilon Corporation, Azul Systems, Inc., Corsair Memory, Inc., Duck Duck Go, Inc., Griff Gate Pte. Ltd., Trend Micro, Inc., Wargaming Group Limitedexcludes:process.code_signature.subject_name
file.extensioneqexeexcludes:file.extension field:"file.extension" value:"exe"
file.pathwildcardC:\ProgramData\*\PyQt5\Qt5\bin\Qt5WebEngineCore.dllexcludes:file.path field:"file.path" value:"C:\ProgramData\*\PyQt5\Qt5\bin\Qt5WebEngineCore.dll"
process.executablewildcardC:\ProgramData\slicer.org\Slicer *\bin\python-real.exe, C:\Program Files\burpsuite_enterprise\jres\*\bin\java.exeexcludes:process.executable field:"process.executable" value:"C:\ProgramData\slicer.org\Slicer *\bin\python-real.exe" field:"process.executable" value:"C:\Program Files\burpsuite_enterprise\jres\*\bin\java.exe"
user.ideqS-1-5-18excludes:user.id field:"user.id" value:"S-1-5-18"
dll.nameeqQt5WebEngineCore.dllexcludes:dll.name field:"dll.name" value:"Qt5WebEngineCore.dll"
process.code_signature.subject_nameeqPitney Bowes Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Pitney Bowes Inc."
dll.pathwildcardC:\Oracle\*.dllexcludes:dll.path field:"dll.path" value:"C:\Oracle\*.dll"
process.nameeqregsvr32.exeexcludes:process.name field:"process.name" value:"regsvr32.exe"
dll.code_signature.statuseqerrorExpiredexcludes:dll.code_signature.status field:"dll.code_signature.status" value:"errorExpired"
dll.code_signature.trustedeqtrueexcludes:dll.code_signature.trusted field:"dll.code_signature.trusted" value:"true"

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
  • 4d5a* corpus 46 (elastic 46)
field:"file.Ext.header_bytes" kind:wildcard value:"4d5a*"
file.sizege
  • 100000000 transforms: number corpus 2 (elastic 2)
field:"file.size" kind:ge value:"100000000"
process.executablewildcard
  • ?:\ProgramData\* corpus 17 (elastic 17)
  • ?:\Users\*\AppData\Local\Temp\7z* corpus 4 (elastic 4)
  • ?:\Users\*\AppData\Local\Temp\BNZ.* corpus 7 (elastic 7)
  • ?:\Users\*\AppData\Local\Temp\Rar* corpus 3 (elastic 3)
  • ?:\Users\*\AppData\Local\Temp\Temp?_* corpus 4 (elastic 4)
  • ?:\Users\Public\* corpus 4 (elastic 4)
  • ?:\Windows\Temp\* corpus 9 (elastic 9)
field:"Image" kind:wildcard
process.namewildcard
  • regsvr32.exe corpus 73 (elastic 68, splunk 5)
  • rundll32.exe corpus 126 (elastic 100, splunk 26)
  • svchost.exe corpus 24 (elastic 22, splunk 2)
field:"process_name" kind:wildcard