Detection rules › Elastic

Binary Proxy Execution via Rundll32

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

Identifies the execution of a malicious application via rundll32.exe. Adversaries may abuse rundll32.exe to proxy execution of malicious code and bypass application whitelisting configuration.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of a malicious application via rundll32.exe. Adversaries may abuse rundll32.exe to proxy
execution of malicious code and bypass application whitelisting configuration.
"""
id = "f60455df-5054-49ff-9ff7-1dc4e37b6ea7"
license = "Elastic License v2"
name = "Binary Proxy Execution via Rundll32"
os_list = ["windows"]
reference = [
    "https://lolbas-project.github.io/lolbas/Libraries/Shell32/",
    "https://lolbas-project.github.io/lolbas/Libraries/Zipfldr/",
    "https://lolbas-project.github.io/lolbas/Libraries/Pcwutl/",
    "https://lolbas-project.github.io/lolbas/Libraries/Advpack/",
    "https://lolbas-project.github.io/lolbas/Libraries/Ieadvpack/",
    "https://lolbas-project.github.io/lolbas/Libraries/Url/",
    "https://lolbas-project.github.io/lolbas/Libraries/Desk/",
]
version = "1.0.35"

query = '''
sequence with maxspan=1m
  [process where event.action == "start" and
   process.pe.original_file_name == "RUNDLL32.EXE" and
   process.command_line :
          ("*advpack*RegisterOCX*",
           "*advpack*#12*",
           "*zipfldr*RouteTheCall*",
           "*pcwutl*LaunchApplication*",
           "*pcwutl*#1*",
           "*url.dll*FileProtocolHandler*file://*",
           "*url.dll*FileProtocolHandler*.exe*",
           "*shell32.dll*ShellExec_RunDLL*",
           "*advpack*LaunchINFSection*",
           "*desk*InstallScreenSaver*",
           "*shell32*WaitForExplorerRestart*") and
   /* Issue #265 */
   not (process.command_line : "*url.dll*FileProtocolHandler*" and
        process.command_line : ("*http://*", "*zoommtg://*", "*://*&*&*")) and

   /* Legit LaunchApplication instances via msdt */
   not (process.command_line : "*pcwutl.dll,LaunchApplication*" and
        process.parent.name :  "msdt.exe" and
        process.working_directory : "?:\\Windows\\system32\\") and

   not (process.command_line :  "*shell32*WaitForExplorerRestart*" and process.args : "?:\\Windows\\*explorer.exe") and
   not (process.parent.executable : "C:\\Program Files\\Microsoft OneDrive\\OneDrive.exe" and process.args : "ShellExec_RunDLL")
   ] by process.entity_id
  [process where event.action == "start" and
   not process.executable :
                ("?:\\Program Files\\*",
                 "?:\\Program Files (x86)\\*",
                 "C:\\Windows\\System32\\shutdown.exe",
                 "C:\\Windows\\System32\\WerFault.exe") and
   not (process.executable : "?:\\Windows\\*.scr" and process.parent.args : "desk.cpl,InstallScreenSaver") and
   not (process.name : "wscript.exe" and process.args : "Cathexis Archive Viewer.vbs") and
   not process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and
   not process.Ext.token.integrity_level_name == "system" and
   not process.executable : "?:\\Windows\\System32\\grpconv.exe" and
   not (process.code_signature.subject_name : "Adobe Inc." and process.code_signature.trusted == true) and
   not process.hash.sha256 :
                  ("f6bef3f879e082d115c2ad199a986da1660514699f5e752c7b628d9438d7cb49",
                   "c2831f5b010f099cd1733a0183adfa16cb834a9169fc55c6f7e6dc3267488c3f",
                   "70ebedc5aba37140682a0535eac9f1cfb77cc9916955e36f19ba1da893068a83",
                   "e6caed88fa115a412c744d0ec91f34cd3b5f329d7acdc1cb14e35364d492d095",
                   "af31ac74a9072e4bbc24ff17ee70681539e660d4fa885fcb45e752b5ec21d2ef") and
   not (process.executable : "?:\\Windows\\System32\\msiexec.exe" and process.parent.args : "?:\\WINDOWS\\system32\\pcwutl.dll,LaunchApplication") and 
   not (process.executable : "?:\\Windows\\System32\\verclsid.exe" and process.args : "{71DCE5D6-4B57-496B-AC21-CD5B54EB93FD}" and process.parent.command_line : "*ShellExec_RunDLL*") and 
   not (process.executable : ("?:\\Windows\\System32\\notepad.exe", "?:\\Windows\\System32\\mspaint.exe") and process.parent.command_line : "*ShellExec_RunDLL*")
   ] by process.parent.entity_id
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"



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

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

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

Stage 1: process

[process where event.action == "start" and
   process.pe.original_file_name == "RUNDLL32.EXE" and
   process.command_line :
          ("*advpack*RegisterOCX*",
           "*advpack*#12*",
           "*zipfldr*RouteTheCall*",
           "*pcwutl*LaunchApplication*",
           "*pcwutl*#1*",
           "*url.dll*FileProtocolHandler*file://*",
           "*url.dll*FileProtocolHandler*.exe*",
           "*shell32.dll*ShellExec_RunDLL*",
           "*advpack*LaunchINFSection*",
           "*desk*InstallScreenSaver*",
           "*shell32*WaitForExplorerRestart*") and
   not (process.command_line : "*url.dll*FileProtocolHandler*" and
        process.command_line : ("*http://*", "*zoommtg://*", "*://*&*&*")) and
   not (process.command_line : "*pcwutl.dll,LaunchApplication*" and
        process.parent.name :  "msdt.exe" and
        process.working_directory : "?:\\Windows\\system32\\") and
   not (process.command_line :  "*shell32*WaitForExplorerRestart*" and process.args : "?:\\Windows\\*explorer.exe") and
   not (process.parent.executable : "C:\\Program Files\\Microsoft OneDrive\\OneDrive.exe" and process.args : "ShellExec_RunDLL")
   ] by process.entity_id

Stage 2: process

[process where event.action == "start" and
   not process.executable :
                ("?:\\Program Files\\*",
                 "?:\\Program Files (x86)\\*",
                 "C:\\Windows\\System32\\shutdown.exe",
                 "C:\\Windows\\System32\\WerFault.exe") and
   not (process.executable : "?:\\Windows\\*.scr" and process.parent.args : "desk.cpl,InstallScreenSaver") and
   not (process.name : "wscript.exe" and process.args : "Cathexis Archive Viewer.vbs") and
   not process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*") and
   not process.Ext.token.integrity_level_name == "system" and
   not process.executable : "?:\\Windows\\System32\\grpconv.exe" and
   not (process.code_signature.subject_name : "Adobe Inc." and process.code_signature.trusted == true) and
   not process.hash.sha256 :
                  ("f6bef3f879e082d115c2ad199a986da1660514699f5e752c7b628d9438d7cb49",
                   "c2831f5b010f099cd1733a0183adfa16cb834a9169fc55c6f7e6dc3267488c3f",
                   "70ebedc5aba37140682a0535eac9f1cfb77cc9916955e36f19ba1da893068a83",
                   "e6caed88fa115a412c744d0ec91f34cd3b5f329d7acdc1cb14e35364d492d095",
                   "af31ac74a9072e4bbc24ff17ee70681539e660d4fa885fcb45e752b5ec21d2ef") and
   not (process.executable : "?:\\Windows\\System32\\msiexec.exe" and process.parent.args : "?:\\WINDOWS\\system32\\pcwutl.dll,LaunchApplication") and 
   not (process.executable : "?:\\Windows\\System32\\verclsid.exe" and process.args : "{71DCE5D6-4B57-496B-AC21-CD5B54EB93FD}" and process.parent.command_line : "*ShellExec_RunDLL*") and 
   not (process.executable : ("?:\\Windows\\System32\\notepad.exe", "?:\\Windows\\System32\\mspaint.exe") and process.parent.command_line : "*ShellExec_RunDLL*")
   ] by process.parent.entity_id

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseqShellExec_RunDLLexcludes:process.args field:"process.args" value:"ShellExec_RunDLL"
process.parent.executableeqC:\Program Files\Microsoft OneDrive\OneDrive.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Microsoft OneDrive\OneDrive.exe"
process.argswildcard?:\Windows\*explorer.exeexcludes:process.args field:"process.args" value:"?:\Windows\*explorer.exe"
process.command_linewildcard*shell32*WaitForExplorerRestart*excludes:process.command_line field:"process.command_line" value:"*shell32*WaitForExplorerRestart*"
process.command_linematchpcwutl.dll,LaunchApplicationexcludes:process.command_line field:"process.command_line" value:"pcwutl.dll,LaunchApplication"
process.parent.nameeqmsdt.exeexcludes:process.parent.name field:"process.parent.name" value:"msdt.exe"
process.working_directoryeq?:\Windows\system32\excludes:process.working_directory field:"process.working_directory" value:"?:\Windows\system32\"
process.command_linewildcard*http://*, *zoommtg://*, *://*&*&*excludes:process.command_line field:"process.command_line" value:"*http://*" field:"process.command_line" value:"*zoommtg://*" field:"process.command_line" value:"*://*&*&*"
process.command_linewildcard*url.dll*FileProtocolHandler*excludes:process.command_line field:"process.command_line" value:"*url.dll*FileProtocolHandler*"
process.argseqCathexis Archive Viewer.vbsexcludes:process.args field:"process.args" value:"Cathexis Archive Viewer.vbs"
process.nameeqwscript.exeexcludes:process.name field:"process.name" value:"wscript.exe"
process.argseq{71DCE5D6-4B57-496B-AC21-CD5B54EB93FD}excludes:process.args field:"process.args" value:"{71DCE5D6-4B57-496B-AC21-CD5B54EB93FD}"
process.executableeq?:\Windows\System32\verclsid.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\verclsid.exe"
process.parent.command_linematchShellExec_RunDLLexcludes:process.parent.command_line field:"process.parent.command_line" value:"ShellExec_RunDLL"
process.code_signature.subject_nameeqAdobe Inc.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Adobe Inc."
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.executableeq?:\Windows\System32\msiexec.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\msiexec.exe"
process.parent.argseq?:\WINDOWS\system32\pcwutl.dll,LaunchApplicationexcludes:process.parent.args field:"process.parent.args" value:"?:\WINDOWS\system32\pcwutl.dll,LaunchApplication"
process.executableeq?:\Windows\System32\notepad.exe, ?:\Windows\System32\mspaint.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\notepad.exe" field:"process.executable" value:"?:\Windows\System32\mspaint.exe"
process.executablewildcard?:\Windows\*.screxcludes:process.executable field:"process.executable" value:"?:\Windows\*.scr"
process.parent.argseqdesk.cpl,InstallScreenSaverexcludes:process.parent.args field:"process.parent.args" value:"desk.cpl,InstallScreenSaver"
process.Ext.token.integrity_level_nameeqsystemexcludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system"
process.argsstarts_with?:\Program Files\, ?:\Program Files (x86)\excludes:process.args field:"process.args" value:"?:\Program Files\" field:"process.args" value:"?:\Program Files (x86)\"
process.executableeq?:\Windows\System32\grpconv.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\grpconv.exe"
process.executablewildcard?:\Program Files\*, ?:\Program Files (x86)\*, C:\Windows\System32\shutdown.exe, C:\Windows\System32\WerFault.exeexcludes:process.executable
process.hash.sha256eqf6bef3f879e082d115c2ad199a986da1660514699f5e752c7b628d9438d7cb49, c2831f5b010f099cd1733a0183adfa16cb834a9169fc55c6f7e6dc3267488c3f, 70ebedc5aba37140682a0535eac9f1cfb77cc9916955e36f19ba1da893068a83, e6caed88fa115a412c744d0ec91f34cd3b5f329d7acdc1cb14e35364d492d095, af31ac74a9072e4bbc24ff17ee70681539e660d4fa885fcb45e752b5ec21d2efexcludes:process.hash.sha256

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
process.command_linewildcard
  • *advpack*#12*
  • *advpack*LaunchINFSection* corpus 2 (elastic 2)
  • *advpack*RegisterOCX*
  • *desk*InstallScreenSaver*
  • *pcwutl*#1*
  • *pcwutl*LaunchApplication*
  • *shell32*WaitForExplorerRestart*
  • *shell32.dll*ShellExec_RunDLL*
  • *url.dll*FileProtocolHandler*.exe*
  • *url.dll*FileProtocolHandler*file://*
  • *zipfldr*RouteTheCall*
field:"CommandLine" kind:wildcard
process.pe.original_file_nameeq
  • RUNDLL32.EXE corpus 78 (sigma 35, elastic 22, splunk 21)
field:"OriginalFileName" kind:eq value:"RUNDLL32.EXE"