Detection rules › Elastic

Potential Parent Process PID Spoofing via MalSecLogon

Source
github.com/elastic/protections-artifacts

Identifies potential parent process spoofing via abusing the seclogon service. Adversaries may spoof the parent process identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies potential parent process spoofing via abusing the seclogon service. Adversaries may spoof the parent process
identifier (PPID) of a new process to evade process-monitoring defenses or to elevate privileges.
"""
id = "3bd31cbf-b581-41b7-b021-020cc64cfd9d"
license = "Elastic License v2"
name = "Potential Parent Process PID Spoofing via MalSecLogon"
os_list = ["windows"]
reference = ["https://splintercod3.blogspot.com/p/the-hidden-side-of-seclogon-part-2.html"]
version = "1.0.36"

query = '''
process where event.action == "start" and

   process.Ext.session_info.logon_type : "NewCredentials" and

   process.parent.Ext.real.pid > 0 and not process.Ext.token.integrity_level_name == "system" and

   /* dirs hosting interesting processes to spoof as parent process like Explorer.exe */
   process.parent.executable regex~ """(c:\\windows\\system32\\[a-z0-9\-\_\.]+\.exe|c:\\windows\\syswow64\\[a-z0-9\-\_\.]+\.exe|c:\\windows\\[a-z0-9\-\_\.]+\.exe)""" and

    /* common secLogon Clients running from trusted directories */
    not (process.parent.executable : "?:\\WINDOWS\\Explorer.EXE" and process.name : "rundll32.exe" and process.command_line : "*SHELL32.dll,RunAsNewUser_RunDLL*") and

    not (process.parent.executable : ("?:\\Windows\\System32\\runas.exe", "?:\\WINDOWS\\system32\\ShellRunas.exe", "?:\\Windows\\SysWOW64\\runas.exe") and
        process.parent.args_count >= 2) and

    not (process.parent.executable : "?:\\WINDOWS\\System32\\svchost.exe" and process.parent.args : "WdiServiceHost" and
         process.name : "rundll32.exe" and process.command_line : "*winethc.dll*ForceProxyDetectionOnNextRun*") and

    not (process.parent.executable : "?:\\Windows\\Sys*\\OneDriveSetup.exe" and process.parent.args : ("/thfirstsetup", "/uninstall") and
         process.pe.original_file_name in ("OneDrive.exe", "OneDriveSetup.exe") and
         process.code_signature.subject_name : "Microsoft *" and process.code_signature.trusted == true) and

    not (process.parent.executable : "?:\\Windows\\Sys*\\MsiExec.exe" and process.parent.args : "-Embedding") and

    not (process.parent.executable : "?:\\Windows\\System32\\consent.exe" and process.executable : "?:\\WINDOWS\\system32\\UserAccountControlSettings.exe") and

    /* RunAs execution via windows scripts */
    not process.parent.name : ("cscript.exe", "powershell.exe", "wscript.exe") and

    not process.parent.executable : ("?:\\windows\\system32\\ServerManager.exe", "?:\\Windows\\System32\\LogonUI.exe", "?:\\Windows\\System32\\dgagent\\dsagent.exe") and

    not (process.parent.executable : "?:\\Windows\\System32\\mmc.exe" and process.executable : "?:\\Windows\\system32\\gpupdate.exe") and

    not (process.pe.original_file_name == "OffCATcmd.exe" and process.code_signature.subject_name == "Microsoft Corporation" and
         process.code_signature.trusted == true and process.parent.executable : "?:\\Windows\\System32\\sdiagnhost.exe") and 
	 
    not (process.parent.name : "rundll32.exe" and process.parent.args : "?:\\WINDOWS\\Installer\\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc") and

    not (process.code_signature.subject_name in ("Articulate Global, Inc.", "Samsung Electronics CO., LTD.", "SCHNEIDER ELECTRIC USA, INC.") and
         process.code_signature.trusted == true) and
    not process.executable : ("?:\\Windows\\System32\\SpecopsClient\\SecuredBrowserNet\\*.exe", "?:\\Windows\\System32\\DriverStore\\FileRepository\\*\\SamsungSystemSupportOSD.exe") and
    not (process.executable : "?:\\Windows\\SysWOW64\\OneDriveSetup.exe" and process.parent.executable : "?:\\Windows\\SysWOW64\\OneDriveSetup.exe") and

    not process.executable : "?:\\Windows\\System32\\DriverStore\\FileRepository\\*.exe" and

    not (process.code_signature.subject_name : ("TeamViewer*", "Schneider Electric") and process.code_signature.trusted == true) and

    not (process.pe.original_file_name : "VCPkgSrv.exe" and process.code_signature.trusted == true) and

    not process.executable : "?:\\Program Files (x86)\\Varian\\OCS\\*\\VMS.Varis.Vishnu.exe" and
    not (process.parent.executable : "C:\\Windows\\System32\\mmc.exe" and process.executable : "C:\\Windows\\System32\\mmc.exe" and process.args : "/server:*")
'''

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1134"
name = "Access Token Manipulation"
reference = "https://attack.mitre.org/techniques/T1134/"
[[threat.technique.subtechnique]]
id = "T1134.004"
name = "Parent PID Spoofing"
reference = "https://attack.mitre.org/techniques/T1134/004/"



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

[internal]
min_endpoint_version = "8.6.0"

Stages and Predicates

Stage 1: process

process where event.action == "start" and
   process.Ext.session_info.logon_type : "NewCredentials" and
   process.parent.Ext.real.pid > 0 and not process.Ext.token.integrity_level_name == "system" and
   process.parent.executable regex~ """(c:\\windows\\system32\\[a-z0-9\-\_\.]+\.exe|c:\\windows\\syswow64\\[a-z0-9\-\_\.]+\.exe|c:\\windows\\[a-z0-9\-\_\.]+\.exe)""" and
    not (process.parent.executable : "?:\\WINDOWS\\Explorer.EXE" and process.name : "rundll32.exe" and process.command_line : "*SHELL32.dll,RunAsNewUser_RunDLL*") and
    not (process.parent.executable : ("?:\\Windows\\System32\\runas.exe", "?:\\WINDOWS\\system32\\ShellRunas.exe", "?:\\Windows\\SysWOW64\\runas.exe") and
        process.parent.args_count >= 2) and
    not (process.parent.executable : "?:\\WINDOWS\\System32\\svchost.exe" and process.parent.args : "WdiServiceHost" and
         process.name : "rundll32.exe" and process.command_line : "*winethc.dll*ForceProxyDetectionOnNextRun*") and
    not (process.parent.executable : "?:\\Windows\\Sys*\\OneDriveSetup.exe" and process.parent.args : ("/thfirstsetup", "/uninstall") and
         process.pe.original_file_name in ("OneDrive.exe", "OneDriveSetup.exe") and
         process.code_signature.subject_name : "Microsoft *" and process.code_signature.trusted == true) and
    not (process.parent.executable : "?:\\Windows\\Sys*\\MsiExec.exe" and process.parent.args : "-Embedding") and
    not (process.parent.executable : "?:\\Windows\\System32\\consent.exe" and process.executable : "?:\\WINDOWS\\system32\\UserAccountControlSettings.exe") and
    not process.parent.name : ("cscript.exe", "powershell.exe", "wscript.exe") and
    not process.parent.executable : ("?:\\windows\\system32\\ServerManager.exe", "?:\\Windows\\System32\\LogonUI.exe", "?:\\Windows\\System32\\dgagent\\dsagent.exe") and
    not (process.parent.executable : "?:\\Windows\\System32\\mmc.exe" and process.executable : "?:\\Windows\\system32\\gpupdate.exe") and
    not (process.pe.original_file_name == "OffCATcmd.exe" and process.code_signature.subject_name == "Microsoft Corporation" and
         process.code_signature.trusted == true and process.parent.executable : "?:\\Windows\\System32\\sdiagnhost.exe") and
    not (process.parent.name : "rundll32.exe" and process.parent.args : "?:\\WINDOWS\\Installer\\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc") and
    not (process.code_signature.subject_name in ("Articulate Global, Inc.", "Samsung Electronics CO., LTD.", "SCHNEIDER ELECTRIC USA, INC.") and
         process.code_signature.trusted == true) and
    not process.executable : ("?:\\Windows\\System32\\SpecopsClient\\SecuredBrowserNet\\*.exe", "?:\\Windows\\System32\\DriverStore\\FileRepository\\*\\SamsungSystemSupportOSD.exe") and
    not (process.executable : "?:\\Windows\\SysWOW64\\OneDriveSetup.exe" and process.parent.executable : "?:\\Windows\\SysWOW64\\OneDriveSetup.exe") and
    not process.executable : "?:\\Windows\\System32\\DriverStore\\FileRepository\\*.exe" and
    not (process.code_signature.subject_name : ("TeamViewer*", "Schneider Electric") and process.code_signature.trusted == true) and
    not (process.pe.original_file_name : "VCPkgSrv.exe" and process.code_signature.trusted == true) and
    not process.executable : "?:\\Program Files (x86)\\Varian\\OCS\\*\\VMS.Varis.Vishnu.exe" and
    not (process.parent.executable : "C:\\Windows\\System32\\mmc.exe" and process.executable : "C:\\Windows\\System32\\mmc.exe" and process.args : "/server:*")

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argsstarts_with/server:excludes:process.args field:"process.args" value:"/server:"
process.executableeqC:\Windows\System32\mmc.exeexcludes:process.executable field:"process.executable" value:"C:\Windows\System32\mmc.exe"
process.parent.executableeqC:\Windows\System32\mmc.exeexcludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\mmc.exe"
process.code_signature.subject_nameeqMicrosoft Corporationexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft Corporation"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.parent.executableeq?:\Windows\System32\sdiagnhost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\sdiagnhost.exe"
process.pe.original_file_nameeqOffCATcmd.exeexcludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"OffCATcmd.exe"
process.code_signature.subject_nameinArticulate Global, Inc., SCHNEIDER ELECTRIC USA, INC., Samsung Electronics CO., LTD.excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Articulate Global, Inc." field:"process.code_signature.subject_name" value:"SCHNEIDER ELECTRIC USA, INC." field:"process.code_signature.subject_name" value:"Samsung Electronics CO., LTD."
process.code_signature.subject_namestarts_withMicrosoft excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft "
process.parent.argseq/thfirstsetup, /uninstallexcludes:process.parent.args field:"process.parent.args" value:"/thfirstsetup" field:"process.parent.args" value:"/uninstall"
process.parent.executablewildcard?:\Windows\Sys*\OneDriveSetup.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\Sys*\OneDriveSetup.exe"
process.pe.original_file_nameinOneDrive.exe, OneDriveSetup.exeexcludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"OneDrive.exe" field:"process.pe.original_file_name" value:"OneDriveSetup.exe"
process.code_signature.subject_namewildcardTeamViewer*, Schneider Electricexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"TeamViewer*" field:"process.code_signature.subject_name" value:"Schneider Electric"
process.pe.original_file_nameeqVCPkgSrv.exeexcludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"VCPkgSrv.exe"
process.command_linematchSHELL32.dll,RunAsNewUser_RunDLLexcludes:process.command_line field:"process.command_line" value:"SHELL32.dll,RunAsNewUser_RunDLL"
process.nameeqrundll32.exeexcludes:process.name field:"process.name" value:"rundll32.exe"
process.parent.executableeq?:\WINDOWS\Explorer.EXEexcludes:process.parent.executable field:"process.parent.executable" value:"?:\WINDOWS\Explorer.EXE"
process.command_linewildcard*winethc.dll*ForceProxyDetectionOnNextRun*excludes:process.command_line field:"process.command_line" value:"*winethc.dll*ForceProxyDetectionOnNextRun*"
process.parent.argseqWdiServiceHostexcludes:process.parent.args field:"process.parent.args" value:"WdiServiceHost"
process.parent.executableeq?:\WINDOWS\System32\svchost.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\WINDOWS\System32\svchost.exe"
process.executableeq?:\WINDOWS\system32\UserAccountControlSettings.exeexcludes:process.executable field:"process.executable" value:"?:\WINDOWS\system32\UserAccountControlSettings.exe"
process.parent.executableeq?:\Windows\System32\consent.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\consent.exe"
process.executableeq?:\Windows\SysWOW64\OneDriveSetup.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\SysWOW64\OneDriveSetup.exe"
process.parent.executableeq?:\Windows\SysWOW64\OneDriveSetup.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\SysWOW64\OneDriveSetup.exe"
process.executableeq?:\Windows\system32\gpupdate.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\system32\gpupdate.exe"
process.parent.executableeq?:\Windows\System32\mmc.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\mmc.exe"
process.parent.argseq-Embeddingexcludes:process.parent.args field:"process.parent.args" value:"-Embedding"
process.parent.executablewildcard?:\Windows\Sys*\MsiExec.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\Sys*\MsiExec.exe"
process.parent.argswildcard?:\WINDOWS\Installer\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProcexcludes:process.parent.args field:"process.parent.args" value:"?:\WINDOWS\Installer\MSI*.tmp,zzzzInvokeManagedCustomActionOutOfProc"
process.parent.nameeqrundll32.exeexcludes:process.parent.name field:"process.parent.name" value:"rundll32.exe"
process.parent.args_countge2excludes:process.parent.args_count field:"process.parent.args_count" value:"2"
process.parent.executableeq?:\Windows\System32\runas.exe, ?:\WINDOWS\system32\ShellRunas.exe, ?:\Windows\SysWOW64\runas.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\runas.exe" field:"process.parent.executable" value:"?:\WINDOWS\system32\ShellRunas.exe" field:"process.parent.executable" value:"?:\Windows\SysWOW64\runas.exe"
process.Ext.token.integrity_level_nameeqsystemexcludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system"
process.executablewildcard?:\Program Files (x86)\Varian\OCS\*\VMS.Varis.Vishnu.exeexcludes:process.executable field:"process.executable" value:"?:\Program Files (x86)\Varian\OCS\*\VMS.Varis.Vishnu.exe"
process.executablewildcard?:\Windows\System32\DriverStore\FileRepository\*.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\DriverStore\FileRepository\*.exe"
process.executablewildcard?:\Windows\System32\SpecopsClient\SecuredBrowserNet\*.exe, ?:\Windows\System32\DriverStore\FileRepository\*\SamsungSystemSupportOSD.exeexcludes:process.executable field:"process.executable" value:"?:\Windows\System32\SpecopsClient\SecuredBrowserNet\*.exe" field:"process.executable" value:"?:\Windows\System32\DriverStore\FileRepository\*\SamsungSystemSupportOSD.exe"
process.parent.executableeq?:\windows\system32\ServerManager.exe, ?:\Windows\System32\LogonUI.exe, ?:\Windows\System32\dgagent\dsagent.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\windows\system32\ServerManager.exe" field:"process.parent.executable" value:"?:\Windows\System32\LogonUI.exe" field:"process.parent.executable" value:"?:\Windows\System32\dgagent\dsagent.exe"
process.parent.nameeqcscript.exe, powershell.exe, wscript.exeexcludes:process.parent.name field:"process.parent.name" value:"cscript.exe" field:"process.parent.name" value:"powershell.exe" field:"process.parent.name" value:"wscript.exe"

Indicators

These rows show field, operator, and value matches.