Detection rules › Elastic
Elastic rules: 1b
Access Token Manipulation via Child Process
#Adversaries may use access tokens to operate under a different user or system security context to elevate privileges and evade detection. For example, an attacker can create a new process that runs under the security context of another user in order to perform actions they would not normally have privileges for.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Adversaries may use access tokens to operate under a different user or system security context to elevate privileges and
evade detection. For example, an attacker can create a new process that runs under the security context of another user
in order to perform actions they would not normally have privileges for.
"""
id = "8bdd523d-7a18-4706-bbe0-1a2525c6979f"
license = "Elastic License v2"
name = "Access Token Manipulation via Child Process"
os_list = ["windows"]
version = "1.0.30"
query = '''
sequence
[process where event.action == "start" and
process.Ext.token.integrity_level_name in ("low", "medium", "high") and user.id != null and
(
/* limit to recently created files or */
process.Ext.relative_file_creation_time < 500 or
/* commonly abused lolbins */
process.name : ("rundll32.exe", "regsvr32.exe", "msbuild.exe")
) and
not (process.executable : "C:\\Windows\\System32\\rundll32.exe" and process.parent.name : "explorer.exe" and
process.args : ("printui.dll,PrintUIEntryDPIAware", "cryptext.dll,CryptExtAddPFX")) and
not (process.code_signature.trusted == true and
process.executable :
("?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"?:\\Users\\*",
"?:\\ProgramData\\*",
"?:\\Windows\\Temp\\*")) and
not (process.name : ("wscript.exe", "cscript.exe", "powershell.exe") and process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
not (process.name : "regsvr32.exe" and process.args : "C:\\Windows\\System32\\mqrt.dll") and
not (process.name : "rundll32.exe" and process.args : "22d8c27b-47a1-48d1-ad08-7da7abd79617" and process.parent.name : "dllhost.exe") and
not process.parent.executable : "C:\\Windows\\System32\\msiexec.exe" and
not process.parent.command_line : "C:\\Windows\\system32\\svchost.exe -k WebClientGroup" and
not (process.parent.name : "explorer.exe" and process.executable : "\\Device\\Mup\\*.exe") and
not (process.name : "rundll32.exe" and
process.args : ("WSClient.dll,RefreshBannedAppsList", "xrWCbgnd.dll,LaunchBgTask", "uxtheme.dll,#64",
"C:\\Windows\\System32\\shell32.dll,SHCreateLocalServerRunDll", "C:\\Windows\\system32\\WerConCpl.dll,",
"C:\\WINDOWS\\system32\\WerConCpl.dll,", "InetCpl.cpl,ClearMyTracksByProcess",
"shell32.dll,SHCreateLocalServerRunDll", "Shell32.dll,Control_RunDLL")) and
not process.parent.executable :
("C:\\Program Files\\Symantec\\Symantec Endpoint Protection\\*\\Bin64\\ccSvcHst.exe",
"C:\\Program Files\\ACCUPLACER Score Client\\ACCUPLACER Score Client.exe") and
process.hash.sha256 != "9e23e07e042943e1862b86d8c9dc05483a118938f5b19f359cb8f9aa6a14a452" and
not (process.pe.original_file_name : "vs_*.exe" and process.code_signature.subject_name == "Microsoft Corporation" and process.code_signature.trusted == true)
] by process.entity_id as event0
[process where event.action == "start" and user.id != null and
not process.Ext.token.integrity_level_name : "system" and
/* running as a different user than its parent process */
user.id != event0.user.id and
/* common FP patterns */
not (process.name : "rundll32.exe" and process.args : "?:\\Windows\\System32\\SHELL32.dll,RunAsNewUser_RunDLL") and
/* non MS signed FPs */
not (process.code_signature.subject_name :
("Lenovo", "Adobe Inc.", "Brave Software, Inc.", "HP Inc.", "Splashtop Inc.", "GN AUDIO A/S",
"Oracle America, Inc.", "Brother Industries, Ltd.", "Bosch Automotive Service Solutions Ltd",
"OpenShot Studios, LLC", "CISCO SYSTEMS, INC.", "SERVICO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO)",
"Wacom Co., Ltd.") and
process.code_signature.trusted == true) and
not process.executable :
("?:\\Windows\\System32\\ntprint.exe",
"?:\\Windows\\System32\\timeout.exe",
"?:\\Windows\\System32\\printui.exe",
"?:\\Windows\\System32\\SndVol.exe",
"?:\\Windows\\System32\\MultiDigiMon.exe",
"C:\\Windows\\SysWOW64\\vsjitdebugger.exe",
"C:\\Windows\\System32\\shutdown.exe",
"C:\\Windows\\System32\\WerFault.exe",
"C:\\Windows\\System32\\OptionalFeatures.exe",
"C:\\Windows\\System32\\conhost.exe",
"C:\\Windows\\SysWOW64\\net1.exe",
"C:\\Windows\\SysWOW64\\net.exe",
"?:\\WINDOWS\\splwow64.exe",
"?:\\Windows\\System32\\SystemPropertiesAdvanced.exe",
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*") and
not process.parent.executable : ("C:\\Windows\\System32\\gpscript.exe",
"C:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
"C:\\Windows\\System32\\ServerManagerLauncher.exe",
"C:\\Program Files\\Accops\\AccopsSessionServerExtensions\\lspPortMapper.exe",
"C:\\Windows\\SysWOW64\\Watchdata\\PROXKey CSP India V3.0\\SPSocketServer.exe") and
not (process.pe.original_file_name : ("Bootstrapper.exe") and process.code_signature.trusted == true) and
not process.hash.sha256 in
("b2b8a7156ec0079a1801db1647d6dbc4206345689772495eac311e0e6afcad57",
"2c476f212dc61977ae3deb9319fa21242524f3b6dd30803715659a9618316089",
"b2f6de33dc0dfd256f9708a09b853a96d5cf5bffcaf52aa1331b3b4242421667",
"a02e0984d790393aea56252f45dd58d25cdfa4501efb40efadecd90145717c35",
"5212286922b7b1bce5fda2c2b25a9dfdef9300736ded91350d08c837ae1e9e1c",
"e18fbe144c938627e3c383e942e8da74ed301612d035f1e7e92557db70d05277",
"c83ef42b6c4c85e24666c8e55b93fb64cf08164e34b85fde0270c03dd463c11f",
"af483a6e34a9b12ed2adcdb388b50311e5c322947718a41bbc325c2d1f3a7393",
"bf73d2a3812ebef4f57cf81a2d24e23287cddefd57183c89535603e878eb7b11",
"24e76fe67435e9c7c1aa9ec22d736de3873fbd2e880d8ae716dffec0e146fc53",
"2a12e554e19d7b59294def0c3047f77c44e8ed899d6bca264935ce03abc82abe",
"e8f1081e08c28f80997b06f0f383957b6ece29347d042387e8ae2dcf93107adc",
"ed7c9415508e0cb0893c77d67400ee52a0c2f54a9992d55e309b14d906fc8545",
"ac3ea3ee1f4d7925888751c05911eaa237786346ad27637d1d4b140b08f1033c") and
not (process.name : ("*setup*.exe", "resource_*.exe") and process.parent.name : "*.tmp" and process.executable : "?:\\Users\\*") and
not process.command_line : "*/SPAWNWND=*/NOTIFYWND=*" and
not (process.pe.imphash == "acbfc62280771933334b67077d6deaba" and process.args : "-burn.elevated") and
not (process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and
not event0.process.hash.sha256 == process.hash.sha256 and
not (process.executable : "C:\\Windows\\System32\\userinit.exe" and process.parent.executable : "C:\\Windows\\System32\\winlogon.exe") and
not (process.executable : "C:\\Windows\\System32\\tabcal.exe" and process.parent.executable : "C:\\Windows\\System32\\rundll32.exe" and
process.parent.args : "C:\\WINDOWS\\System32\\tabletpc.cpl") and
not (process.executable : "C:\\Windows\\System32\\rdpshell.exe" and process.parent.executable : "C:\\Windows\\System32\\rdpinit.exe") and
not (process.executable : "C:\\Windows\\System32\\rdpinit.exe" and process.parent.executable : "C:\\Windows\\System32\\userinit.exe") and
not (process.executable : ("C:\\Windows\\SysWOW64\\taskkill.exe", "C:\\Windows\\SysWOW64\\cmd.exe") and
process.working_directory : ("C:\\Program Files (x86)\\Comhard-Plus\\UserDeskTop\\files\\",
"C:\\Program Files (x86)\\TSplus\\UserDeskTop\\files\\"))
] by process.parent.entity_id
until [process where event.action:"end"] by process.parent.entity_id
'''
min_endpoint_version = "8.6.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1
[[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.002"
name = "Create Process with Token"
reference = "https://attack.mitre.org/techniques/T1134/002/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "8.6.0"
Stages and Predicates
Ordered sequence: each step below must occur in order, correlated by process.entity_id, process.parent.entity_id.
Stage 1: process
[process where event.action == "start" and
process.Ext.token.integrity_level_name in ("low", "medium", "high") and user.id != null and
(
process.Ext.relative_file_creation_time < 500 or
process.name : ("rundll32.exe", "regsvr32.exe", "msbuild.exe")
) and
not (process.executable : "C:\\Windows\\System32\\rundll32.exe" and process.parent.name : "explorer.exe" and
process.args : ("printui.dll,PrintUIEntryDPIAware", "cryptext.dll,CryptExtAddPFX")) and
not (process.code_signature.trusted == true and
process.executable :
("?:\\Program Files\\*",
"?:\\Program Files (x86)\\*",
"?:\\Users\\*",
"?:\\ProgramData\\*",
"?:\\Windows\\Temp\\*")) and
not (process.name : ("wscript.exe", "cscript.exe", "powershell.exe") and process.args : ("?:\\Program Files\\*", "?:\\Program Files (x86)\\*")) and
not (process.name : "regsvr32.exe" and process.args : "C:\\Windows\\System32\\mqrt.dll") and
not (process.name : "rundll32.exe" and process.args : "22d8c27b-47a1-48d1-ad08-7da7abd79617" and process.parent.name : "dllhost.exe") and
not process.parent.executable : "C:\\Windows\\System32\\msiexec.exe" and
not process.parent.command_line : "C:\\Windows\\system32\\svchost.exe -k WebClientGroup" and
not (process.parent.name : "explorer.exe" and process.executable : "\\Device\\Mup\\*.exe") and
not (process.name : "rundll32.exe" and
process.args : ("WSClient.dll,RefreshBannedAppsList", "xrWCbgnd.dll,LaunchBgTask", "uxtheme.dll,#64",
"C:\\Windows\\System32\\shell32.dll,SHCreateLocalServerRunDll", "C:\\Windows\\system32\\WerConCpl.dll,",
"C:\\WINDOWS\\system32\\WerConCpl.dll,", "InetCpl.cpl,ClearMyTracksByProcess",
"shell32.dll,SHCreateLocalServerRunDll", "Shell32.dll,Control_RunDLL")) and
not process.parent.executable :
("C:\\Program Files\\Symantec\\Symantec Endpoint Protection\\*\\Bin64\\ccSvcHst.exe",
"C:\\Program Files\\ACCUPLACER Score Client\\ACCUPLACER Score Client.exe") and
process.hash.sha256 != "9e23e07e042943e1862b86d8c9dc05483a118938f5b19f359cb8f9aa6a14a452" and
not (process.pe.original_file_name : "vs_*.exe" and process.code_signature.subject_name == "Microsoft Corporation" and process.code_signature.trusted == true)
] by process.entity_id as event0
Stage 2: process
[process where event.action == "start" and user.id != null and
not process.Ext.token.integrity_level_name : "system" and
user.id != event0.user.id and
not (process.name : "rundll32.exe" and process.args : "?:\\Windows\\System32\\SHELL32.dll,RunAsNewUser_RunDLL") and
not (process.code_signature.subject_name :
("Lenovo", "Adobe Inc.", "Brave Software, Inc.", "HP Inc.", "Splashtop Inc.", "GN AUDIO A/S",
"Oracle America, Inc.", "Brother Industries, Ltd.", "Bosch Automotive Service Solutions Ltd",
"OpenShot Studios, LLC", "CISCO SYSTEMS, INC.", "SERVICO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO)",
"Wacom Co., Ltd.") and
process.code_signature.trusted == true) and
not process.executable :
("?:\\Windows\\System32\\ntprint.exe",
"?:\\Windows\\System32\\timeout.exe",
"?:\\Windows\\System32\\printui.exe",
"?:\\Windows\\System32\\SndVol.exe",
"?:\\Windows\\System32\\MultiDigiMon.exe",
"C:\\Windows\\SysWOW64\\vsjitdebugger.exe",
"C:\\Windows\\System32\\shutdown.exe",
"C:\\Windows\\System32\\WerFault.exe",
"C:\\Windows\\System32\\OptionalFeatures.exe",
"C:\\Windows\\System32\\conhost.exe",
"C:\\Windows\\SysWOW64\\net1.exe",
"C:\\Windows\\SysWOW64\\net.exe",
"?:\\WINDOWS\\splwow64.exe",
"?:\\Windows\\System32\\SystemPropertiesAdvanced.exe",
"?:\\Program Files\\*",
"?:\\Program Files (x86)\\*") and
not process.parent.executable : ("C:\\Windows\\System32\\gpscript.exe",
"C:\\Windows\\ImmersiveControlPanel\\SystemSettings.exe",
"C:\\Windows\\System32\\ServerManagerLauncher.exe",
"C:\\Program Files\\Accops\\AccopsSessionServerExtensions\\lspPortMapper.exe",
"C:\\Windows\\SysWOW64\\Watchdata\\PROXKey CSP India V3.0\\SPSocketServer.exe") and
not (process.pe.original_file_name : ("Bootstrapper.exe") and process.code_signature.trusted == true) and
not process.hash.sha256 in
("b2b8a7156ec0079a1801db1647d6dbc4206345689772495eac311e0e6afcad57",
"2c476f212dc61977ae3deb9319fa21242524f3b6dd30803715659a9618316089",
"b2f6de33dc0dfd256f9708a09b853a96d5cf5bffcaf52aa1331b3b4242421667",
"a02e0984d790393aea56252f45dd58d25cdfa4501efb40efadecd90145717c35",
"5212286922b7b1bce5fda2c2b25a9dfdef9300736ded91350d08c837ae1e9e1c",
"e18fbe144c938627e3c383e942e8da74ed301612d035f1e7e92557db70d05277",
"c83ef42b6c4c85e24666c8e55b93fb64cf08164e34b85fde0270c03dd463c11f",
"af483a6e34a9b12ed2adcdb388b50311e5c322947718a41bbc325c2d1f3a7393",
"bf73d2a3812ebef4f57cf81a2d24e23287cddefd57183c89535603e878eb7b11",
"24e76fe67435e9c7c1aa9ec22d736de3873fbd2e880d8ae716dffec0e146fc53",
"2a12e554e19d7b59294def0c3047f77c44e8ed899d6bca264935ce03abc82abe",
"e8f1081e08c28f80997b06f0f383957b6ece29347d042387e8ae2dcf93107adc",
"ed7c9415508e0cb0893c77d67400ee52a0c2f54a9992d55e309b14d906fc8545",
"ac3ea3ee1f4d7925888751c05911eaa237786346ad27637d1d4b140b08f1033c") and
not (process.name : ("*setup*.exe", "resource_*.exe") and process.parent.name : "*.tmp" and process.executable : "?:\\Users\\*") and
not process.command_line : "*/SPAWNWND=*/NOTIFYWND=*" and
not (process.pe.imphash == "acbfc62280771933334b67077d6deaba" and process.args : "-burn.elevated") and
not (process.code_signature.trusted == true and not process.code_signature.subject_name : "Microsoft*") and
not event0.process.hash.sha256 == process.hash.sha256 and
not (process.executable : "C:\\Windows\\System32\\userinit.exe" and process.parent.executable : "C:\\Windows\\System32\\winlogon.exe") and
not (process.executable : "C:\\Windows\\System32\\tabcal.exe" and process.parent.executable : "C:\\Windows\\System32\\rundll32.exe" and
process.parent.args : "C:\\WINDOWS\\System32\\tabletpc.cpl") and
not (process.executable : "C:\\Windows\\System32\\rdpshell.exe" and process.parent.executable : "C:\\Windows\\System32\\rdpinit.exe") and
not (process.executable : "C:\\Windows\\System32\\rdpinit.exe" and process.parent.executable : "C:\\Windows\\System32\\userinit.exe") and
not (process.executable : ("C:\\Windows\\SysWOW64\\taskkill.exe", "C:\\Windows\\SysWOW64\\cmd.exe") and
process.working_directory : ("C:\\Program Files (x86)\\Comhard-Plus\\UserDeskTop\\files\\",
"C:\\Program Files (x86)\\TSplus\\UserDeskTop\\files\\"))
] by process.parent.entity_id
Until: process
until [process where event.action:"end"] by process.parent.entity_id
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"start" |
event.action | wildcard |
| field:"EventType" kind:wildcard value:"end" |
process.Ext.relative_file_creation_time | lt |
| field:"process.Ext.relative_file_creation_time" kind:lt value:"500" |
process.Ext.token.integrity_level_name | in |
| field:"process.Ext.token.integrity_level_name" kind:in |
process.code_signature.subject_name | wildcard |
| field:"Signature" kind:wildcard value:"Microsoft*" |
process.hash.sha256 | ne |
| field:"Hashes" kind:ne value:"9e23e07e042943e1862b86d8c9dc05483a118938f5b19f359cb8f9aa6a14a452" |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
user.id | is_not_null | field:"user.id" kind:is_not_null | |
user.id | ne |
| field:"user.id" kind:ne value:"event0.user.id" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | 22d8c27b-47a1-48d1-ad08-7da7abd79617 | excludes:process.args field:"process.args" value:"22d8c27b-47a1-48d1-ad08-7da7abd79617" |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.parent.name | eq | dllhost.exe | excludes:process.parent.name field:"process.parent.name" value:"dllhost.exe" |
process.args | eq | C:\Windows\System32\mqrt.dll | excludes:process.args field:"process.args" value:"C:\Windows\System32\mqrt.dll" |
process.name | eq | regsvr32.exe | excludes:process.name field:"process.name" value:"regsvr32.exe" |
process.args | eq | WSClient.dll,RefreshBannedAppsList, xrWCbgnd.dll,LaunchBgTask, uxtheme.dll,#64, C:\Windows\System32\shell32.dll,SHCreateLocalServerRunDll, C:\Windows\system32\WerConCpl.dll,, C:\WINDOWS\system32\WerConCpl.dll,, InetCpl.cpl,ClearMyTracksByProcess, shell32.dll,SHCreateLocalServerRunDll, Shell32.dll,Control_RunDLL | excludes:process.args |
process.args | eq | printui.dll,PrintUIEntryDPIAware, cryptext.dll,CryptExtAddPFX | excludes:process.args field:"process.args" value:"printui.dll,PrintUIEntryDPIAware" field:"process.args" value:"cryptext.dll,CryptExtAddPFX" |
process.executable | eq | C:\Windows\System32\rundll32.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\rundll32.exe" |
process.parent.name | eq | explorer.exe | excludes:process.parent.name field:"process.parent.name" value:"explorer.exe" |
process.args | starts_with | ?:\Program Files\, ?:\Program Files (x86)\ | excludes:process.args field:"process.args" value:"?:\Program Files\" field:"process.args" value:"?:\Program Files (x86)\" |
process.name | eq | wscript.exe, cscript.exe, powershell.exe | excludes:process.name field:"process.name" value:"wscript.exe" field:"process.name" value:"cscript.exe" field:"process.name" value:"powershell.exe" |
process.code_signature.subject_name | eq | Microsoft Corporation | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft Corporation" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.pe.original_file_name | wildcard | vs_*.exe | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"vs_*.exe" |
process.executable | starts_with | ?:\Program Files\, ?:\Program Files (x86)\, ?:\Users\, ?:\ProgramData\, ?:\Windows\Temp\ | excludes:process.executable |
process.executable | wildcard | \Device\Mup\*.exe | excludes:process.executable field:"process.executable" value:"\Device\Mup\*.exe" |
process.parent.command_line | eq | C:\Windows\system32\svchost.exe -k WebClientGroup | excludes:process.parent.command_line field:"process.parent.command_line" value:"C:\Windows\system32\svchost.exe -k WebClientGroup" |
process.parent.executable | eq | C:\Windows\System32\msiexec.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\msiexec.exe" |
process.parent.executable | wildcard | C:\Program Files\Symantec\Symantec Endpoint Protection\*\Bin64\ccSvcHst.exe, C:\Program Files\ACCUPLACER Score Client\ACCUPLACER Score Client.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Symantec\Symantec Endpoint Protection\*\Bin64\ccSvcHst.exe" field:"process.parent.executable" value:"C:\Program Files\ACCUPLACER Score Client\ACCUPLACER Score Client.exe" |
process.code_signature.subject_name | starts_with | Microsoft | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft" |
process.args | eq | -burn.elevated | excludes:process.args field:"process.args" value:"-burn.elevated" |
process.pe.imphash | eq | acbfc62280771933334b67077d6deaba | excludes:process.pe.imphash field:"process.pe.imphash" value:"acbfc62280771933334b67077d6deaba" |
process.args | eq | ?:\Windows\System32\SHELL32.dll,RunAsNewUser_RunDLL | excludes:process.args field:"process.args" value:"?:\Windows\System32\SHELL32.dll,RunAsNewUser_RunDLL" |
process.code_signature.subject_name | eq | Lenovo, Adobe Inc., Brave Software, Inc., HP Inc., Splashtop Inc., GN AUDIO A/S, Oracle America, Inc., Brother Industries, Ltd., Bosch Automotive Service Solutions Ltd, OpenShot Studios, LLC, CISCO SYSTEMS, INC., SERVICO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO), Wacom Co., Ltd. | excludes:process.code_signature.subject_name |
process.pe.original_file_name | eq | Bootstrapper.exe | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"Bootstrapper.exe" |
process.executable | eq | C:\Windows\SysWOW64\taskkill.exe, C:\Windows\SysWOW64\cmd.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\SysWOW64\taskkill.exe" field:"process.executable" value:"C:\Windows\SysWOW64\cmd.exe" |
process.working_directory | eq | C:\Program Files (x86)\Comhard-Plus\UserDeskTop\files\, C:\Program Files (x86)\TSplus\UserDeskTop\files\ | excludes:process.working_directory field:"process.working_directory" value:"C:\Program Files (x86)\Comhard-Plus\UserDeskTop\files\" field:"process.working_directory" value:"C:\Program Files (x86)\TSplus\UserDeskTop\files\" |
process.executable | eq | C:\Windows\System32\rdpinit.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\rdpinit.exe" |
process.parent.executable | eq | C:\Windows\System32\userinit.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\userinit.exe" |
process.executable | eq | C:\Windows\System32\rdpshell.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\rdpshell.exe" |
process.parent.executable | eq | C:\Windows\System32\rdpinit.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\rdpinit.exe" |
process.executable | eq | C:\Windows\System32\tabcal.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\tabcal.exe" |
process.parent.args | eq | C:\WINDOWS\System32\tabletpc.cpl | excludes:process.parent.args field:"process.parent.args" value:"C:\WINDOWS\System32\tabletpc.cpl" |
process.parent.executable | eq | C:\Windows\System32\rundll32.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\rundll32.exe" |
process.executable | eq | C:\Windows\System32\userinit.exe | excludes:process.executable field:"process.executable" value:"C:\Windows\System32\userinit.exe" |
process.parent.executable | eq | C:\Windows\System32\winlogon.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\winlogon.exe" |
process.executable | starts_with | ?:\Users\ | excludes:process.executable field:"process.executable" value:"?:\Users\" |
process.name | wildcard | *setup*.exe, resource_*.exe | excludes:process.name field:"process.name" value:"*setup*.exe" field:"process.name" value:"resource_*.exe" |
process.parent.name | ends_with | .tmp | excludes:process.parent.name field:"process.parent.name" value:".tmp" |
event0.process.hash.sha256 | eq | process.hash.sha256 | excludes:event0.process.hash.sha256 field:"event0.process.hash.sha256" value:"process.hash.sha256" |
process.Ext.token.integrity_level_name | eq | system | excludes:process.Ext.token.integrity_level_name field:"process.Ext.token.integrity_level_name" value:"system" |
process.command_line | wildcard | */SPAWNWND=*/NOTIFYWND=* | excludes:process.command_line field:"process.command_line" value:"*/SPAWNWND=*/NOTIFYWND=*" |
process.executable | wildcard | ?:\Windows\System32\ntprint.exe, ?:\Windows\System32\timeout.exe, ?:\Windows\System32\printui.exe, ?:\Windows\System32\SndVol.exe, ?:\Windows\System32\MultiDigiMon.exe, C:\Windows\SysWOW64\vsjitdebugger.exe, C:\Windows\System32\shutdown.exe, C:\Windows\System32\WerFault.exe, C:\Windows\System32\OptionalFeatures.exe, C:\Windows\System32\conhost.exe, C:\Windows\SysWOW64\net1.exe, C:\Windows\SysWOW64\net.exe, ?:\WINDOWS\splwow64.exe, ?:\Windows\System32\SystemPropertiesAdvanced.exe, ?:\Program Files\*, ?:\Program Files (x86)\* | excludes:process.executable |
process.hash.sha256 | in | 24e76fe67435e9c7c1aa9ec22d736de3873fbd2e880d8ae716dffec0e146fc53, 2a12e554e19d7b59294def0c3047f77c44e8ed899d6bca264935ce03abc82abe, 2c476f212dc61977ae3deb9319fa21242524f3b6dd30803715659a9618316089, 5212286922b7b1bce5fda2c2b25a9dfdef9300736ded91350d08c837ae1e9e1c, a02e0984d790393aea56252f45dd58d25cdfa4501efb40efadecd90145717c35, ac3ea3ee1f4d7925888751c05911eaa237786346ad27637d1d4b140b08f1033c, af483a6e34a9b12ed2adcdb388b50311e5c322947718a41bbc325c2d1f3a7393, b2b8a7156ec0079a1801db1647d6dbc4206345689772495eac311e0e6afcad57, b2f6de33dc0dfd256f9708a09b853a96d5cf5bffcaf52aa1331b3b4242421667, bf73d2a3812ebef4f57cf81a2d24e23287cddefd57183c89535603e878eb7b11, c83ef42b6c4c85e24666c8e55b93fb64cf08164e34b85fde0270c03dd463c11f, e18fbe144c938627e3c383e942e8da74ed301612d035f1e7e92557db70d05277, e8f1081e08c28f80997b06f0f383957b6ece29347d042387e8ae2dcf93107adc, ed7c9415508e0cb0893c77d67400ee52a0c2f54a9992d55e309b14d906fc8545 | excludes:process.hash.sha256 |
process.parent.executable | eq | C:\Windows\System32\gpscript.exe, C:\Windows\ImmersiveControlPanel\SystemSettings.exe, C:\Windows\System32\ServerManagerLauncher.exe, C:\Program Files\Accops\AccopsSessionServerExtensions\lspPortMapper.exe, C:\Windows\SysWOW64\Watchdata\PROXKey CSP India V3.0\SPSocketServer.exe | excludes:process.parent.executable |
AWS Bedrock High Risk Filesystem or Execution Tool Invocation
#Detects when a Bedrock model is prompted to invoke high-risk tools associated with shell execution, filesystem operations, or process spawning. Adversaries may use compromised AI agent pipelines or manipulated prompts to instruct the model to execute arbitrary system commands, read or write sensitive files, or spawn subprocesses — extending the blast radius of a credential compromise or prompt injection attack.
Known False Positives
- Authorized AI agent workflows that include shell or filesystem tools may trigger this rule. Validate that the user identity and tool usage pattern are consistent with expected application behavior.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution |
Rule Body
[metadata]
creation_date = "2026/07/27"
integration = ["aws_bedrock"]
maturity = "production"
updated_date = "2026/07/27"
[rule]
author = ["Elastic"]
description = """
Detects when a Bedrock model is prompted to invoke high-risk tools associated with shell execution, filesystem
operations, or process spawning. Adversaries may use compromised AI agent pipelines or manipulated prompts to
instruct the model to execute arbitrary system commands, read or write sensitive files, or spawn subprocesses —
extending the blast radius of a credential compromise or prompt injection attack.
"""
false_positives = [
"""
Authorized AI agent workflows that include shell or filesystem tools may trigger this rule. Validate that the
user identity and tool usage pattern are consistent with expected application behavior.
""",
]
from = "now-60m"
interval = "10m"
language = "esql"
license = "Elastic License v2"
name = "AWS Bedrock High Risk Filesystem or Execution Tool Invocation"
note = """## Triage and analysis
### Investigating AWS Bedrock High Risk Filesystem or Execution Tool Invocation
This rule detects Bedrock model invocations where the prompt contains patterns associated with shell execution, filesystem access, or process spawning. These patterns may indicate a prompt injection attack, a compromised AI agent pipeline, or an insider attempting to use a Bedrock-backed application to execute unauthorized system operations.
### Possible investigation steps
- Review `gen_ai.prompt` to identify the specific tool invocation pattern that triggered the rule and determine whether it represents a legitimate tool call or a malicious instruction.
- Identify the user (`user.id`) and determine whether they are expected to interact with tools that perform filesystem or shell operations.
- Review the model ID (`gen_ai.request.model.id`) and the application context to understand whether shell or filesystem tools are part of the intended agent architecture.
- Correlate with other Bedrock invocation events from the same user in the preceding hour to assess whether this is an isolated event or part of a pattern.
- If the application uses Bedrock Agents, review the agent's configured action groups and Lambda functions to determine whether the tool invocation could have resulted in actual execution.
- Check for downstream evidence of execution: CloudTrail Lambda invocation events, SSM RunCommand, or EC2 activity correlated with the same time window.
### False positive analysis
- AI coding assistants and developer tools built on Bedrock may legitimately reference shell commands or file operations in their prompt templates.
- Security tooling that uses Bedrock to analyze shell scripts or code may produce prompts containing these patterns.
### Response and remediation
- If a prompt injection is confirmed, identify the injection source and remediate the input validation gap in the application layer.
- Review and restrict the tools available to the Bedrock Agent to the minimum required for its function.
- Apply Bedrock Guardrails to block or flag prompts containing high-risk tool invocation patterns.
- If credentials were compromised, rotate them immediately and audit all Bedrock and downstream API activity.
"""
references = [
"https://docs.aws.amazon.com/bedrock/latest/userguide/agents-action-groups.html",
"https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html",
"https://owasp.org/www-project-top-10-for-large-language-model-applications/",
]
risk_score = 73
rule_id = "51d50385-aa3d-448c-bc48-7d6bc39108a3"
setup = """The AWS Bedrock integration must be enabled with model invocation logging configured to capture prompt
and completion content. Ensure `logs-aws_bedrock.invocation-*` is ingested into Elasticsearch."""
severity = "high"
tags = [
"Domain: Cloud",
"Domain: LLM",
"Data Source: AWS Bedrock",
"Use Case: Threat Detection",
"Tactic: Execution",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-aws_bedrock.invocation-* metadata _id, _version, _index
| eval Esql.lowercase_prompt = TO_LOWER(gen_ai.prompt)
| where
Esql.lowercase_prompt like "*/bin/sh*" or
Esql.lowercase_prompt like "*/bin/bash*" or
Esql.lowercase_prompt like "*sh -c*" or
Esql.lowercase_prompt like "*cmd.exe*" or
Esql.lowercase_prompt like "*powershell*" or
Esql.lowercase_prompt like "*exec(*" or
Esql.lowercase_prompt like "*os.system*" or
Esql.lowercase_prompt like "*subprocess*" or
Esql.lowercase_prompt like "*python -c*" or
Esql.lowercase_prompt like "*python3 -c*" or
Esql.lowercase_prompt like "*curl *" or
Esql.lowercase_prompt like "*wget *" or
Esql.lowercase_prompt like "*/dev/tcp/*" or
Esql.lowercase_prompt like "*nc -e*" or
Esql.lowercase_prompt like "*ncat *" or
Esql.lowercase_prompt like "*socat *" or
Esql.lowercase_prompt like "*openssl s_client*" or
Esql.lowercase_prompt like "*perl -e*" or
Esql.lowercase_prompt like "*ruby -e*" or
Esql.lowercase_prompt like "*php -r*" or
Esql.lowercase_prompt like "*node -e*" or
Esql.lowercase_prompt like "*base64 -d*" or
Esql.lowercase_prompt like "*bash -i*"
| keep _id, _version, _index, @timestamp, user.id, cloud.account.id, gen_ai.request.model.id, gen_ai.prompt, gen_ai.completion
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[rule.alert_suppression]
group_by = ["user.id", "cloud.account.id"]
duration = {value = 1, unit = "h"}
missing_fields_strategy = "suppress"
[rule.investigation_fields]
field_names = [
"@timestamp",
"user.id",
"cloud.account.id",
"gen_ai.request.model.id",
"gen_ai.prompt",
"gen_ai.completion",
]
Stages and Predicates
Stage 1: from
from logs-aws_bedrock.invocation-* metadata _id, _version, _index
Stage 2: eval
| eval Esql.lowercase_prompt = TO_LOWER(gen_ai.prompt)
Stage 3: where
| where
Esql.lowercase_prompt like "*/bin/sh*" or
Esql.lowercase_prompt like "*/bin/bash*" or
Esql.lowercase_prompt like "*sh -c*" or
Esql.lowercase_prompt like "*cmd.exe*" or
Esql.lowercase_prompt like "*powershell*" or
Esql.lowercase_prompt like "*exec(*" or
Esql.lowercase_prompt like "*os.system*" or
Esql.lowercase_prompt like "*subprocess*" or
Esql.lowercase_prompt like "*python -c*" or
Esql.lowercase_prompt like "*python3 -c*" or
Esql.lowercase_prompt like "*curl *" or
Esql.lowercase_prompt like "*wget *" or
Esql.lowercase_prompt like "*/dev/tcp/*" or
Esql.lowercase_prompt like "*nc -e*" or
Esql.lowercase_prompt like "*ncat *" or
Esql.lowercase_prompt like "*socat *" or
Esql.lowercase_prompt like "*openssl s_client*" or
Esql.lowercase_prompt like "*perl -e*" or
Esql.lowercase_prompt like "*ruby -e*" or
Esql.lowercase_prompt like "*php -r*" or
Esql.lowercase_prompt like "*node -e*" or
Esql.lowercase_prompt like "*base64 -d*" or
Esql.lowercase_prompt like "*bash -i*"
Stage 4: keep
| keep _id, _version, _index, @timestamp, user.id, cloud.account.id, gen_ai.request.model.id, gen_ai.prompt, gen_ai.completion
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.lowercase_prompt | wildcard |
| field:"Esql.lowercase_prompt" kind:wildcard |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
_id | KEEP _id |
_version | KEEP _version |
_index | KEEP _index |
@timestamp | KEEP @timestamp |
user.id | KEEP user.id |
cloud.account.id | KEEP cloud.account.id |
gen_ai.request.model.id | KEEP gen_ai.request.model.id |
gen_ai.prompt | KEEP gen_ai.prompt |
gen_ai.completion | KEEP gen_ai.completion |
AWS SES Email Identity Verified Then Deleted
#Detects an SES email identity being verified and subsequently deleted within a 30-minute window, performed by the same AWS identity. Amazon SES requires email addresses and domains to be verified before they can be used as senders. An adversary who obtains SES credentials may verify a domain or address they control, use it to send phishing or spam email, then delete the identity to remove evidence of the sending domain from the account's verified identity list. This verify-use-delete pattern is a recognized attacker technique for SES abuse.
Known False Positives
- Testing workflows that verify a sandbox email address and then clean it up may trigger this rule. Confirm that the email identity verified and deleted corresponds to a planned test rather than a production or attacker-controlled domain.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Resource Development | |
| Stealth |
Telemetry Coverage
Rules Detecting the Same Action
These rules filter on the same operation.
- SES Identity Has Been Deleted (Sigma)
Rule Body
[metadata]
creation_date = "2026/08/31"
integration = ["aws"]
maturity = "production"
updated_date = "2026/08/31"
[rule]
author = ["Elastic"]
description = """
Detects an SES email identity being verified and subsequently deleted within a 30-minute window,
performed by the same AWS identity. Amazon SES requires email addresses and domains
to be verified before they can be used as senders. An adversary who obtains SES credentials
may verify a domain or address they control, use it to send phishing or spam email, then delete
the identity to remove evidence of the sending domain from the account's verified identity list.
This verify-use-delete pattern is a recognized attacker technique for SES abuse.
"""
false_positives = [
"""
Testing workflows that verify a sandbox email address and then clean it up may trigger this
rule. Confirm that the email identity verified and deleted corresponds to a planned test
rather than a production or attacker-controlled domain.
""",
]
from = "now-60m"
interval = "30m"
language = "esql"
license = "Elastic License v2"
name = "AWS SES Email Identity Verified Then Deleted"
note = """## Triage and analysis
### Investigating AWS SES Email Identity Verified Then Deleted
Amazon SES requires that email addresses and domains be verified (via DNS record or a verification email) before they can be used as `From:` addresses. An adversary who obtains SES write credentials can verify a domain they control, send bulk email from that domain using the victim account's sending quota and reputation, then delete the identity to hide the sending domain from security reviews.
The verify-then-delete sequence is the evidence-destruction component of the SES phishing technique: it removes the compromised identity from `ListIdentities` output, making post-incident attribution harder.
This is an ES|QL rule that aggregates SES verification and deletion events per calling identity within 30-minute windows and alerts when the same identity performed both, with the verification preceding the deletion.
### Possible investigation steps
- Identify the caller from `aws.cloudtrail.user_identity.arn` and the aggregated `user_names` column.
- Pivot to the raw CloudTrail events for this ARN in the `first_verify` to `last_delete` time range to determine the verified identity from the `VerifyEmailIdentity` or `VerifyDomainIdentity` request parameters and the deleted identity from the `DeleteIdentity` request parameters.
- Query SES `SendEmail` / `SendRawEmail` CloudTrail events (if CloudTrail management events are being collected) or SES sending statistics between the verification and deletion timestamps to determine whether email was sent from the verified identity.
- Check your email service provider's delivery logs for any email sourced from the SES identity.
- Review all SES actions taken by this identity in the surrounding time window.
### Response and remediation
- If unauthorized email was sent, notify affected recipients and file an SES abuse report.
- Rotate all IAM credentials that had SES write access during the incident window.
- Enable SES sending quotas and alerts to detect unusual send volume in real time.
- Restrict `ses:VerifyEmailIdentity`, `ses:VerifyDomainIdentity`, and `ses:DeleteIdentity` to a dedicated SES-management role via IAM policy.
"""
references = [
"https://docs.aws.amazon.com/ses/latest/APIReference/API_VerifyEmailIdentity.html",
"https://docs.aws.amazon.com/ses/latest/APIReference/API_DeleteIdentity.html",
"https://permiso.io/blog/s/aws-ses-pionage-detecting-ses-abuse/",
]
risk_score = 47
rule_id = "8e4bde35-125d-4eb3-9a2e-d7e77a053a08"
setup = "The AWS integration must be ingesting management events into `logs-aws.cloudtrail-*`. SES management APIs are logged by default."
severity = "medium"
tags = [
"Domain: Cloud",
"Platform: AWS",
"Data Source: AWS CloudTrail",
"Service: AWS SES",
"Rule Type: ESQL",
"Tactic: Resource Development",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "esql"
query = '''
from logs-aws.cloudtrail-* metadata _id, _version, _index
| where data_stream.dataset == "aws.cloudtrail"
and event.provider == "ses.amazonaws.com"
and event.action in ("VerifyEmailIdentity", "VerifyDomainIdentity", "VerifyEmailAddress", "VerifyDomainDkim", "DeleteIdentity")
and event.outcome == "success"
and aws.cloudtrail.user_identity.arn is not null
| eval Esql.ses_verify_flag = case(event.action != "DeleteIdentity", 1, 0),
Esql.ses_delete_flag = case(event.action == "DeleteIdentity", 1, 0)
| stats Esql.ses_verify_count = sum(Esql.ses_verify_flag),
Esql.ses_delete_count = sum(Esql.ses_delete_flag),
Esql.ses_verify_timestamp_min = min(case(Esql.ses_verify_flag == 1, @timestamp)),
Esql.ses_delete_timestamp_max = max(case(Esql.ses_delete_flag == 1, @timestamp)),
Esql.event_action_values = values(event.action),
Esql_priv.user_name_values = values(user.name),
Esql.cloud_account_id_values = values(cloud.account.id)
by aws.cloudtrail.user_identity.arn
| where Esql.ses_verify_count > 0 and Esql.ses_delete_count > 0
and Esql.ses_verify_timestamp_min < Esql.ses_delete_timestamp_max
and date_diff("minutes", Esql.ses_verify_timestamp_min, Esql.ses_delete_timestamp_max) <= 30
| keep aws.cloudtrail.user_identity.arn, Esql.ses_verify_count, Esql.ses_delete_count, Esql.ses_verify_timestamp_min, Esql.ses_delete_timestamp_max, Esql.event_action_values, Esql_priv.user_name_values, Esql.cloud_account_id_values
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1583"
name = "Acquire Infrastructure"
reference = "https://attack.mitre.org/techniques/T1583/"
[[rule.threat.technique.subtechnique]]
id = "T1583.001"
name = "Domains"
reference = "https://attack.mitre.org/techniques/T1583/001/"
[rule.threat.tactic]
id = "TA0042"
name = "Resource Development"
reference = "https://attack.mitre.org/tactics/TA0042/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1070"
name = "Indicator Removal"
reference = "https://attack.mitre.org/techniques/T1070/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[rule.investigation_fields]
field_names = [
"aws.cloudtrail.user_identity.arn",
"Esql.ses_verify_count",
"Esql.ses_delete_count",
"Esql.ses_verify_timestamp_min",
"Esql.ses_delete_timestamp_max",
"Esql.event_action_values",
"Esql_priv.user_name_values",
"Esql.cloud_account_id_values",
]
Stages and Predicates
Stage 1: from
from logs-aws.cloudtrail-* metadata _id, _version, _index
Stage 2: where
| where data_stream.dataset == "aws.cloudtrail"
and event.provider == "ses.amazonaws.com"
and event.action in ("VerifyEmailIdentity", "VerifyDomainIdentity", "VerifyEmailAddress", "VerifyDomainDkim", "DeleteIdentity")
and event.outcome == "success"
and aws.cloudtrail.user_identity.arn is not null
Stage 3: eval
| eval Esql.ses_verify_flag = case(event.action != "DeleteIdentity", 1, 0),
Esql.ses_delete_flag = case(event.action == "DeleteIdentity", 1, 0)
Esql.ses_delete_flag =event.action == "DeleteIdentity"10Esql.ses_verify_flag =event.action != "DeleteIdentity"10Stage 4: stats
| stats Esql.ses_verify_count = sum(Esql.ses_verify_flag),
Esql.ses_delete_count = sum(Esql.ses_delete_flag),
Esql.ses_verify_timestamp_min = min(case(Esql.ses_verify_flag == 1, @timestamp)),
Esql.ses_delete_timestamp_max = max(case(Esql.ses_delete_flag == 1, @timestamp)),
Esql.event_action_values = values(event.action),
Esql_priv.user_name_values = values(user.name),
Esql.cloud_account_id_values = values(cloud.account.id)
by aws.cloudtrail.user_identity.arn
Stage 5: where
| where Esql.ses_verify_count > 0 and Esql.ses_delete_count > 0
and Esql.ses_verify_timestamp_min < Esql.ses_delete_timestamp_max
and date_diff("minutes", Esql.ses_verify_timestamp_min, Esql.ses_delete_timestamp_max) <= 30
Stage 6: keep
| keep aws.cloudtrail.user_identity.arn, Esql.ses_verify_count, Esql.ses_delete_count, Esql.ses_verify_timestamp_min, Esql.ses_delete_timestamp_max, Esql.event_action_values, Esql_priv.user_name_values, Esql.cloud_account_id_values
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
Esql.ses_delete_count | gt |
| field:"Esql.ses_delete_count" kind:gt value:"0" |
Esql.ses_verify_count | gt |
| field:"Esql.ses_verify_count" kind:gt value:"0" |
Esql.ses_verify_timestamp_min | lt |
| field:"Esql.ses_verify_timestamp_min" kind:lt value:"Esql.ses_delete_timestamp_max" |
aws.cloudtrail.user_identity.arn | is_not_null | field:"aws::userIdentity.arn" kind:is_not_null | |
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"aws.cloudtrail" |
event.action | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.provider | eq |
| field:"Provider_Name" kind:eq value:"ses.amazonaws.com" |
Output Fields
These fields are emitted when the rule matches.
| Field | Source |
|---|---|
aws.cloudtrail.user_identity.arn | KEEP aws.cloudtrail.user_identity.arn |
Esql.ses_verify_count | KEEP Esql.ses_verify_count |
Esql.ses_delete_count | KEEP Esql.ses_delete_count |
Esql.ses_verify_timestamp_min | KEEP Esql.ses_verify_timestamp_min |
Esql.ses_delete_timestamp_max | KEEP Esql.ses_delete_timestamp_max |
Esql.event_action_values | KEEP Esql.event_action_values |
Esql_priv.user_name_values | KEEP Esql_priv.user_name_values |
Esql.cloud_account_id_values | KEEP Esql.cloud_account_id_values |
Disable Windows Firewall Rules via Netsh
#Identifies use of the netsh.exe to disable or weaken the local firewall. Attackers will use this command line tool to disable the firewall during troubleshooting or to enable network mobility.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2020/02/18"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"
[rule]
author = ["Elastic"]
description = """
Identifies use of the netsh.exe to disable or weaken the local firewall. Attackers will use this command line tool to
disable the firewall during troubleshooting or to enable network mobility.
"""
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
]
language = "eql"
license = "Elastic License v2"
name = "Disable Windows Firewall Rules via Netsh"
note = """## Triage and analysis
### Investigating Disable Windows Firewall Rules via Netsh
The Windows Defender Firewall is a native component which provides host-based, two-way network traffic filtering for a device, and blocks unauthorized network traffic flowing into or out of the local device.
Attackers can disable the Windows firewall or its rules to enable lateral movement and command and control activity.
This rule identifies patterns related to disabling the Windows firewall or its rules using the `netsh.exe` utility.
#### Possible investigation steps
- Identify the user account that performed the action and whether it should perform this kind of action.
- Contact the user to check if they are aware of the operation.
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
- Investigate other alerts associated with the user/host during the past 48 hours.
### False positive analysis
- This mechanism can be used legitimately. Check whether the user is an administrator and is legitimately performing troubleshooting.
- In case of an allowed benign true positive (B-TP), assess adding rules to allow needed traffic and re-enable the firewall.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- Isolate the involved hosts to prevent further post-compromise behavior.
- Review the privileges assigned to the involved users to ensure that the least privilege principle is being followed.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 1 - Process Creation](https://ela.st/sysmon-event-1-setup)
- [Windows Process Creation Logs](https://ela.st/audit-process-creation)
"""
risk_score = 47
rule_id = "4b438734-3793-4fda-bd42-ceeada0be8f9"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Resources: Investigation Guide",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.name : "netsh.exe" and
(
(process.args : "disable" and process.args : "firewall" and process.args : "set") or
(process.args : "advfirewall" and process.args : "off" and process.args : "state")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1562"
name = "Impair Defenses"
reference = "https://attack.mitre.org/techniques/T1562/"
[[rule.threat.technique.subtechnique]]
id = "T1562.004"
name = "Disable or Modify System Firewall"
reference = "https://attack.mitre.org/techniques/T1562/004/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.name : "netsh.exe" and
(
(process.args : "disable" and process.args : "firewall" and process.args : "set") or
(process.args : "advfirewall" and process.args : "off" and process.args : "state")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"netsh.exe" |
Entra ID Kali365 Default User-Agent Detected
#Identifies the default user agent string associated with Kali365 (also referred to as Kali365 Live), a phishing-as-a-service (PhaaS) platform that automates OAuth 2.0 device code phishing and adversary-in-the-middle (AiTM) session capture against Microsoft 365 and Microsoft Entra ID. The Kali365 Electron desktop client identifies itself with the user agent kali365-live/1.0.0 when polling for and replaying captured OAuth tokens, so its appearance in Entra ID sign-in logs, Entra ID audit logs, or the Microsoft 365 unified audit log indicates that an attacker-controlled Kali365 client is interacting with the tenant using stolen tokens. Unlike dual-use offensive tooling, Kali365 is a criminal service with no legitimate enterprise use, making this user agent a high-fidelity indicator of active account compromise.
Known False Positives
- Security researchers, sandbox detonations, or red team engagements that intentionally run the Kali365 client against a monitored tenant may generate this user agent. Document approved research activity and exclude the associated principals, source IPs, or tenants if expected.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Stealth | |
| Credential Access | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2026/05/26"
integration = ["azure", "o365"]
maturity = "production"
updated_date = "2026/05/26"
[rule]
author = ["Elastic"]
description = """
Identifies the default user agent string associated with Kali365 (also referred to as Kali365 Live), a
phishing-as-a-service (PhaaS) platform that automates OAuth 2.0 device code phishing and adversary-in-the-middle (AiTM)
session capture against Microsoft 365 and Microsoft Entra ID. The Kali365 Electron desktop client identifies itself with
the user agent `kali365-live/1.0.0` when polling for and replaying captured OAuth tokens, so its appearance in Entra ID
sign-in logs, Entra ID audit logs, or the Microsoft 365 unified audit log indicates that an attacker-controlled Kali365
client is interacting with the tenant using stolen tokens. Unlike dual-use offensive tooling, Kali365 is a criminal
service with no legitimate enterprise use, making this user agent a high-fidelity indicator of active account
compromise.
"""
false_positives = [
"""
Security researchers, sandbox detonations, or red team engagements that intentionally run the Kali365 client against
a monitored tenant may generate this user agent. Document approved research activity and exclude the associated
principals, source IPs, or tenants if expected.
""",
]
from = "now-9m"
index = ["logs-azure.auditlogs-*", "logs-azure.signinlogs-*", "logs-o365.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID Kali365 Default User-Agent Detected"
note = """## Triage and analysis
### Investigating Entra ID Kali365 Default User-Agent Detected
Kali365 (Kali365 Live) is a phishing-as-a-service platform distributed via Telegram that provides affiliates with
AI-generated lures, automated device code phishing campaigns, target-tracking dashboards, and OAuth token capture. The
typical flow is: a lure delivers a Microsoft device code, the victim enters it on the legitimate Microsoft verification
page and unknowingly authorizes the attacker, Kali365 captures the resulting OAuth access and refresh tokens, and the
attacker uses those tokens for persistent, MFA-free access to Microsoft 365 (Outlook, Teams, OneDrive).
The Kali365 desktop client presents the user agent `kali365-live/1.0.0`. This rule fires when that user agent is observed
in Entra ID sign-in logs, Entra ID audit logs, or the Microsoft 365 unified audit log. Because the user agent maps to a
criminal service with no legitimate use, an alert generally indicates that stolen tokens are already being replayed
against the tenant.
### Possible investigation steps
- Confirm the tool and identify the affected identity.
- `user_agent.original` matches `kali365-live/*`.
- Pivot on `user.name`, `azure.signinlogs.properties.user_principal_name`, or the M365 audit `user.id`.
- Review the origin and compare against the user's normal sign-in behavior.
- `source.ip`, `source.geo.*`, and `source.as.organization.name`; flag hosting/VPS ASNs and unexpected geographies.
- Cross-reference published Kali365 infrastructure (`216.203.20.95`, `162.243.166.119`, `199.91.220.111`).
- Confirm the device code grant in sign-in logs.
- `azure.signinlogs.properties.authentication_protocol` is `deviceCode`.
- Review `app_id`/`app_display_name` and `resource_display_name` for the brokered mail or collaboration API.
- Scope follow-on access in the Microsoft 365 unified audit log for the same user and timeframe.
- Look for mailbox access, inbox rule creation, OneDrive/SharePoint downloads, or Teams activity from the same session or IP.
- Check the Entra ID audit log for a device registration by the same identity around the alert window.
- A `Register device` event by the identity paired (via `azure.correlation_id`) with an `Add device` event from the `Device Registration Service` indicates a Primary Refresh Token (PRT) was issued for persistence that survives password resets.
### False positive analysis
- This user agent has no legitimate enterprise use.
- The only expected matches are authorized security research or red team exercises running the Kali365 client; validate and document before dismissing.
### Response and remediation
- Remove rogue device registrations created by the user BEFORE revoking sessions.
- Device-bound PRTs survive `revokeSignInSessions`, so a device left in place re-establishes access.
- `GET /v1.0/users/{id}/registeredDevices` and `/ownedDevices`, then `DELETE /v1.0/devices/{deviceObjectId}` for unrecognized devices.
- Revoke refresh tokens and sessions, then reset credentials and re-register MFA.
- `POST /v1.0/users/{id}/revokeSignInSessions`.
- Temporarily disable the account if you need to halt activity during investigation.
- `PATCH /v1.0/users/{id}` with body `{"accountEnabled": false}`.
- Remove other attacker persistence: malicious inbox/forwarding rules, OAuth consents, and app passwords.
- Block or monitor Kali365 source IPs and infrastructure, and hunt for the user agent across other users and tenants.
- Apply Conditional Access to the device code grant.
- Require a managed/compliant device, or block the device-code flow outside approved app and user populations.
"""
references = [
"https://arcticwolf.com/resources/blog/token-bingo-dont-let-your-code-be-the-winner/",
"https://www.ic3.gov/PSA/2026/PSA260521",
]
risk_score = 73
rule_id = "4b11dbab-ce37-49c4-bdf1-cdf64b405d96"
severity = "high"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Sign-in Logs",
"Data Source: Microsoft Entra ID Audit Logs",
"Data Source: Microsoft 365",
"Data Source: Microsoft 365 Audit Logs",
"Use Case: Identity and Access Audit",
"Use Case: Threat Detection",
"Threat: Kali365",
"Tactic: Initial Access",
"Tactic: Credential Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset : ("azure.signinlogs" or "azure.auditlogs" or "o365.audit") and user_agent.original: kali365-live/*
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[[rule.threat.technique]]
id = "T1566"
name = "Phishing"
reference = "https://attack.mitre.org/techniques/T1566/"
[[rule.threat.technique.subtechnique]]
id = "T1566.002"
name = "Spearphishing Link"
reference = "https://attack.mitre.org/techniques/T1566/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: query
data_stream.dataset : ("azure.signinlogs" or "azure.auditlogs" or "o365.audit") and user_agent.original: kali365-live/*
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | in |
| field:"data_stream.dataset" kind:in |
user_agent.original | wildcard |
| field:"aws::userAgent" kind:wildcard value:"kali365-live/*" |
Entra ID OAuth user_impersonation Scope for Unusual User and Client
#Identifies rare occurrences of OAuth workflow for a user principal that is single factor authenticated, with an OAuth scope containing user_impersonation for a token issued by Entra ID. Adversaries may use this scope to gain unauthorized access to user accounts, particularly when the sign-in session status is unbound, indicating that the session is not associated with a specific device or session. This behavior is indicative of potential account compromise or unauthorized access attempts. This rule flags when this pattern is detected for a user principal that has not been seen in the last 10 days, indicating potential abuse or unusual activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Stealth | |
| Lateral Movement |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2025/07/03"
integration = ["azure"]
maturity = "production"
updated_date = "2026/08/12"
[rule]
author = ["Elastic"]
description = """
Identifies rare occurrences of OAuth workflow for a user principal that is single factor authenticated, with an OAuth
scope containing user_impersonation for a token issued by Entra ID. Adversaries may use this scope to gain unauthorized
access to user accounts, particularly when the sign-in session status is unbound, indicating that the session is not
associated with a specific device or session. This behavior is indicative of potential account compromise or
unauthorized access attempts. This rule flags when this pattern is detected for a user principal that has not been seen
in the last 10 days, indicating potential abuse or unusual activity.
"""
from = "now-9m"
index = ["filebeat-*", "logs-azure.signinlogs-*"]
language = "kuery"
license = "Elastic License v2"
name = "Entra ID OAuth user_impersonation Scope for Unusual User and Client"
note = """## Triage and analysis
### Investigating Entra ID OAuth user_impersonation Scope for Unusual User and Client
Identifies rare occurrences of OAuth workflow for a user principal that is single factor authenticated, with an OAuth scope containing `user_impersonation`, and a token issuer type of `AzureAD`. This rule is designed to detect suspicious
OAuth user impersonation attempts in Microsoft Entra ID, particularly those involving the `user_impersonation` scope, which is often used by adversaries to gain unauthorized access to user accounts. The rule focuses on sign-in events where
the sign-in session status is `unbound`, indicating that the session is not associated with a specific device or session, making it more vulnerable to abuse. This behavior is indicative of potential account compromise or
unauthorized access attempts, especially when the user type is `Member` and the sign-in outcome is `success`. The rule aims to identify these events to facilitate timely investigation and response to potential security incidents. This is a New Terms rule that flags when this pattern is detected for a user principal that has not been seen in the last 10 days, indicating potential abuse or unusual activity.
### Possible investigation steps
- Review the `azure.signinlogs.properties.user_principal_name` field to identify the user principal involved in the OAuth workflow.
- Check the `azure.signinlogs.properties.authentication_processing_details.Oauth Scope Info` field for the presence of `user_impersonation`. This scope is commonly used in OAuth flows to allow applications to access user resources on behalf of the user.
- Confirm that the `azure.signinlogs.properties.authentication_requirement` is set to `singleFactorAuthentication`, indicating that the sign-in did not require multi-factor authentication (MFA). This can be a red flag, as MFA is a critical security control that helps prevent unauthorized access.
- Review the `azure.signinlogs.properties.app_display_name` or `azure.signinlogs.properties.app_id` to identify the application involved in the OAuth workflow. Check if this application is known and trusted, or if it appears suspicious or unauthorized. FOCI applications are commonly abused by adversaries to evade security controls or conditional access policies.
- Analyze the `azure.signinlogs.properties.client_ip` to determine the source of the sign-in attempt. Look for unusual or unexpected IP addresses, especially those associated with known malicious activity or geographic locations that do not align with the user's typical behavior.
- Examine the `azure.signinlogs.properties.resource_display_name` or `azure.signinlogs.properties.resource_id` to identify the resource being accessed during the OAuth workflow. This can help determine if the access was legitimate or if it targeted sensitive resources. It may also help pivot to other related events or activities.
- Use the `azure.signinlogs.properties.session_id` or `azure.signinlogs.properties.correlation_id` to correlate this event with other related sign-in events or activities. This can help identify patterns of suspicious behavior or potential account compromise.
### False positive analysis
- Some legitimate applications may use the `user_impersonation` scope for valid purposes, such as accessing user resources on behalf of the user. If this is expected behavior, consider adjusting the rule or adding exceptions for specific applications or user principals.
- Users may occasionally authenticate using single-factor authentication for specific applications or scenarios, especially in environments where MFA is not enforced or required. If this is expected behavior, consider adjusting the rule or adding exceptions for specific user principals or applications.
- Some applications may use the `user_impersonation` scope for legitimate purposes, such as accessing user resources in a controlled manner. If this is expected behavior, consider adjusting the rule or adding exceptions for specific applications or user principals.
- The `restricted_user_impersonation` scope is distinct from `user_impersonation` and is excluded.
- Expected OCaaS bootstrap requests from Exchange Online or Microsoft Forms Web are excluded when they originate from compliant, managed, joined Windows devices and do not use an incoming refresh token or primary refresh token.
### Response and remediation
- Contact the user to validate the OAuth workflow and assess whether they were targeted or tricked by a malicious actor.
- If the OAuth workflow is confirmed to be malicious:
- Block the user account and reset the password to prevent further unauthorized access.
- Revoke active sessions and refresh tokens associated with the user principal.
- Review the application involved in the OAuth workflow and determine if it should be blocked or removed from the tenant.
- Investigate the source of the sign-in attempt, including the application and IP address, to determine if there are any additional indicators of compromise or ongoing malicious activity.
- Monitor the user account and related resources for any further suspicious activity or unauthorized access attempts, and take appropriate actions to mitigate any risks identified.
- Educate users about the risks associated with OAuth user impersonation and encourage them to use more secure authentication methods, such as OAuth 2.0 or OpenID Connect, whenever possible.
"""
references = [
"https://aadinternals.com/post/phishing/",
"https://dirkjanm.io/assets/raw/Finding%20Entra%20ID%20CA%20Bypasses%20-%20the%20structured%20way.pdf",
"https://github.com/Flangvik/TeamFiltration",
"https://www.proofpoint.com/us/blog/threat-insight/attackers-unleash-teamfiltration-account-takeover-campaign",
]
risk_score = 47
rule_id = "9563dace-5822-11f0-b1d3-f661ea17fbcd"
severity = "medium"
tags = [
"Domain: Cloud",
"Domain: Identity",
"Use Case: Threat Detection",
"Data Source: Azure",
"Data Source: Microsoft Entra ID",
"Data Source: Microsoft Entra ID Sign-in Logs",
"Platform: Entra ID",
"Tactic: Initial Access",
"Tactic: Defense Evasion",
"Rule Type: New Terms",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
data_stream.dataset:azure.signinlogs and
azure.signinlogs.properties.authentication_processing_details:(*user_impersonation* and not *restricted_user_impersonation*) and
azure.signinlogs.properties.authentication_requirement:singleFactorAuthentication and
azure.signinlogs.properties.token_issuer_type:AzureAD and
azure.signinlogs.properties.token_protection_status_details.sign_in_session_status:unbound and
azure.signinlogs.properties.user_type:Member and
azure.signinlogs.properties.conditional_access_status:"notApplied" and
not user_agent.original:(Microsoft*Authentication*iPhone* or Mozilla*PKeyAuth/1.0) and
not azure.signinlogs.properties.device_detail.operating_system:(Android* or Ios*) and
event.outcome:success and
not azure.signinlogs.properties.app_id:(
0000000c-0000-0000-c000-000000000000 or
0a5f63c0-b750-4f38-a71c-4fc0d58b89e2 or
48af08dc-f6d2-435f-b2a7-069abd99c086 or
5e3ce6c0-2b1f-4285-8d4b-75ee78787346 or
65d91a3d-ab74-42e6-8a2f-0add61688c74 or
66a88757-258c-4c72-893c-3e8bed4d6899 or
6bc3b958-689b-49f5-9006-36d165f30e00 or
8c59ead7-d703-4a27-9e55-c96a0054c8d2 or
95de633a-083e-42f5-b444-a4295d8e9314 or
ab9b8c07-8f02-4f72-87fa-80105867a763 or
cc15fd57-2c6c-4117-a88c-83b1d56b4bbe or
d52792f4-ba38-424d-8140-ada5b883f293 or
e8be65d6-d430-4289-a665-51bf2a194bda or
fc0f3af4-6835-4174-b806-f7db311fd2f3
) and
not (
azure.signinlogs.properties.resource_id:c2ada927-a9e2-4564-aae2-70775a2fa0af and
(
azure.signinlogs.properties.app_id:00000002-0000-0ff1-ce00-000000000000 and
azure.signinlogs.properties.device_detail.operating_system:Windows or
azure.signinlogs.properties.app_id:5f00fd34-f302-417f-81ef-1adda179d8fd and
azure.signinlogs.properties.device_detail.operating_system:Windows*
) and
azure.signinlogs.properties.device_detail.is_managed:true and
azure.signinlogs.properties.device_detail.is_compliant:true and
azure.signinlogs.properties.device_detail.trust_type:("Azure AD joined" or "Hybrid Azure AD joined") and
azure.signinlogs.properties.device_detail.device_id:(* and not "") and
azure.signinlogs.properties.incoming_token_type:none and
azure.signinlogs.properties.client_app_used:Browser and
azure.signinlogs.category:NonInteractiveUserSignInLogs
)
'''
[rule.investigation_fields]
field_names = [
"@timestamp",
"azure.correlation_id",
"azure.signinlogs.category",
"azure.signinlogs.identity",
"azure.signinlogs.properties.app_display_name",
"azure.signinlogs.properties.app_id",
"azure.signinlogs.properties.app_owner_tenant_id",
"azure.signinlogs.properties.authentication_requirement",
"azure.signinlogs.properties.client_credential_type",
"azure.signinlogs.properties.conditional_access_status",
"azure.signinlogs.properties.device_detail.operating_system",
"azure.signinlogs.properties.is_interactive",
"azure.signinlogs.properties.session_id",
"azure.signinlogs.properties.user_principal_name",
"azure.signinlogs.properties.user_type",
"azure.signinlogs.result_signature",
"azure.tenant_id",
"source.address",
"user.id"
]
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[[rule.threat.technique.subtechnique]]
id = "T1078.004"
name = "Cloud Accounts"
reference = "https://attack.mitre.org/techniques/T1078/004/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1550"
name = "Use Alternate Authentication Material"
reference = "https://attack.mitre.org/techniques/T1550/"
[[rule.threat.technique.subtechnique]]
id = "T1550.001"
name = "Application Access Token"
reference = "https://attack.mitre.org/techniques/T1550/001/"
[[rule.threat.technique]]
id = "T1656"
name = "Impersonation"
reference = "https://attack.mitre.org/techniques/T1656/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[rule.new_terms]
field = "new_terms_fields"
value = ["azure.signinlogs.properties.user_principal_name", "azure.signinlogs.properties.app_id"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-10d"
Stages and Predicates
Stage 1: new_terms
data_stream.dataset:azure.signinlogs and
azure.signinlogs.properties.authentication_processing_details:(*user_impersonation* and not *restricted_user_impersonation*) and
azure.signinlogs.properties.authentication_requirement:singleFactorAuthentication and
azure.signinlogs.properties.token_issuer_type:AzureAD and
azure.signinlogs.properties.token_protection_status_details.sign_in_session_status:unbound and
azure.signinlogs.properties.user_type:Member and
azure.signinlogs.properties.conditional_access_status:"notApplied" and
not user_agent.original:(Microsoft*Authentication*iPhone* or Mozilla*PKeyAuth/1.0) and
not azure.signinlogs.properties.device_detail.operating_system:(Android* or Ios*) and
event.outcome:success and
not azure.signinlogs.properties.app_id:(
0000000c-0000-0000-c000-000000000000 or
0a5f63c0-b750-4f38-a71c-4fc0d58b89e2 or
48af08dc-f6d2-435f-b2a7-069abd99c086 or
5e3ce6c0-2b1f-4285-8d4b-75ee78787346 or
65d91a3d-ab74-42e6-8a2f-0add61688c74 or
66a88757-258c-4c72-893c-3e8bed4d6899 or
6bc3b958-689b-49f5-9006-36d165f30e00 or
8c59ead7-d703-4a27-9e55-c96a0054c8d2 or
95de633a-083e-42f5-b444-a4295d8e9314 or
ab9b8c07-8f02-4f72-87fa-80105867a763 or
cc15fd57-2c6c-4117-a88c-83b1d56b4bbe or
d52792f4-ba38-424d-8140-ada5b883f293 or
e8be65d6-d430-4289-a665-51bf2a194bda or
fc0f3af4-6835-4174-b806-f7db311fd2f3
) and
not (
azure.signinlogs.properties.resource_id:c2ada927-a9e2-4564-aae2-70775a2fa0af and
(
azure.signinlogs.properties.app_id:00000002-0000-0ff1-ce00-000000000000 and
azure.signinlogs.properties.device_detail.operating_system:Windows or
azure.signinlogs.properties.app_id:5f00fd34-f302-417f-81ef-1adda179d8fd and
azure.signinlogs.properties.device_detail.operating_system:Windows*
) and
azure.signinlogs.properties.device_detail.is_managed:true and
azure.signinlogs.properties.device_detail.is_compliant:true and
azure.signinlogs.properties.device_detail.trust_type:("Azure AD joined" or "Hybrid Azure AD joined") and
azure.signinlogs.properties.device_detail.device_id:(* and not "") and
azure.signinlogs.properties.incoming_token_type:none and
azure.signinlogs.properties.client_app_used:Browser and
azure.signinlogs.category:NonInteractiveUserSignInLogs
)
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
Execution via GitHub Actions Runner
#This rule detects potentially dangerous commands spawned by the GitHub Actions Runner.Worker process or by shell interpreters launched via a runner entrypoint script on self-hosted runner machines. Adversaries who gain the ability to modify or trigger workflows in a linked GitHub repository can execute arbitrary commands on the runner host. This behavior may indicate malicious or unexpected workflow activity, including code execution, reconnaissance, credential harvesting, or network exfiltration initiated through a compromised repository or unauthorized workflow.
Known False Positives
- Authorized GitHub actions runner with no malicious workflow actions.
MITRE ATT&CK Coverage
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2025/11/26"
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike", "auditd_manager"]
maturity = "production"
updated_date = "2026/04/22"
[rule]
author = ["Elastic"]
description = """
This rule detects potentially dangerous commands spawned by the GitHub Actions Runner.Worker process or by shell
interpreters launched via a runner entrypoint script on self-hosted runner machines. Adversaries who gain the ability
to modify or trigger workflows in a linked GitHub repository can execute arbitrary commands on the runner host. This
behavior may indicate malicious or unexpected workflow activity, including code execution, reconnaissance, credential
harvesting, or network exfiltration initiated through a compromised repository or unauthorized workflow.
"""
false_positives = [
"Authorized GitHub actions runner with no malicious workflow actions.",
]
from = "now-9m"
index = [
"endgame-*",
"logs-crowdstrike.fdr*",
"logs-endpoint.events.process-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-system.security*",
"logs-windows.forwarded*",
"logs-windows.sysmon_operational-*",
"winlogbeat-*",
"auditbeat-*",
"logs-auditd_manager.auditd-*"
]
language = "eql"
license = "Elastic License v2"
name = "Execution via GitHub Actions Runner"
note = """## Triage and analysis
### Investigating Execution via GitHub Actions Runner
Adversaries who gain the ability to modify or trigger workflows in a linked GitHub repository can execute arbitrary
commands on the runner host. This rule covers two parent process paths:
- **Direct execution**: process spawned directly by `Runner.Worker` / `Runner.Worker.exe`.
- **Entrypoint script execution**: process spawned by a shell (`sh`, `bash`, `zsh`) whose command line references
a runner `entrypoint.sh` script, a common pattern when the runner bootstraps workflow steps via a shell script.
### Possible investigation steps
- Review `process.command_line` and `process.parent.command_line` to determine whether the activity matches a known,
authorized workflow step.
- For `grep`, `find`, `pgrep`, `printenv`, and `env` hits, assess whether the command targets sensitive paths, environment
variables (e.g. secrets, tokens), or process listings inconsistent with the declared workflow.
- For `openssl` and `base64` hits, inspect arguments for encoding/decoding operations that may indicate credential
harvesting, data staging, or a C2 channel.
- For `tr` and `cat` hits, assess whether they are chained with other suspicious commands (e.g. `cat /etc/passwd | base64`,
`cat ~/.ssh/id_rsa`) to read and encode sensitive files for exfiltration.
- For `nc`, `ncat`, `netcat`, and `socat` hits, check arguments for reverse shell patterns or port-forwarding to
attacker-controlled infrastructure.
- For `wg` and `wg-quick` hits, inspect arguments for tunnel configuration that may establish a covert egress channel.
- For `ssh` hits, review arguments for reverse tunnel flags (`-R`) or connections to unexpected remote hosts.
- For `kubectl` and `helm` hits, assess whether commands target sensitive namespaces, extract secrets, or deploy
workloads inconsistent with the declared workflow.
- For `vault` hits, inspect arguments for secret reads (`vault kv get`) or token operations that may indicate
credential harvesting from a HashiCorp Vault instance.
- For `gh` hits, review arguments for repository cloning, secret access (`gh secret`), or actions that escalate
access via the runner's GitHub token.
- For `nmap` hits, assess whether the command performs host or port discovery against internal network ranges,
indicating lateral movement preparation.
- Examine associated network activity for unexpected outbound connections, especially following `curl`, `wget`, or
`openssl s_client` invocations.
- Verify whether the triggering workflow run was initiated by an authorized actor and matches the repository's
expected workflow definitions.
- Correlate with file-write and file-access events to identify any sensitive file staging or collection activity.
- Correlate with other alerts to determine if this activity is part of a broader supply chain or CI/CD compromise.
### False positive analysis
- Authorized GitHub workflow actions that legitimately use discovery utilities (`find`, `grep`, `env`, `nmap`), data
manipulation tools (`cat`, `tr`), encoding tools (`openssl`, `base64`), remote access tools (`ssh`), or
infrastructure CLIs (`kubectl`, `helm`, `vault`, `gh`) as part of their build, test, or deploy steps may trigger
this rule. Validate against known workflow definitions and consider adding workflow-specific exclusions if the
volume is high.
### Response and remediation
- Immediately isolate the affected system from the network to prevent further unauthorized command execution and potential lateral movement.
- Terminate any suspicious child processes that were initiated by the Github actions runner.
- Conduct a thorough review of the affected system's logs and configurations to identify any unauthorized changes or additional indicators of compromise.
- Restore the system from a known good backup if any unauthorized changes or malicious activities are confirmed.
- Implement application whitelisting to prevent unauthorized execution.
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to assess the potential impact on the broader network."""
references = [
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
"https://socket.dev/blog/shai-hulud-strikes-again-v2",
]
risk_score = 47
rule_id = "a640ef5b-e1da-4b17-8391-468fdbd1b517"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Linux",
"OS: Windows",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Initial Access",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Windows Security Event Logs",
"Data Source: Microsoft Defender XDR",
"Data Source: Sysmon",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
"Data Source: Auditd Manager",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
(
/* Direct child of the GitHub Actions Runner.Worker process */
process.parent.name in ("Runner.Worker", "Runner.Worker.exe") or
/* Child of a shell interpreter launched via a runner entrypoint script
(e.g. /home/runner/runners/<ver>/run/entrypoint.sh or similar paths) */
(
process.parent.name in ("sh", "bash", "zsh") and
process.parent.command_line like "*runner*entrypoint.sh"
)
) and
(
process.name : (
/* Network / download utilities */
"curl", "curl.exe", "wget", "wget.exe",
/* Windows scripting & LOLBins */
"powershell.exe", "cmd.exe", "pwsh.exe", "certutil.exe", "rundll32.exe",
/* Unix shells */
"bash", "sh", "zsh", "dash", "ash", "tcsh", "csh", "ksh", "fish", "mksh", "busybox", "pwsh",
/* File / archive manipulation */
"tar", "gzip", "rm", "sed", "chmod",
/* macOS-specific */
"osascript",
/* Process persistence helpers */
"nohup", "setsid",
/* Scripting runtimes */
"python*", "perl*", "ruby*", "lua*", "php*", "node", "nodejs", "node.exe",
/* Discovery & reconnaissance */
"pgrep", "grep", "find", "printenv", "env", "nmap",
/* Crypto / encoding (potential exfiltration or C2 channel) */
"openssl", "base64", "basez", "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16", "xxd",
/* Data manipulation / inspection */
"tr", "cat",
/* Network relay / tunneling */
"nc", "ncat", "netcat", "nc.traditional", "nc.openbsd", "socat", "wg", "wg-quick",
/* Remote access */
"ssh", "ssh.exe", "ftp", "tftp", "scp", "sftp",
/* Kubernetes / infrastructure */
"kubectl", "helm", "docker", "ctr", "crictl",
/* Secret management */
"vault",
/* GitHub CLI */
"gh",
/* AWS CLI */
"aws",
/*Azure CLI */
"az",
/*GCP CLI */
"gcloud",
/* Google Workspace CLI */
"gws"
) or
process.executable : ("/tmp/*", "/private/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "?:\\Users\\*")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"
[[rule.threat.technique.subtechnique]]
id = "T1059.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[rule.threat.technique.subtechnique]]
id = "T1059.002"
name = "AppleScript"
reference = "https://attack.mitre.org/techniques/T1059/002/"
[[rule.threat.technique.subtechnique]]
id = "T1059.003"
name = "Windows Command Shell"
reference = "https://attack.mitre.org/techniques/T1059/003/"
[[rule.threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[rule.threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[rule.threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[rule.threat.technique.subtechnique]]
id = "T1195.002"
name = "Compromise Software Supply Chain"
reference = "https://attack.mitre.org/techniques/T1195/002/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1218"
name = "System Binary Proxy Execution"
reference = "https://attack.mitre.org/techniques/T1218/"
[[rule.threat.technique.subtechnique]]
id = "T1218.011"
name = "Rundll32"
reference = "https://attack.mitre.org/techniques/T1218/011/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
(
process.parent.name in ("Runner.Worker", "Runner.Worker.exe") or
/* Child of a shell interpreter launched via a runner entrypoint script
(e.g. /home/runner/runners/<ver>/run/entrypoint.sh or similar paths) */
(
process.parent.name in ("sh", "bash", "zsh") and
process.parent.command_line like "*runner*entrypoint.sh"
)
) and
(
process.name : (
"curl", "curl.exe", "wget", "wget.exe",
"powershell.exe", "cmd.exe", "pwsh.exe", "certutil.exe", "rundll32.exe",
"bash", "sh", "zsh", "dash", "ash", "tcsh", "csh", "ksh", "fish", "mksh", "busybox", "pwsh",
"tar", "gzip", "rm", "sed", "chmod",
"osascript",
"nohup", "setsid",
"python*", "perl*", "ruby*", "lua*", "php*", "node", "nodejs", "node.exe",
"pgrep", "grep", "find", "printenv", "env", "nmap",
"openssl", "base64", "basez", "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16", "xxd",
"tr", "cat",
"nc", "ncat", "netcat", "nc.traditional", "nc.openbsd", "socat", "wg", "wg-quick",
"ssh", "ssh.exe", "ftp", "tftp", "scp", "sftp",
"kubectl", "helm", "docker", "ctr", "crictl",
"vault",
"gh",
"aws",
"az",
"gcloud",
"gws"
) or
process.executable : ("/tmp/*", "/private/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "?:\\Users\\*")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
process.parent.command_line | wildcard |
| field:"ParentCommandLine" kind:wildcard value:"*runner*entrypoint.sh" |
process.parent.name | in |
| field:"parent_process_basename" kind:in |
GKE Pod Exec with Curl or Wget to HTTPS
#Detects successful GKE pod exec sessions where the executed command implies curl or wget fetching an HTTPS URL. Attackers with pods/exec often run one-liners to stage tooling, pull scripts or binaries, or exfiltrate data over HTTPS—activity that should be rare compared to shells, debuggers, or expected health checks. Common cluster health, localhost, and OIDC/JWKS endpoint patterns are excluded to reduce benign automation noise. GKE records the command in gcp.audit.labels.command.gke.io/command when an explicit command is passed to exec.
Known False Positives
- Approved runbooks or support sessions may use kubectl exec with curl/wget to test egress or download vendor tools.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Command & Control |
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Kubernetes | get-pods-exec: get pods/exec |
| Kubernetes | create-pods-exec: create pods/exec |
Rules Detecting the Same Action
These rules filter on the same operation.
- Azure AKS Attempted User Exec into Pod (Elastic)
- Container With A hostPath Mount Created (Sigma)
- Creation Of Pod In System Namespace (Sigma)
- Direct Interactive Kubernetes API Request by Unusual Utilities (Elastic)
- Exec into Pod (Panther)
- GCP Break-glass Container Workload Deployed (Sigma)
- GCP K8s Pod Attached To Node Host Network (Panther)
- GCP K8S Pod Create Or Modify Host Path Volume Mount (Panther)
Rule Body
[metadata]
creation_date = "2026/07/15"
integration = ["gcp"]
maturity = "production"
updated_date = "2026/07/15"
[rule]
author = ["Elastic"]
description = """
Detects successful GKE pod exec sessions where the executed command implies curl or wget fetching an HTTPS URL.
Attackers with pods/exec often run one-liners to stage tooling, pull scripts or binaries, or exfiltrate data over
HTTPS—activity that should be rare compared to shells, debuggers, or expected health checks. Common cluster health,
localhost, and OIDC/JWKS endpoint patterns are excluded to reduce benign automation noise. GKE records the command in
gcp.audit.labels.command.gke.io/command when an explicit command is passed to exec.
"""
false_positives = [
"""
Approved runbooks or support sessions may use kubectl exec with curl/wget to test egress or download vendor tools.
""",
]
from = "now-6m"
index = ["logs-gcp.audit-*"]
language = "kuery"
license = "Elastic License v2"
name = "GKE Pod Exec with Curl or Wget to HTTPS"
note = """## Triage and analysis
### Investigating GKE Pod Exec with Curl or Wget to HTTPS
This alert fires when a successful pods/exec API call includes a curl or wget command targeting HTTPS.
Review `gcp.audit.labels.command.gke.io/command` for the full command and destination URL.
### Possible investigation steps
- Confirm who may exec into the target namespace: `client.user.email`, source IP, and user agent (kubectl, CI, automation).
- Map `gcp.audit.resource_name` to the pod/workload owner and retrieve the exact command from the alert document.
- Search for adjacent audit events from the same identity: secret reads, additional execs, RBAC changes, or anonymous access.
- If malicious, revoke credentials used for exec, review RoleBindings for pods/exec, and inspect the pod for dropped artifacts.
### False positive analysis
- Approved egress or tool-download tests may match; allowlist those identities after validation.
- Some cluster components use HTTPS to kubernetes.default.svc or .well-known endpoints; expand exclusions if needed.
### Response and remediation
- Rotate secrets accessible from the pod, cordon or delete the workload if compromised, and tighten RBAC so only
required principals retain pods/exec on sensitive namespaces.
"""
setup = "The GCP Fleet integration with GKE audit logs enabled is required to be compatible with this rule."
references = [
"https://attack.mitre.org/techniques/T1609/",
"https://attack.mitre.org/techniques/T1105/",
]
risk_score = 73
rule_id = "3a68325b-6169-44c1-a5f0-0102ef82b6f1"
severity = "high"
tags = [
"Domain: Cloud",
"Domain: Kubernetes",
"Data Source: GCP",
"Data Source: GCP Audit Logs",
"Data Source: Google Cloud Platform",
"Use Case: Threat Detection",
"Tactic: Execution",
"Tactic: Command and Control",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "query"
query = '''
data_stream.dataset:gcp.audit and service.name:"k8s.io" and event.outcome:success and
event.type:start and
event.action:("io.k8s.core.v1.pods.exec.create" or "io.k8s.core.v1.pods.exec.get") and
gcp.audit.labels.command.gke.io/command:(
(*curl*https* or *wget*https*) and not (
*/.well-known/jwks.json* or */.well-known/openid-configuration* or
*/api/v1/health* or */healthz* or */livez* or */readyz* or
*/openid-connect/certs* or */openid/v1/jwks* or
*127.0.0.1* or *kubernetes.default.svc* or *localhost*
)
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1609"
name = "Container Administration Command"
reference = "https://attack.mitre.org/techniques/T1609/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1105"
name = "Ingress Tool Transfer"
reference = "https://attack.mitre.org/techniques/T1105/"
[rule.threat.tactic]
id = "TA0011"
name = "Command and Control"
reference = "https://attack.mitre.org/tactics/TA0011/"
[rule.investigation_fields]
field_names = [
"@timestamp",
"client.user.email",
"source.ip",
"user_agent.original",
"event.action",
"event.outcome",
"event.type",
"gcp.audit.labels.command.gke.io/command",
"gcp.audit.resource_name",
"data_stream.namespace",
]
Stages and Predicates
Stage 1: query
data_stream.dataset:gcp.audit and service.name:"k8s.io" and event.outcome:success and
event.type:start and
event.action:("io.k8s.core.v1.pods.exec.create" or "io.k8s.core.v1.pods.exec.get") and
gcp.audit.labels.command.gke.io/command:(
(*curl*https* or *wget*https*) and not (
*/.well-known/jwks.json* or */.well-known/openid-configuration* or
*/api/v1/health* or */healthz* or */livez* or */readyz* or
*/openid-connect/certs* or */openid/v1/jwks* or
*127.0.0.1* or *kubernetes.default.svc* or *localhost*
)
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
data_stream.dataset | eq |
| field:"data_stream.dataset" kind:eq value:"gcp.audit" |
event.action | in |
| field:"EventType" kind:in |
event.outcome | eq |
| field:"event.outcome" kind:eq value:"success" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
gcp.audit.labels.command.gke.io/command | wildcard |
| field:"gcp.audit.labels.command.gke.io/command" kind:wildcard |
service.name | eq |
| field:"ServiceName" kind:eq value:"k8s.io" |
Exclusions
The rule actively suppresses these predicates.
Kubernetes Sensitive Configuration File Activity
#This rule detects the creation or modification of sensitive Kubernetes configuration files on Linux systems. These files include Kubernetes manifests, PKI files, and configuration files that are critical for the operation of Kubernetes clusters. Monitoring these files helps identify potential unauthorized changes or misconfigurations that could lead to security vulnerabilities in Kubernetes environments. Attackers may attempt to modify these files to gain persistence or to deploy malicious containers within the Kubernetes cluster.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Persistence | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2025/06/26"
integration = ["endpoint", "cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
This rule detects the creation or modification of sensitive Kubernetes configuration files on Linux systems. These files
include Kubernetes manifests, PKI files, and configuration files that are critical for the operation of Kubernetes clusters.
Monitoring these files helps identify potential unauthorized changes or misconfigurations that could lead to security
vulnerabilities in Kubernetes environments. Attackers may attempt to modify these files to gain persistence or to
deploy malicious containers within the Kubernetes cluster.
"""
from = "now-9m"
index = ["logs-endpoint.events.file*", "logs-cloud_defend.file*"]
language = "eql"
license = "Elastic License v2"
name = "Kubernetes Sensitive Configuration File Activity"
note = """ ## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Kubernetes Sensitive Configuration File Activity
Kubernetes relies on configuration files to manage cluster operations, including manifests and PKI files. These files are crucial for defining the desired state and security of the cluster. Adversaries may exploit these files to gain persistence or deploy unauthorized containers. The detection rule monitors for unauthorized changes to these files, excluding legitimate processes, to identify potential security threats.
### Possible investigation steps
- Review the alert details to identify the specific file path that triggered the alert, focusing on paths like "/etc/kubernetes/manifests/*", "/etc/kubernetes/pki/*", or "/etc/kubernetes/*.conf".
- Check the process that attempted to modify the file by examining the process name and compare it against the list of excluded legitimate processes ("kubeadm", "kubelet", "dpkg", "sed") to determine if it is suspicious.
- Investigate the user account associated with the process that made the change to assess if the account has the necessary permissions and if it has been compromised.
- Analyze recent activity on the host to identify any other unusual or unauthorized actions that might correlate with the file modification, such as unexpected network connections or process executions.
- Review the history of changes to the affected file to determine if there have been other unauthorized modifications or if this is an isolated incident.
- Consult Kubernetes audit logs, if available, to gather additional context on the actions performed around the time of the alert, focusing on any anomalies or unauthorized access attempts.
### False positive analysis
- Routine updates or maintenance activities by system administrators can trigger alerts. To manage this, consider excluding processes or users known to perform regular maintenance from the rule.
- Automated scripts or configuration management tools like Ansible or Puppet may modify configuration files as part of their normal operation. Identify these tools and add them to the exclusion list to prevent unnecessary alerts.
- Scheduled backups or system snapshots might access or modify configuration files. Ensure that these processes are recognized and excluded if they are part of a regular, non-threatening operation.
- Legitimate software updates or patches may alter configuration files. Monitor update schedules and exclude these processes during known update windows to reduce false positives.
- Custom scripts developed in-house for cluster management might not be recognized by default. Review these scripts and add them to the exclusion list if they are verified as safe and necessary for operations.
### Response and remediation
- Immediately isolate the affected node or container to prevent further unauthorized access or changes to the Kubernetes configuration files.
- Review the modified configuration files to identify unauthorized changes and revert them to their last known good state using backups or version control systems.
- Conduct a thorough investigation to identify the source of the unauthorized changes, focusing on process names and user accounts involved in the modification.
- Escalate the incident to the security operations team for further analysis and to determine if additional systems or nodes have been compromised.
- Implement additional access controls and monitoring on the affected systems to prevent recurrence, such as restricting write permissions to sensitive directories and files.
- Update and patch the Kubernetes environment and related components to address any vulnerabilities that may have been exploited.
- Enhance detection capabilities by ensuring that alerts are configured to notify the security team of any future unauthorized changes to critical Kubernetes configuration files.
"""
risk_score = 47
rule_id = "0fe2290a-2664-4c9c-8263-b88904f12f0d"
setup = """## Setup
This rule requires data coming in from Elastic Defend.
### Elastic Defend Integration Setup
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
#### Prerequisite Requirements:
- Fleet is required for Elastic Defend.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
- Click "Add Elastic Defend".
- Configure the integration name and optionally add a description.
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
- Click "Save and Continue".
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"Domain: Kubernetes",
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Data Source: Elastic Defend for Containers",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "linux" and event.type != "deletion" and file.path like (
"/etc/kubernetes/manifests/*",
"/etc/kubernetes/pki/*",
"/etc/kubernetes/*.conf"
) and not (
process.name in ("kubeadm", "kubelet", "dpkg", "sed") or
(process.name in ("vi", "vim", "vim.basic") and file.extension in ("swx", "swp"))
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1053"
name = "Scheduled Task/Job"
reference = "https://attack.mitre.org/techniques/T1053/"
[[rule.threat.technique.subtechnique]]
id = "T1053.007"
name = "Container Orchestration Job"
reference = "https://attack.mitre.org/techniques/T1053/007/"
[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[rule.threat.technique.subtechnique]]
id = "T1543.005"
name = "Container Service"
reference = "https://attack.mitre.org/techniques/T1543/005/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1610"
name = "Deploy Container"
reference = "https://attack.mitre.org/techniques/T1610/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1543"
name = "Create or Modify System Process"
reference = "https://attack.mitre.org/techniques/T1543/"
[[rule.threat.technique.subtechnique]]
id = "T1543.005"
name = "Container Service"
reference = "https://attack.mitre.org/techniques/T1543/005/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: file
file where host.os.type == "linux" and event.type != "deletion" and file.path like (
"/etc/kubernetes/manifests/*",
"/etc/kubernetes/pki/*",
"/etc/kubernetes/*.conf"
) and not (
process.name in ("kubeadm", "kubelet", "dpkg", "sed") or
(process.name in ("vi", "vim", "vim.basic") and file.extension in ("swx", "swp"))
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
file.extension | in | swp, swx | excludes:file.extension field:"file.extension" value:"swp" field:"file.extension" value:"swx" |
process.name | in | vi, vim, vim.basic | excludes:process.name field:"process.name" value:"vi" field:"process.name" value:"vim" field:"process.name" value:"vim.basic" |
process.name | in | dpkg, kubeadm, kubelet, sed | excludes:process.name |
Linux Clipboard Activity Detected
#This rule monitors for the usage of the most common clipboard utilities on unix systems by an uncommon process parent. Adversaries may collect data stored in the clipboard from users copying information within or between applications.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Collection |
Rule Body
[metadata]
creation_date = "2023/07/27"
integration = ["endpoint", "auditd_manager", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/08/21"
[rule]
author = ["Elastic"]
description = """
This rule monitors for the usage of the most common clipboard utilities on unix systems by an uncommon process parent.
Adversaries may collect data stored in the clipboard from users copying information within or between applications.
"""
from = "now-9m"
index = [
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
"endgame-*",
"auditbeat-*",
"logs-auditd_manager.auditd-*",
]
language = "kuery"
license = "Elastic License v2"
name = "Linux Clipboard Activity Detected"
references = ["https://www.trellix.com/blogs/research/when-agents-go-rogue-openclaw-supply-chain-crisis/"]
risk_score = 21
rule_id = "884e87cc-c67b-4c90-a4ed-e1e24a940c82"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Collection",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Auditd Manager",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category:process and host.os.type:"linux" and event.type:"start" and
event.action:("exec" or "exec_event" or "executed" or "process_started" or "start") and
process.name:("xclip" or "xsel" or "wl-clipboard" or "clipman" or "copyq" or "pbcopy" or "wl-copy") and
not process.parent.name:("bwrap" or "micro")
'''
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Linux Clipboard Activity Detected
Clipboard utilities on Linux, such as xclip and xsel, facilitate data transfer between applications by storing copied content temporarily. Adversaries exploit this by capturing sensitive data copied by users. The detection rule identifies unusual clipboard activity by monitoring processes that start these utilities, excluding common parent processes, to flag potential misuse. This helps in identifying unauthorized data collection attempts.
### Possible investigation steps
- Review the alert details to identify the specific process name that triggered the alert, focusing on clipboard utilities like xclip, xsel, wl-clipboard, clipman, or copyq.
- Examine the parent process of the detected clipboard utility to understand the context of its execution, ensuring it is not a common parent process like bwrap or micro.
- Investigate the user account associated with the process to determine if the activity aligns with their typical behavior or if it appears suspicious.
- Check the timing and frequency of the clipboard utility's execution to assess if it coincides with any known user activities or if it suggests automated or unauthorized access.
- Analyze any related process events or logs around the time of the alert to identify potential data exfiltration attempts or other malicious activities.
- Consider correlating this alert with other security events or alerts to identify patterns or broader attack campaigns targeting clipboard data.
### False positive analysis
- Frequent use of clipboard utilities by legitimate applications or scripts can trigger false positives. Identify and document these applications to create exceptions in the detection rule.
- Developers and system administrators often use clipboard utilities in automated scripts. Review and whitelist these scripts to prevent unnecessary alerts.
- Some desktop environments or window managers may use clipboard utilities as part of their normal operation. Monitor and exclude these processes if they are verified as non-threatening.
- Regular user activities involving clipboard utilities for productivity tasks can be mistaken for suspicious behavior. Educate users on safe practices and adjust the rule to exclude known benign parent processes.
- Consider the context of the clipboard utility usage, such as time of day or user role, to refine detection criteria and reduce false positives.
### Response and remediation
- Immediately isolate the affected system from the network to prevent potential data exfiltration or further unauthorized access.
- Terminate any suspicious processes identified as running clipboard utilities without a common parent process, such as xclip or xsel, to stop potential data capture.
- Conduct a thorough review of recent clipboard activity logs to identify any sensitive data that may have been captured and assess the potential impact.
- Change passwords and rotate any credentials that may have been copied to the clipboard recently to mitigate the risk of credential theft.
- Escalate the incident to the security operations team for further investigation and to determine if additional systems are affected.
- Implement additional monitoring on the affected system to detect any further unauthorized clipboard activity or related suspicious behavior.
- Review and update endpoint security configurations to ensure that only authorized processes can access clipboard utilities, reducing the risk of future exploitation."""
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1115"
name = "Clipboard Data"
reference = "https://attack.mitre.org/techniques/T1115/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id", "process.parent.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
event.category:process and host.os.type:"linux" and event.type:"start" and
event.action:("exec" or "exec_event" or "executed" or "process_started" or "start") and
process.name:("xclip" or "xsel" or "wl-clipboard" or "clipman" or "copyq" or "pbcopy" or "wl-copy") and
not process.parent.name:("bwrap" or "micro")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.category | eq |
| field:"event.category" kind:eq value:"process" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.name | in | bwrap, micro | excludes:process.parent.name field:"process.parent.name" value:"bwrap" field:"process.parent.name" value:"micro" |
Linux Video Recording or Screenshot Activity Detected
#This rule monitors for the usage of the most common video recording or screenshot utilities on unix systems by an uncommon process parent. Adversaries may collect video or screenshot data from users or systems for a variety of reasons including espionage, credential theft, or reconnaissance.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Collection |
Rule Body
[metadata]
creation_date = "2026/01/07"
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2026/03/02"
[rule]
author = ["Elastic"]
description = """
This rule monitors for the usage of the most common video recording or screenshot utilities on unix systems
by an uncommon process parent. Adversaries may collect video or screenshot data from users or systems for a
variety of reasons including espionage, credential theft, or reconnaissance.
"""
from = "now-9m"
index = [
"logs-endpoint.events.process*",
"logs-sentinel_one_cloud_funnel.*",
"endgame-*",
]
language = "kuery"
license = "Elastic License v2"
name = "Linux Video Recording or Screenshot Activity Detected"
note = """ ## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Linux Video Recording or Screenshot Activity Detected
This alert flags the launch of common Linux screenshot or screen-recording tools—such as scrot, gnome-screenshot, flameshot, grim, or obs—when triggered by an atypical parent process, indicating potential visual data collection. A typical attacker pattern is a compromised user session or remote shell spawning scrot or grim during credential entry to capture MFA codes and application windows, or starting simplescreenrecorder/obs to persistently record the desktop for later exfiltration.
### Possible investigation steps
- Review the process lineage and session context to determine if the capture was launched interactively from a desktop or via ssh/cron/systemd or a script in transient directories.
- Inspect command-line options and environment variables (DISPLAY, WAYLAND_DISPLAY, XAUTHORITY) to identify window/region capture, explicit save targets, or headless clipboard-only usage.
- Search for newly created media files around the alert time (screenshots under ~/Pictures or /tmp, and recordings like .mkv/.webm) and evaluate their sensitivity and relevance.
- Verify binary provenance and integrity by checking installation logs, file path and ownership, hashes, and unexpected copies or modified ELF binaries in user-writable locations.
- Correlate with user and network telemetry for concurrent credential entry, browser MFA prompts, or outbound transfers/clipboard synchronization indicative of exfiltration.
### False positive analysis
- A user presses Print Screen or uses a desktop hotkey, and the environment launches gnome-screenshot, flameshot, or grim via a keybinding/compositor component, producing an uncommon parent despite benign activity.
- Legitimate demo or documentation recording with obs or simplescreenrecorder started by a wrapper script, cron, or a systemd unit can surface as a non-interactive start from an unusual parent without malicious intent.
### Response and remediation
- Immediately terminate the capture process (e.g., scrot, grim, flameshot, gnome-screenshot, simplescreenrecorder, obs) and isolate the host or terminate the GUI session, suspending the user and revoking SSH keys if the parent was sshd, cron, or a systemd unit.
- Eradicate launch points by deleting rogue systemd services/timers, crontab entries, ~/.config/autostart/*.desktop files, and scripts in /tmp or ~/bin that invoke these tools, and replace any trojanized binaries found outside package-managed paths.
- Recover by rotating passwords and invalidating MFA sessions/tokens used during the recorded period, then remove captured media (.png/.jpg/.webm/.mkv) from ~/Pictures, /tmp, and similar staging paths after evidence collection.
- Escalate to incident response and privacy/legal if screenshots/recordings contain credentials, customer data, or secrets, if execution originated from privileged users or servers, or if exfiltration is observed via scp/rsync/curl to external hosts.
- Harden endpoints by uninstalling unneeded screenshot/recording packages, enforcing allowlists and AppArmor/SELinux profiles that block scrot/grim/obs except for approved users, and requiring xdg-desktop-portal/PipeWire screencast prompts for console users only.
- Improve detection by alerting on these binaries executed by sshd/cron/systemd, repeated saves under ~/Pictures or /tmp, copies in user-writable paths (~/bin, /tmp), and outbound transfers of resulting media files.
"""
risk_score = 21
rule_id = "93dd73f9-3e59-45be-b023-c681273baf81"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Collection",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: SentinelOne",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "new_terms"
query = '''
event.category:process and host.os.type:"linux" and event.type:"start" and event.action:("exec" or "exec_event" or "start") and
process.name:(
"gnome-screenshot" or "spectacle" or "xfce4-screenshooter" or "mate-screenshot" or "scrot" or "maim" or "import" or "grim" or
"grimshot" or "slurp" or "flameshot" or "shutter" or "ksnip" or "deepin-screenshot" or "simplescreenrecorder" or "kazam" or
"vokoscreen" or "recordmydesktop" or "obs" or "obs-studio"
) and
not process.args:("-h" or "--help" or "--version")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1113"
name = "Screen Capture"
reference = "https://attack.mitre.org/techniques/T1113/"
[[rule.threat.technique]]
id = "T1125"
name = "Video Capture"
reference = "https://attack.mitre.org/techniques/T1125/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
[rule.new_terms]
field = "new_terms_fields"
value = ["host.id", "process.parent.executable"]
[[rule.new_terms.history_window_start]]
field = "history_window_start"
value = "now-5d"
Stages and Predicates
Stage 1: new_terms
event.category:process and host.os.type:"linux" and event.type:"start" and event.action:("exec" or "exec_event" or "start") and
process.name:(
"gnome-screenshot" or "spectacle" or "xfce4-screenshooter" or "mate-screenshot" or "scrot" or "maim" or "import" or "grim" or
"grimshot" or "slurp" or "flameshot" or "shutter" or "ksnip" or "deepin-screenshot" or "simplescreenrecorder" or "kazam" or
"vokoscreen" or "recordmydesktop" or "obs" or "obs-studio"
) and
not process.args:("-h" or "--help" or "--version")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | in |
| field:"EventType" kind:in |
event.category | eq |
| field:"event.category" kind:eq value:"process" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | in |
| field:"process_basename" kind:in |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | in | --help, --version, -h | excludes:process.args field:"process.args" value:"--help" field:"process.args" value:"--version" field:"process.args" value:"-h" |
Long Base64 Encoded Interpreter Command Line
#Identifies attempts to execute commands with long base64 encoded command lines. Adversaries may abuse this technique to execute malicious commands.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Stealth |
Rule Body
[rule]
description = """
Identifies attempts to execute commands with long base64 encoded command lines. Adversaries may abuse this technique to
execute malicious commands.
"""
id = "389cd325-5e24-4188-8dd3-f9b0ee637ce9"
license = "Elastic License v2"
name = "Long Base64 Encoded Interpreter Command Line"
os_list = ["windows"]
version = "1.0.3"
query = '''
process where event.type == "start" and
(
(
process.name like~ "python*" and
(
process.command_line like~ "*b64decode*" or
(
process.command_line like "*-c *" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ ("node*", "deno*") and
(
process.command_line like~ ("*atob(*", "*eval(*") or
(
process.command_line like~ "*buffer.from*" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ "php*" and
process.command_line like~ ("*base64_decode(*", "*convert.base64-decode*")
) or
(
process.name like~ "java*" and
process.command_line like~ "*base64*decode(*"
) or
(
process.name like~ "lua*" and
process.command_line like~ ("*mime.decode(*base64*", "*mime.unb64(*")
) or
(
process.name like~ "openssl*" and
process.command_line like~ ("*base64 -d*", "*-base64*")
)
) and length(process.command_line) >= 4000 and
not process.parent.executable : ("C:\\Users\\*\\git\\usr\\bin\\bash.exe", "C:\\Program Files\\Git\\usr\\bin\\bash.exe", "C:\\Program Files\\Git\\usr\\bin\\sh.exe")
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[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.001"
name = "PowerShell"
reference = "https://attack.mitre.org/techniques/T1059/001/"
[[threat.technique.subtechnique]]
id = "T1059.004"
name = "Unix Shell"
reference = "https://attack.mitre.org/techniques/T1059/004/"
[[threat.technique.subtechnique]]
id = "T1059.006"
name = "Python"
reference = "https://attack.mitre.org/techniques/T1059/006/"
[[threat.technique.subtechnique]]
id = "T1059.007"
name = "JavaScript"
reference = "https://attack.mitre.org/techniques/T1059/007/"
[[threat.technique.subtechnique]]
id = "T1059.011"
name = "Lua"
reference = "https://attack.mitre.org/techniques/T1059/011/"
[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1027"
name = "Obfuscated Files or Information"
reference = "https://attack.mitre.org/techniques/T1027/"
[[threat.technique]]
id = "T1140"
name = "Deobfuscate/Decode Files or Information"
reference = "https://attack.mitre.org/techniques/T1140/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: process
process where event.type == "start" and
(
(
process.name like~ "python*" and
(
process.command_line like~ "*b64decode*" or
(
process.command_line like "*-c *" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ ("node*", "deno*") and
(
process.command_line like~ ("*atob(*", "*eval(*") or
(
process.command_line like~ "*buffer.from*" and
process.command_line like~ "*base64*"
)
)
) or
(
process.name like~ "php*" and
process.command_line like~ ("*base64_decode(*", "*convert.base64-decode*")
) or
(
process.name like~ "java*" and
process.command_line like~ "*base64*decode(*"
) or
(
process.name like~ "lua*" and
process.command_line like~ ("*mime.decode(*base64*", "*mime.unb64(*")
) or
(
process.name like~ "openssl*" and
process.command_line like~ ("*base64 -d*", "*-base64*")
)
) and length(process.command_line) >= 4000 and
not process.parent.executable : ("C:\\Users\\*\\git\\usr\\bin\\bash.exe", "C:\\Program Files\\Git\\usr\\bin\\bash.exe", "C:\\Program Files\\Git\\usr\\bin\\sh.exe")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.command_line | wildcard |
| field:"CommandLine" kind:wildcard |
process.name | wildcard |
| field:"process_basename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.parent.executable | wildcard | C:\Users\*\git\usr\bin\bash.exe, C:\Program Files\Git\usr\bin\bash.exe, C:\Program Files\Git\usr\bin\sh.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Users\*\git\usr\bin\bash.exe" field:"process.parent.executable" value:"C:\Program Files\Git\usr\bin\bash.exe" field:"process.parent.executable" value:"C:\Program Files\Git\usr\bin\sh.exe" |
Persistence via PowerShell profile
#Identifies the creation or modification of a PowerShell profile. PowerShell profile is a script that is executed when PowerShell starts to customize the user environment, which can be abused by attackers to persist in a environment where PowerShell is common.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Persistence | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2022/10/13"
integration = ["endpoint", "windows", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike"]
maturity = "production"
updated_date = "2026/05/04"
[transform]
[[transform.osquery]]
label = "Osquery - Retrieve DNS Cache"
query = "SELECT * FROM dns_cache"
[[transform.osquery]]
label = "Osquery - Retrieve All Services"
query = "SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services"
[[transform.osquery]]
label = "Osquery - Retrieve Services Running on User Accounts"
query = """
SELECT description, display_name, name, path, pid, service_type, start_type, status, user_account FROM services WHERE
NOT (user_account LIKE '%LocalSystem' OR user_account LIKE '%LocalService' OR user_account LIKE '%NetworkService' OR
user_account == null)
"""
[[transform.osquery]]
label = "Osquery - Retrieve Service Unsigned Executables with Virustotal Link"
query = """
SELECT concat('https://www.virustotal.com/gui/file/', sha1) AS VtLink, name, description, start_type, status, pid,
services.path FROM services JOIN authenticode ON services.path = authenticode.path OR services.module_path =
authenticode.path JOIN hash ON services.path = hash.path WHERE authenticode.result != 'trusted'
"""
[rule]
author = ["Elastic"]
description = """
Identifies the creation or modification of a PowerShell profile. PowerShell profile is a script that is executed when
PowerShell starts to customize the user environment, which can be abused by attackers to persist in a environment where
PowerShell is common.
"""
from = "now-9m"
index = [
"winlogbeat-*",
"logs-endpoint.events.file-*",
"logs-windows.sysmon_operational-*",
"endgame-*",
"logs-m365_defender.event-*",
"logs-sentinel_one_cloud_funnel.*",
"logs-crowdstrike.fdr*",
]
language = "eql"
license = "Elastic License v2"
name = "Persistence via PowerShell profile"
note = """## Triage and analysis
### Investigating Persistence via PowerShell profile
PowerShell profiles are scripts executed when PowerShell starts, customizing the user environment. They are commonly used in Windows environments for legitimate purposes, such as setting variables or loading modules. However, adversaries can abuse PowerShell profiles to establish persistence by inserting malicious code that executes each time PowerShell is launched.
This rule identifies the creation or modification of a PowerShell profile. It does this by monitoring file events on Windows systems, specifically targeting profile-related file paths and names, such as `profile.ps1` and `Microsoft.Powershell_profile.ps1`. By detecting these activities, security analysts can investigate potential abuse of PowerShell profiles for malicious persistence.
> **Note**:
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
### Possible investigation steps
- Retrive and inspect the PowerShell profile content; look for suspicious DLL imports, collection or persistence capabilities, suspicious functions, encoded or compressed data, suspicious commands, and other potentially malicious characteristics.
- Identify the process responsible for the PowerShell profile creation/modification. Use the Elastic Defend events to examine all the activity of the subject process by filtering by the process's `process.entity_id`.
- Investigate other alerts associated with the user/host during the past 48 hours.
- Evaluate whether the user needs to use PowerShell to complete tasks.
- Check for additional PowerShell and command-line logs that indicate that any suspicious command or function were run.
- Examine the host for derived artifacts that indicate suspicious activities:
- Observe and collect information about the following activities in the alert subject host:
- Attempts to contact external domains and addresses.
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process's `process.entity_id`.
- Examine the DNS cache for suspicious or anomalous entries.
- $osquery_0
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
- Examine the host services for suspicious or anomalous entries.
- $osquery_1
- $osquery_2
- $osquery_3
### False positive analysis
- This is a dual-use mechanism, meaning its usage is not inherently malicious. Analysts can dismiss the alert if the script doesn't contain malicious functions or potential for abuse, no other suspicious activity was identified, and the user has business justifications to use PowerShell.
### Response and remediation
- Initiate the incident response process based on the outcome of the triage.
- If malicious activity is confirmed, perform a broader investigation to identify the scope of the compromise and determine the appropriate remediation steps.
- Isolate the involved hosts to prevent further post-compromise behavior.
- If the triage identified malware, search the environment for additional compromised hosts.
- Implement temporary network rules, procedures, and segmentation to contain the malware.
- Stop suspicious processes.
- Immediately block the identified indicators of compromise (IoCs).
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
- Remove and block malicious artifacts identified during triage.
- Reimage the host operating system or restore the compromised files to clean versions.
- Restrict PowerShell usage outside of IT and engineering business units using GPOs, AppLocker, Intune, or similar software.
- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
- Consider enabling and collecting PowerShell logs such as transcription, module, and script block logging, to improve visibility into PowerShell activities.
"""
setup = """## Setup
This rule is designed for data generated by [Elastic Defend](https://www.elastic.co/security/endpoint-security), which provides native endpoint detection and response, along with event enrichments designed to work with our detection rules.
Setup instructions: https://ela.st/install-elastic-defend
### Additional data sources
This rule also supports the following third-party data sources. For setup instructions, refer to the links below:
- [CrowdStrike](https://ela.st/crowdstrike-integration)
- [Microsoft Defender XDR](https://ela.st/m365-defender)
- [SentinelOne Cloud Funnel](https://ela.st/sentinel-one-cloud-funnel)
- [Sysmon Event ID 11 - File Create](https://ela.st/sysmon-event-11-setup)
"""
references = [
"https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles",
"https://www.welivesecurity.com/2019/05/29/turla-powershell-usage/",
]
risk_score = 47
rule_id = "5cf6397e-eb91-4f31-8951-9f0eaa755a31"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Tactic: Privilege Escalation",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Sysmon",
"Data Source: Microsoft Defender XDR",
"Data Source: SentinelOne",
"Data Source: Crowdstrike",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "windows" and event.type != "deletion" and
file.name : ("profile.ps1", "Microsoft.Powershell_profile.ps1") and
file.path : ("?:\\Users\\*\\Documents\\WindowsPowerShell\\*.ps1",
"?:\\Users\\*\\Documents\\PowerShell\\*.ps1",
"?:\\Windows\\System32\\WindowsPowerShell\\*.ps1",
"\\Device\\HarddiskVolume*\\Users\\*\\Documents\\WindowsPowerShell\\*.ps1",
"\\Device\\HarddiskVolume*\\Users\\*\\Documents\\PowerShell\\*.ps1",
"\\Device\\HarddiskVolume*\\Windows\\System32\\WindowsPowerShell\\*.ps1")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.013"
name = "PowerShell Profile"
reference = "https://attack.mitre.org/techniques/T1546/013/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[[rule.threat.technique.subtechnique]]
id = "T1546.013"
name = "PowerShell Profile"
reference = "https://attack.mitre.org/techniques/T1546/013/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: file
file where host.os.type == "windows" and event.type != "deletion" and
file.name : ("profile.ps1", "Microsoft.Powershell_profile.ps1") and
file.path : ("?:\\Users\\*\\Documents\\WindowsPowerShell\\*.ps1",
"?:\\Users\\*\\Documents\\PowerShell\\*.ps1",
"?:\\Windows\\System32\\WindowsPowerShell\\*.ps1",
"\\Device\\HarddiskVolume*\\Users\\*\\Documents\\WindowsPowerShell\\*.ps1",
"\\Device\\HarddiskVolume*\\Users\\*\\Documents\\PowerShell\\*.ps1",
"\\Device\\HarddiskVolume*\\Windows\\System32\\WindowsPowerShell\\*.ps1")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
file.name | wildcard |
| field:"file.name" kind:wildcard |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
Potential Common Log File System Vulnerability Exploitation
#Identifies unlevated attempt to create a BLF file using the Common Log File System (CLFS) API followed by any activity where the effective user.id is System. This may indicate a successful CLFS vulnerability exploitation for privilege escalation.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies unlevated attempt to create a BLF file using the Common Log File System (CLFS) API followed by any activity
where the effective user.id is System. This may indicate a successful CLFS vulnerability exploitation for privilege
escalation.
"""
id = "cac42a72-dc66-45a4-9809-109f5f33c16e"
license = "Elastic License v2"
name = "Potential Common Log File System Vulnerability Exploitation"
os_list = ["windows"]
reference = ["https://securelist.com/windows-clfs-exploits-ransomware/111560/"]
version = "1.0.2"
query = '''
sequence by process.entity_id with maxspan=2m
[file where event.action != "deletion" and not user.id : "S-1-5-18" and user.id != null and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*clfsw32.dll!CreateLogFile*", "*clfsw32.dll!AddLogContainerSet*"))]
[any where event.category : ("file", "registry", "api") and user.id : "S-1-5-18"]
'''
min_endpoint_version = "8.7.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 = "T1068"
name = "Exploitation for Privilege Escalation"
reference = "https://attack.mitre.org/techniques/T1068/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "8.7.0"
Stages and Predicates
Ordered sequence: each step below must occur in order within 2m, correlated by process.entity_id.
Stage 1: file
[file where event.action != "deletion" and not user.id : "S-1-5-18" and user.id != null and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: ("*clfsw32.dll!CreateLogFile*", "*clfsw32.dll!AddLogContainerSet*"))]
Stage 2: any
[any where event.category : ("file", "registry", "api") and user.id : "S-1-5-18"]
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | ne |
| field:"EventType" kind:ne value:"deletion" |
event.category | wildcard |
| field:"event.category" kind:wildcard |
user.id | is_not_null | field:"user.id" kind:is_not_null | |
user.id | wildcard |
| field:"user.id" kind:wildcard value:"S-1-5-18" |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
Privilege Escalation via EXTENDED STARTUPINFO
#Identifies the creation of an elevated process running as SYSTEM and with a spoofed parent process. Adversaries use this technique to escalate privileges and bypass access controls.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies the creation of an elevated process running as SYSTEM and with a spoofed parent process. Adversaries use this
technique to escalate privileges and bypass access controls.
"""
id = "2afd9e7f-99e0-4a4d-a6e3-9e9db730f63b"
license = "Elastic License v2"
name = "Privilege Escalation via EXTENDED STARTUPINFO"
os_list = ["windows"]
reference = [
"https://gist.github.com/xpn/a057a26ec81e736518ee50848b9c2cd6",
"https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1134.002/T1134.002.md",
"https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute",
"https://www.elastic.co/security-labs/elastic-security-labs-steps-through-the-r77-rootkit",
]
version = "1.0.44"
query = '''
process where event.action == "start" and
/* process creation via seclogon */
process.parent.Ext.real.pid > 0 and process.parent.executable != null and
/* PrivEsc to SYSTEM */
user.id == "S-1-5-18" and
/* Common FPs - evasion via hollowing is possible, should be covered by code injection */
not process.executable : ("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\WerFaultSecure.exe",
"?:\\Windows\\SysWOW64\\WerFaultSecure.exe",
"\\\\?\\Volume{*}\\Windows\\Sys*\\WerFault.exe",
"?:\\Windows\\System32\\Wermgr.exe",
"?:\\Windows\\SysWOW64\\Wermgr.exe",
"?:\\Windows\\SoftwareDistribution\\Download\\Install\\securityhealthsetup.exe",
"?:\\Program Files\\*.exe",
"?:\\Program Files (x86)\\*.exe",
"?:\\Windows\\System32\\osk.exe",
"?:\\Windows\\System32\\Narrator.exe",
"?:\\Windows\\System32\\MpSigStub.exe",
"\\Device\\HarddiskVolume?\\Windows\\SysWOW64\\*.exe",
"\\Device\\HarddiskVolume?\\Windows\\System32\\*.exe") and
not process.parent.executable : ("?:\\Windows\\System32\\AtBroker.exe", "?:\\Windows\\System32\\Utilman.exe") and
not (process.pe.original_file_name == "SecurityHealthSetup.exe" and process.code_signature.trusted == true and
process.code_signature.subject_name == "Microsoft Windows" and process.Ext.effective_parent.executable : "C:\\Windows\\servicing\\TrustedInstaller.exe") and
not (process.code_signature.subject_name in
("philandro Software GmbH", "Freedom Scientific Inc.", "TeamViewer Germany GmbH", "Projector.is, Inc.",
"TeamViewer GmbH", "Cisco WebEx LLC", "Dell Inc", "Netwrix Corporation",
"Samsung Electronics CO., LTD.", "TeamViewer", "POINT B LTD", "IMPERO SOLUTIONS LIMITED",
"AnyDesk Software GmbH", "Shanghai Best Oray Information S&T Co. Ltd.", "Zhou Huabing",
"PURSLANE", "Remote Utilities LLC", "ZOHO Corporation Private Limited", "PTC Inc.", "ITE Tech. Inc.",
"vast limits GmbH", "RG Systèmes SAS", "Bayside Computer Systems Inc") and
process.code_signature.trusted == true) and
not (process.name : "powershell.exe" and process.parent.name : "powershell.exe" and
process.args : "CgAgACAAIAAg*" and process.parent.args : "JgBjAGgAYwBwAC4AYwBvAG0AIAA2ADUAMAAwADEAIAA+ACAA*") and
not process.hash.sha256 :
("3e541100c869dba06ee62252a9661e5a06c2e685a7ddd5288ea1358703412385",
"29c977845e4822efe15cc0e44ede3a03e30030d108d2ae9932e34a1c3840283a",
"1e07a7a91451303d5cdac0a1673d581f5f7198fcc08fc79e4332aba6400f55a8",
"f3607f433952cb23d9eb0fc5e31fd0c4079cad3133dc79d149022900d208876c",
"79e1e068196a7447eb7ec8b4fc2d8ba4e818ad4d94829c0151170e639f480b9e") and
not (process.name : "rundll32.exe" and process.command_line : "*winethc*ForceProxyDetectionOnNextRun*" and
process.parent.args : "WdiServiceHost" and process.parent.executable : "?:\\Windows\\System32\\svchost.exe") and
not (process.executable : "?:\\Windows\\System32\\browser_broker.exe" and
process.parent.executable : "?:\\Windows\\System32\\svchost.exe" and process.parent.args : "PlugPlay") and
not (process.name : "cmd.exe" and
process.parent.executable : "?:\\Windows\\System32\\svchost.exe" and process.parent.args : "DcomLaunch" and
process.args : "?:\\Windows\\System32\\wscript.exe ?:\\windows\\system32\\gathernetworkinfo.vbs") and
not (process.parent.executable : "?:\\Program Files (x86)\\SubPrint\\subprint_temp\\nircmdc.exe" and
process.name : "cmd.exe" and process.args : "?:\\Program Files (x86)\\SubPrint/subprint_temp/configure.bat") and
not process.parent.executable : "?:\\Program Files (x86)\\VisualCron\\VisualCronService.exe" and
not (process.name : "powershell.exe" and process.parent.executable : "C:\\Windows\\System32\\wsmprovhost.exe" and
process.command_line : "powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand CgA*") and
not (process.parent.name : "cmd.exe" and process.name : "powershell.exe" and process.args : "$execWrapper.Split(@(\"`0`0`0`0\"),") and
not (process.executable : "?:\\WINDOWS\\SysWOW64\\svchost.exe" and process.parent.executable : "?:\\Windows\\System32\\svchost.exe" and
process.parent.command_line : "?:\\WINDOWS\\system32\\svchost.exe -k DcomLaunch -p -s PlugPlay") and
not (process.executable : "?:\\$WINDOWS.~BT\\NewOS\\Windows\\System32\\ie4ushowIE.exe" and
process.parent.executable : "?:\\$WINDOWS.~BT\\Sources\\mighost.exe") and
not process.parent.executable :
("C:\\Program Files\\Veeam\\Backup and Replication\\Backup\\Veeam.Backup.Manager.exe",
"\\Device\\HarddiskVolume?\\Windows\\SoftwareDistribution\\Download\\Install\\SecurityHealthSetup.exe") and
/* AM_Delta_Patch Windows Update */
not (process.executable :
("?:\\Windows\\System32\\MpSigStub.exe",
"?:\\Windows\\SysWOW64\\MpSigStub.exe",
"\\Device\\HarddiskVolume*\\Windows\\System32\\MpSigStub.exe",
"\\Device\\HarddiskVolume*\\Windows\\SysWOW64\\MpSigStub.exe") and
process.parent.name : ("wuauclt.exe", "wuaucltcore.exe")) and
not (process.executable : "C:\\ProgramData\\Microsoft\\Windows Defender\\Scans\\MpPayloadData\\mpengine.exe" and
process.parent.executable : "C:\\ProgramData\\Microsoft\\Windows Defender\\Scans\\MpPayloadData\\mpengine.exe" and user.id == "S-1-5-18")
'''
min_endpoint_version = "8.4.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.002"
name = "Create Process with Token"
reference = "https://attack.mitre.org/techniques/T1134/002/"
[[threat.technique.subtechnique]]
id = "T1134.004"
name = "Parent PID Spoofing"
reference = "https://attack.mitre.org/techniques/T1134/004/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "8.4.0"
Stages and Predicates
Stage 1: process
process where event.action == "start" and
process.parent.Ext.real.pid > 0 and process.parent.executable != null and
user.id == "S-1-5-18" and
not process.executable : ("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe",
"?:\\Windows\\System32\\WerFaultSecure.exe",
"?:\\Windows\\SysWOW64\\WerFaultSecure.exe",
"\\\\?\\Volume{*}\\Windows\\Sys*\\WerFault.exe",
"?:\\Windows\\System32\\Wermgr.exe",
"?:\\Windows\\SysWOW64\\Wermgr.exe",
"?:\\Windows\\SoftwareDistribution\\Download\\Install\\securityhealthsetup.exe",
"?:\\Program Files\\*.exe",
"?:\\Program Files (x86)\\*.exe",
"?:\\Windows\\System32\\osk.exe",
"?:\\Windows\\System32\\Narrator.exe",
"?:\\Windows\\System32\\MpSigStub.exe",
"\\Device\\HarddiskVolume?\\Windows\\SysWOW64\\*.exe",
"\\Device\\HarddiskVolume?\\Windows\\System32\\*.exe") and
not process.parent.executable : ("?:\\Windows\\System32\\AtBroker.exe", "?:\\Windows\\System32\\Utilman.exe") and
not (process.pe.original_file_name == "SecurityHealthSetup.exe" and process.code_signature.trusted == true and
process.code_signature.subject_name == "Microsoft Windows" and process.Ext.effective_parent.executable : "C:\\Windows\\servicing\\TrustedInstaller.exe") and
not (process.code_signature.subject_name in
("philandro Software GmbH", "Freedom Scientific Inc.", "TeamViewer Germany GmbH", "Projector.is, Inc.",
"TeamViewer GmbH", "Cisco WebEx LLC", "Dell Inc", "Netwrix Corporation",
"Samsung Electronics CO., LTD.", "TeamViewer", "POINT B LTD", "IMPERO SOLUTIONS LIMITED",
"AnyDesk Software GmbH", "Shanghai Best Oray Information S&T Co. Ltd.", "Zhou Huabing",
"PURSLANE", "Remote Utilities LLC", "ZOHO Corporation Private Limited", "PTC Inc.", "ITE Tech. Inc.",
"vast limits GmbH", "RG Systèmes SAS", "Bayside Computer Systems Inc") and
process.code_signature.trusted == true) and
not (process.name : "powershell.exe" and process.parent.name : "powershell.exe" and
process.args : "CgAgACAAIAAg*" and process.parent.args : "JgBjAGgAYwBwAC4AYwBvAG0AIAA2ADUAMAAwADEAIAA+ACAA*") and
not process.hash.sha256 :
("3e541100c869dba06ee62252a9661e5a06c2e685a7ddd5288ea1358703412385",
"29c977845e4822efe15cc0e44ede3a03e30030d108d2ae9932e34a1c3840283a",
"1e07a7a91451303d5cdac0a1673d581f5f7198fcc08fc79e4332aba6400f55a8",
"f3607f433952cb23d9eb0fc5e31fd0c4079cad3133dc79d149022900d208876c",
"79e1e068196a7447eb7ec8b4fc2d8ba4e818ad4d94829c0151170e639f480b9e") and
not (process.name : "rundll32.exe" and process.command_line : "*winethc*ForceProxyDetectionOnNextRun*" and
process.parent.args : "WdiServiceHost" and process.parent.executable : "?:\\Windows\\System32\\svchost.exe") and
not (process.executable : "?:\\Windows\\System32\\browser_broker.exe" and
process.parent.executable : "?:\\Windows\\System32\\svchost.exe" and process.parent.args : "PlugPlay") and
not (process.name : "cmd.exe" and
process.parent.executable : "?:\\Windows\\System32\\svchost.exe" and process.parent.args : "DcomLaunch" and
process.args : "?:\\Windows\\System32\\wscript.exe ?:\\windows\\system32\\gathernetworkinfo.vbs") and
not (process.parent.executable : "?:\\Program Files (x86)\\SubPrint\\subprint_temp\\nircmdc.exe" and
process.name : "cmd.exe" and process.args : "?:\\Program Files (x86)\\SubPrint/subprint_temp/configure.bat") and
not process.parent.executable : "?:\\Program Files (x86)\\VisualCron\\VisualCronService.exe" and
not (process.name : "powershell.exe" and process.parent.executable : "C:\\Windows\\System32\\wsmprovhost.exe" and
process.command_line : "powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand CgA*") and
not (process.parent.name : "cmd.exe" and process.name : "powershell.exe" and process.args : "$execWrapper.Split(@(\"`0`0`0`0\"),") and
not (process.executable : "?:\\WINDOWS\\SysWOW64\\svchost.exe" and process.parent.executable : "?:\\Windows\\System32\\svchost.exe" and
process.parent.command_line : "?:\\WINDOWS\\system32\\svchost.exe -k DcomLaunch -p -s PlugPlay") and
not (process.executable : "?:\\$WINDOWS.~BT\\NewOS\\Windows\\System32\\ie4ushowIE.exe" and
process.parent.executable : "?:\\$WINDOWS.~BT\\Sources\\mighost.exe") and
not process.parent.executable :
("C:\\Program Files\\Veeam\\Backup and Replication\\Backup\\Veeam.Backup.Manager.exe",
"\\Device\\HarddiskVolume?\\Windows\\SoftwareDistribution\\Download\\Install\\SecurityHealthSetup.exe") and
not (process.executable :
("?:\\Windows\\System32\\MpSigStub.exe",
"?:\\Windows\\SysWOW64\\MpSigStub.exe",
"\\Device\\HarddiskVolume*\\Windows\\System32\\MpSigStub.exe",
"\\Device\\HarddiskVolume*\\Windows\\SysWOW64\\MpSigStub.exe") and
process.parent.name : ("wuauclt.exe", "wuaucltcore.exe")) and
not (process.executable : "C:\\ProgramData\\Microsoft\\Windows Defender\\Scans\\MpPayloadData\\mpengine.exe" and
process.parent.executable : "C:\\ProgramData\\Microsoft\\Windows Defender\\Scans\\MpPayloadData\\mpengine.exe" and user.id == "S-1-5-18")
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.Ext.effective_parent.executable | eq | C:\Windows\servicing\TrustedInstaller.exe | excludes:process.Ext.effective_parent.executable field:"process.Ext.effective_parent.executable" value:"C:\Windows\servicing\TrustedInstaller.exe" |
process.code_signature.subject_name | eq | Microsoft Windows | excludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"Microsoft Windows" |
process.code_signature.trusted | eq | true | excludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true" |
process.pe.original_file_name | eq | SecurityHealthSetup.exe | excludes:process.pe.original_file_name field:"process.pe.original_file_name" value:"SecurityHealthSetup.exe" |
process.args | eq | $execWrapper.Split(@("`0`0`0`0"), | excludes:process.args |
process.name | eq | powershell.exe | excludes:process.name field:"process.name" value:"powershell.exe" |
process.parent.name | eq | cmd.exe | excludes:process.parent.name field:"process.parent.name" value:"cmd.exe" |
process.args | eq | ?:\Program Files (x86)\SubPrint/subprint_temp/configure.bat | excludes:process.args field:"process.args" value:"?:\Program Files (x86)\SubPrint/subprint_temp/configure.bat" |
process.name | eq | cmd.exe | excludes:process.name field:"process.name" value:"cmd.exe" |
process.parent.executable | eq | ?:\Program Files (x86)\SubPrint\subprint_temp\nircmdc.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\SubPrint\subprint_temp\nircmdc.exe" |
process.args | eq | ?:\Windows\System32\wscript.exe ?:\windows\system32\gathernetworkinfo.vbs | excludes:process.args field:"process.args" value:"?:\Windows\System32\wscript.exe ?:\windows\system32\gathernetworkinfo.vbs" |
process.parent.args | eq | DcomLaunch | excludes:process.parent.args field:"process.parent.args" value:"DcomLaunch" |
process.parent.executable | eq | ?:\Windows\System32\svchost.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\svchost.exe" |
process.args | starts_with | CgAgACAAIAAg | excludes:process.args field:"process.args" value:"CgAgACAAIAAg" |
process.parent.args | starts_with | JgBjAGgAYwBwAC4AYwBvAG0AIAA2ADUAMAAwADEAIAA+ACAA | excludes:process.parent.args field:"process.parent.args" value:"JgBjAGgAYwBwAC4AYwBvAG0AIAA2ADUAMAAwADEAIAA+ACAA" |
process.parent.name | eq | powershell.exe | excludes:process.parent.name field:"process.parent.name" value:"powershell.exe" |
process.code_signature.subject_name | in | AnyDesk Software GmbH, Bayside Computer Systems Inc, Cisco WebEx LLC, Dell Inc, Freedom Scientific Inc., IMPERO SOLUTIONS LIMITED, ITE Tech. Inc., Netwrix Corporation, POINT B LTD, PTC Inc., PURSLANE, Projector.is, Inc., RG Systèmes SAS, Remote Utilities LLC, Samsung Electronics CO., LTD., Shanghai Best Oray Information S&T Co. Ltd., TeamViewer, TeamViewer Germany GmbH, TeamViewer GmbH, ZOHO Corporation Private Limited, Zhou Huabing, philandro Software GmbH, vast limits GmbH | excludes:process.code_signature.subject_name |
process.command_line | starts_with | powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand CgA | excludes:process.command_line field:"process.command_line" value:"powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -EncodedCommand CgA" |
process.parent.executable | eq | C:\Windows\System32\wsmprovhost.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Windows\System32\wsmprovhost.exe" |
process.command_line | wildcard | *winethc*ForceProxyDetectionOnNextRun* | excludes:process.command_line field:"process.command_line" value:"*winethc*ForceProxyDetectionOnNextRun*" |
process.name | eq | rundll32.exe | excludes:process.name field:"process.name" value:"rundll32.exe" |
process.parent.args | eq | WdiServiceHost | excludes:process.parent.args field:"process.parent.args" value:"WdiServiceHost" |
process.executable | eq | ?:\$WINDOWS.~BT\NewOS\Windows\System32\ie4ushowIE.exe | excludes:process.executable field:"process.executable" value:"?:\$WINDOWS.~BT\NewOS\Windows\System32\ie4ushowIE.exe" |
process.parent.executable | eq | ?:\$WINDOWS.~BT\Sources\mighost.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\$WINDOWS.~BT\Sources\mighost.exe" |
process.executable | eq | ?:\WINDOWS\SysWOW64\svchost.exe | excludes:process.executable field:"process.executable" value:"?:\WINDOWS\SysWOW64\svchost.exe" |
process.parent.command_line | eq | ?:\WINDOWS\system32\svchost.exe -k DcomLaunch -p -s PlugPlay | excludes:process.parent.command_line field:"process.parent.command_line" value:"?:\WINDOWS\system32\svchost.exe -k DcomLaunch -p -s PlugPlay" |
process.executable | eq | ?:\Windows\System32\browser_broker.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\browser_broker.exe" |
process.parent.args | eq | PlugPlay | excludes:process.parent.args field:"process.parent.args" value:"PlugPlay" |
process.executable | eq | C:\ProgramData\Microsoft\Windows Defender\Scans\MpPayloadData\mpengine.exe | excludes:process.executable field:"process.executable" value:"C:\ProgramData\Microsoft\Windows Defender\Scans\MpPayloadData\mpengine.exe" |
process.parent.executable | eq | C:\ProgramData\Microsoft\Windows Defender\Scans\MpPayloadData\mpengine.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\ProgramData\Microsoft\Windows Defender\Scans\MpPayloadData\mpengine.exe" |
user.id | eq | S-1-5-18 | excludes:user.id field:"user.id" value:"S-1-5-18" |
process.executable | wildcard | ?:\Windows\System32\MpSigStub.exe, ?:\Windows\SysWOW64\MpSigStub.exe, \Device\HarddiskVolume*\Windows\System32\MpSigStub.exe, \Device\HarddiskVolume*\Windows\SysWOW64\MpSigStub.exe | excludes:process.executable |
process.parent.name | eq | wuauclt.exe, wuaucltcore.exe | excludes:process.parent.name field:"process.parent.name" value:"wuauclt.exe" field:"process.parent.name" value:"wuaucltcore.exe" |
process.executable | wildcard | ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe, ?:\Windows\System32\WerFaultSecure.exe, ?:\Windows\SysWOW64\WerFaultSecure.exe, \\?\Volume{*}\Windows\Sys*\WerFault.exe, ?:\Windows\System32\Wermgr.exe, ?:\Windows\SysWOW64\Wermgr.exe, ?:\Windows\SoftwareDistribution\Download\Install\securityhealthsetup.exe, ?:\Program Files\*.exe, ?:\Program Files (x86)\*.exe, ?:\Windows\System32\osk.exe, ?:\Windows\System32\Narrator.exe, ?:\Windows\System32\MpSigStub.exe, \Device\HarddiskVolume?\Windows\SysWOW64\*.exe, \Device\HarddiskVolume?\Windows\System32\*.exe | excludes:process.executable |
process.hash.sha256 | eq | 3e541100c869dba06ee62252a9661e5a06c2e685a7ddd5288ea1358703412385, 29c977845e4822efe15cc0e44ede3a03e30030d108d2ae9932e34a1c3840283a, 1e07a7a91451303d5cdac0a1673d581f5f7198fcc08fc79e4332aba6400f55a8, f3607f433952cb23d9eb0fc5e31fd0c4079cad3133dc79d149022900d208876c, 79e1e068196a7447eb7ec8b4fc2d8ba4e818ad4d94829c0151170e639f480b9e | excludes:process.hash.sha256 |
process.parent.executable | eq | ?:\Program Files (x86)\VisualCron\VisualCronService.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\VisualCron\VisualCronService.exe" |
process.parent.executable | eq | ?:\Windows\System32\AtBroker.exe, ?:\Windows\System32\Utilman.exe | excludes:process.parent.executable field:"process.parent.executable" value:"?:\Windows\System32\AtBroker.exe" field:"process.parent.executable" value:"?:\Windows\System32\Utilman.exe" |
process.parent.executable | eq | C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Manager.exe, \Device\HarddiskVolume?\Windows\SoftwareDistribution\Download\Install\SecurityHealthSetup.exe | excludes:process.parent.executable field:"process.parent.executable" value:"C:\Program Files\Veeam\Backup and Replication\Backup\Veeam.Backup.Manager.exe" field:"process.parent.executable" value:"\Device\HarddiskVolume?\Windows\SoftwareDistribution\Download\Install\SecurityHealthSetup.exe" |
Service Account Token or Certificate Read Detected via Defend for Containers
#This rule detects the reading of the service account token or certificate inside a container. The service account token or certificate is used to authenticate the container to the Kubernetes API server, and may be used by an adversary to gain access to the Kubernetes API server or other resources within the cluster. These files are a common target for adversaries to gain access to the cluster.
Known False Positives
- There is a potential for false positives if the service account token or certificate is used for legitimate purposes, such as debugging or troubleshooting. It is important to investigate any alerts generated by this rule to determine if they are indicative of malicious activity or part of legitimate container activity.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access | |
| Collection |
Rule Body
[metadata]
creation_date = "2026/01/21"
integration = ["cloud_defend"]
maturity = "production"
min_stack_comments = "Defend for Containers integration was re-introduced in 9.3.0"
min_stack_version = "9.3.0"
updated_date = "2026/07/29"
[rule]
author = ["Elastic"]
description = """
This rule detects the reading of the service account token or certificate inside a container. The service account
token or certificate is used to authenticate the container to the Kubernetes API server, and may be used by an
adversary to gain access to the Kubernetes API server or other resources within the cluster. These files are a
common target for adversaries to gain access to the cluster.
"""
false_positives = [
"""
There is a potential for false positives if the service account token or certificate is used for legitimate purposes,
such as debugging or troubleshooting. It is important to investigate any alerts generated by this rule to determine
if they are indicative of malicious activity or part of legitimate container activity.
""",
]
from = "now-6m"
index = ["logs-cloud_defend.file*", "logs-cloud_defend.process*"]
interval = "5m"
language = "eql"
license = "Elastic License v2"
name = "Service Account Token or Certificate Read Detected via Defend for Containers"
note = """ ## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Service Account Token or Certificate Read Detected via Defend for Containers
This rule flags when a container’s service account token or CA certificate is opened, signaling direct access to credentials that grant API permissions within the cluster. Attackers often exec into a running pod, read /var/run/secrets/kubernetes.io/serviceaccount/token and ca.crt, then use the token with kubectl or curl to enumerate namespaces, list secrets, or spawn privileged workloads via the Kubernetes API.
### Possible investigation steps
- Map the container to its pod, namespace, node, image, and service account, and use Kubernetes audit and runtime logs to identify any recent exec/attach/tty into the pod and the originating user and source IP.
- Examine process ancestry and command activity around the event to detect shells, kubectl/curl/wget usage, token exfiltration patterns (for example, piping the token to a network client), or the token being copied elsewhere.
- Correlate with network telemetry to see if the container initiated connections to the API server or external endpoints immediately after the read, including unusual DNS lookups or spikes in egress.
- Search Kubernetes audit logs for requests authenticated as the implicated service account after the event, prioritizing secrets access, pod exec/attach, workload create/update, and role or clusterrole binding changes, and verify the source IP matches the pod.
- Run a SubjectAccessReview or review RBAC bindings for the service account to quickly determine effective permissions and the potential blast radius if the token was abused.
### False positive analysis
- During legitimate troubleshooting, an engineer attaches an interactive shell to the container and opens /var/run/secrets/kubernetes.io/serviceaccount/token or /var/run/secrets/kubernetes.io/serviceaccount/ca.crt to verify the service account mount and certificate trust.
- An interactive in-container diagnostic or training session reads the token or CA certificate to confirm connectivity or inspect claims, with no subsequent API calls or credential exfiltration, resulting in a benign open event.
### Response and remediation
- Immediately delete the affected pod (namespace/pod-name) to invalidate /var/run/secrets/kubernetes.io/serviceaccount/token, scale the owning Deployment/StatefulSet to zero to stop respawns, and apply a temporary deny-all egress NetworkPolicy to the namespace to contain any misuse.
- On the node hosting the pod, kill any interactive shells (e.g., bash or sh) attached to the container and remove any copied credential artifacts such as /tmp/token or files containing contents of /var/run/secrets/kubernetes.io/serviceaccount/token or ca.crt.
- Rotate credentials and access by recreating the service account and its tokens, purge unauthorized RoleBinding/ClusterRoleBinding entries granting high privileges to that identity, and redeploy the workload from a trusted image with a clean start.
- Escalate to incident response if audit logs show the token being used to read Secrets, create or modify Pods/Jobs/Deployments, or alter RoleBinding/ClusterRoleBinding, or if API requests originate from an IP not matching the affected pod’s node.
- Harden by setting automountServiceAccountToken: false for pods that do not need API access, using projected service account tokens with short TTL and audience binding, denying kubectl exec/attach in production via RBAC/admission, and trimming the service account’s RBAC to least privilege.
"""
risk_score = 47
rule_id = "66229f32-c460-410d-bc37-4b32322cd4bb"
severity = "medium"
tags = [
"Data Source: Elastic Defend for Containers",
"Domain: Container",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
any where host.os.type == "linux" and container.id like "*" and (
(event.category == "file" and event.type == "change" and event.action == "open" and
file.path in (
"/var/run/secrets/kubernetes.io/serviceaccount/token",
"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt",
"/run/secrets/kubernetes.io/serviceaccount/token",
"/run/secrets/kubernetes.io/serviceaccount/ca.crt"
)) or
(event.category == "process" and event.type == "start" and event.action == "exec" and
(
process.name in ("cat", "head", "tail", "more", "less", "sed", "awk") or
process.args in (
"cat", "/bin/cat", "/usr/bin/cat", "/usr/local/bin/cat",
"head", "/bin/head", "/usr/bin/head", "/usr/local/bin/head",
"tail", "/bin/tail", "/usr/bin/tail", "/usr/local/bin/tail",
"more", "/bin/more", "/usr/bin/more", "/usr/local/bin/more",
"less", "/bin/less", "/usr/bin/less", "/usr/local/bin/less",
"sed", "/bin/sed", "/usr/bin/sed", "/usr/local/bin/sed",
"awk", "/bin/awk", "/usr/bin/awk", "/usr/local/bin/awk"
)
) and process.args like (
"*/run/secrets/kubernetes.io/serviceaccount/token*",
"*/run/secrets/kubernetes.io/serviceaccount/ca.crt*"
))
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[rule.threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1005"
name = "Data from Local System"
reference = "https://attack.mitre.org/techniques/T1005/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
Stages and Predicates
Stage 1: any
any where host.os.type == "linux" and container.id like "*" and (
(event.category == "file" and event.type == "change" and event.action == "open" and
file.path in (
"/var/run/secrets/kubernetes.io/serviceaccount/token",
"/var/run/secrets/kubernetes.io/serviceaccount/ca.crt",
"/run/secrets/kubernetes.io/serviceaccount/token",
"/run/secrets/kubernetes.io/serviceaccount/ca.crt"
)) or
(event.category == "process" and event.type == "start" and event.action == "exec" and
(
process.name in ("cat", "head", "tail", "more", "less", "sed", "awk") or
process.args in (
"cat", "/bin/cat", "/usr/bin/cat", "/usr/local/bin/cat",
"head", "/bin/head", "/usr/bin/head", "/usr/local/bin/head",
"tail", "/bin/tail", "/usr/bin/tail", "/usr/local/bin/tail",
"more", "/bin/more", "/usr/bin/more", "/usr/local/bin/more",
"less", "/bin/less", "/usr/bin/less", "/usr/local/bin/less",
"sed", "/bin/sed", "/usr/bin/sed", "/usr/local/bin/sed",
"awk", "/bin/awk", "/usr/bin/awk", "/usr/local/bin/awk"
)
) and process.args like (
"*/run/secrets/kubernetes.io/serviceaccount/token*",
"*/run/secrets/kubernetes.io/serviceaccount/ca.crt*"
))
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
container.id | wildcard |
| field:"container.id" kind:wildcard value:"*" |
event.action | eq |
| field:"EventType" kind:eq |
event.category | eq |
| field:"event.category" kind:eq |
event.type | eq |
| field:"event.type" kind:eq |
file.path | in |
| field:"TargetFilename" kind:in |
process.args | in |
| field:"process.args" kind:in |
process.args | wildcard |
| field:"process.args" kind:wildcard |
process.name | in |
| field:"process_basename" kind:in |
Suspicious Apple Mail Rule Plist Modification
#Detects suspicious creation or modification of the Apple Mail SyncedRules plist file by a non-Mail application. An adversary could establish persistence by creating or modifying an Apple Mail rule to point to a script file on disk, which will execute when an email matching the trigger is received.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Execution | |
| Persistence | |
| Defense Impairment |
Rule Body
[metadata]
creation_date = "2026/01/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/03/24"
[rule]
author = ["Elastic"]
description = """
Detects suspicious creation or modification of the Apple Mail SyncedRules plist file by a non-Mail application.
An adversary could establish persistence by creating or modifying an Apple Mail rule to point to a script file
on disk, which will execute when an email matching the trigger is received.
"""
from = "now-9m"
index = ["logs-endpoint.events.file-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious Apple Mail Rule Plist Modification"
note = """ ## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Suspicious Apple Mail Rule Plist Modification
This detects non-Apple Mail processes creating or modifying the SyncedRules.plist that stores Apple Mail rules, a persistence path because rules can trigger actions on incoming mail. Attackers commonly drop a script to disk, then edit the rules file so a crafted email (often from an attacker-controlled sender or with a specific subject) launches that script when it arrives.
### Possible investigation steps
- Identify the application that modified the plist and validate its legitimacy by checking code signature, bundle path, quarantine/download origin, and recent installation history.
- Diff the current SyncedRules.plist against a known-good or previous version (including backups/snapshots) to pinpoint what rule entries changed and when.
- Decode and review the plist contents to find any rule actions that execute scripts/binaries or reference external paths, then record the exact target command/path.
- Locate and inspect any referenced script or executable (hash, signature, contents, timestamps, and network indicators) and determine whether it is newly created or staged nearby.
- Correlate the modification time with surrounding system activity (process tree, file writes in user Library paths, network connections, and recent email-related events) to determine whether this is persistence setup versus benign automation.
### False positive analysis
- After a macOS reinstall, user migration, or restore from backup, SyncedRules.plist may be recreated or overwritten by a non-Mail restore/migration process when Mail data is copied back into the user’s MailData directory.
- User-initiated or administrative automation that standardizes, repairs, or deploys Mail rules can modify SyncedRules.plist via command-line file operations or plist editing outside of Mail.app, especially during initial user provisioning or troubleshooting.
### Response and remediation
- Isolate the affected Mac from the network and temporarily disable Apple Mail rule processing by moving `SyncedRules.plist` out of the MailData directory to prevent any rule-triggered script execution while preserving evidence.
- Collect and preserve the modified `SyncedRules.plist`, its extended attributes/quarantine flags, and the modifying process binary/app bundle, then decode the plist to identify any rule actions that reference on-disk scripts or executables.
- Remove malicious persistence by deleting the offending rule entries (or restoring `SyncedRules.plist` from a known-good backup) and deleting/quarantining any referenced scripts/binaries and their launch points if they were dropped on disk.
- Hunt for and eradicate the originator by reviewing recently installed or unsigned apps and user-level agents/daemons that wrote into `~/Library/Mail/**/MailData/`, and reimage the endpoint if additional persistence or tampering is found.
- Recover by re-enabling Mail with a clean ruleset, forcing credential/session resets for affected mail accounts, and monitoring for recurrence of `SyncedRules.plist` changes or rule-triggered execution when new mail arrives.
- Escalate to incident response immediately if the plist contains rules invoking `sh`, `osascript`, `python`, or a non-Apple executable path, if the modifying process is unsigned/untrusted, or if the referenced script shows network beacons or data access behavior.
"""
references = [
"https://www.n00py.io/2016/10/using-email-for-persistence-on-os-x/"
]
risk_score = 47
rule_id = "d7b57cbd-de03-4c3b-8278-daa1ee4a6772"
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
file where host.os.type == "macos" and event.type != "deletion" and
file.name == "SyncedRules.plist" and
file.path like ("/Users/*/Library/Mail/*/MailData/SyncedRules.plist",
"/Users/*/Library/Mobile Documents/com.apple.mail/Data/*/MailData/SyncedRules.plist") and
not process.executable like ("/System/Applications/Mail.app/Contents/MacOS/Mail",
"/Applications/Mail.app/Contents/MacOS/Mail",
"/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd",
"/usr/libexec/xpcproxy",
"/System/Library/Frameworks/FileProvider.framework/Support/fileproviderd",
"/System/Library/PrivateFrameworks/CloudDocsDaemon.framework/Versions/A/Support/bird",
"/sbin/launchd",
"/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder")
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1546"
name = "Event Triggered Execution"
reference = "https://attack.mitre.org/techniques/T1546/"
[rule.threat.tactic]
id = "TA0003"
name = "Persistence"
reference = "https://attack.mitre.org/tactics/TA0003/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1204"
name = "User Execution"
reference = "https://attack.mitre.org/techniques/T1204/"
[rule.threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1647"
name = "Plist File Modification"
reference = "https://attack.mitre.org/techniques/T1647/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: file
file where host.os.type == "macos" and event.type != "deletion" and
file.name == "SyncedRules.plist" and
file.path like ("/Users/*/Library/Mail/*/MailData/SyncedRules.plist",
"/Users/*/Library/Mobile Documents/com.apple.mail/Data/*/MailData/SyncedRules.plist") and
not process.executable like ("/System/Applications/Mail.app/Contents/MacOS/Mail",
"/Applications/Mail.app/Contents/MacOS/Mail",
"/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd",
"/usr/libexec/xpcproxy",
"/System/Library/Frameworks/FileProvider.framework/Support/fileproviderd",
"/System/Library/PrivateFrameworks/CloudDocsDaemon.framework/Versions/A/Support/bird",
"/sbin/launchd",
"/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | ne |
| field:"event.type" kind:ne value:"deletion" |
file.name | eq |
| field:"file.name" kind:eq value:"SyncedRules.plist" |
file.path | wildcard |
| field:"TargetFilename" kind:wildcard |
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.executable | eq | /System/Applications/Mail.app/Contents/MacOS/Mail, /Applications/Mail.app/Contents/MacOS/Mail, /System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd, /usr/libexec/xpcproxy, /System/Library/Frameworks/FileProvider.framework/Support/fileproviderd, /System/Library/PrivateFrameworks/CloudDocsDaemon.framework/Versions/A/Support/bird, /sbin/launchd, /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder | excludes:process.executable |
Suspicious Network Library Load
#Detects attempts to load a networking library from a potentially altered call stack in order to conceal the true source of the call.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Rule Body
[rule]
description = """
Detects attempts to load a networking library from a potentially altered call stack in order to conceal the true source
of the call.
"""
id = "9b87e433-5f77-40cc-9b91-25c9c2020515"
license = "Elastic License v2"
name = "Suspicious Network Library Load"
os_list = ["windows"]
reference = ["https://www.elastic.co/security-labs/doubling-down-etw-callstacks"]
version = "1.0.2"
query = '''
library where
dll.name : ("winhttp.dll", "ws2_32.dll") and
/* ROP gadget in early loaded modules kernel32 or kernelbase.dll */
process.thread.Ext.call_stack_summary like ("*|wininet.dll|kernelbase.dll*", "*|wininet.dll|kernel32.dll*") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "C:\\Windows\\System32\\wininet.dll!InternetOpen*")
'''
min_endpoint_version = "8.10.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
tree = true
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0
[[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
dll.name : ("winhttp.dll", "ws2_32.dll") and
process.thread.Ext.call_stack_summary like ("*|wininet.dll|kernelbase.dll*", "*|wininet.dll|kernel32.dll*") and
_arraysearch(process.thread.Ext.call_stack, $entry, $entry.symbol_info: "C:\\Windows\\System32\\wininet.dll!InternetOpen*")
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
dll.name | wildcard |
| field:"dll.name" kind:wildcard |
process.thread.Ext.call_stack_summary | wildcard |
| field:"process.thread.Ext.call_stack_summary" kind:wildcard |
Suspicious pbpaste High Volume Activity
#Identifies a high volume of pbpaste executions, which may indicate a bash loop continuously collecting clipboard contents, potentially allowing an attacker to harvest user credentials or other sensitive information.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Credential Access | |
| Collection |
Telemetry Coverage
Rule Body
[metadata]
creation_date = "2024/09/12"
integration = ["endpoint", "jamf_protect"]
maturity = "production"
updated_date = "2026/03/24"
[transform]
[[transform.investigate]]
label = "Show events having the same responsible process"
providers = [
[
{ excluded = false, field = "host.hostname", queryType = "phrase", value = "{{host.hostname}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.group_leader.entity_id}}", valueType = "string" }
]
]
[[transform.investigate]]
label = "Show events having the same parent process"
providers = [
[
{ excluded = false, field = "host.hostname", queryType = "phrase", value = "{{host.hostname}}", valueType = "string" },
{ excluded = false, field = "process.entity_id", queryType = "phrase", value = "{{process.parent.entity_id}}", valueType = "string" }
]
]
[rule]
author = ["Thijs Xhaflaire"]
description = """
Identifies a high volume of `pbpaste` executions, which may indicate a bash loop continuously collecting clipboard
contents, potentially allowing an attacker to harvest user credentials or other sensitive information.
"""
from = "now-9m"
index = ["logs-jamf_protect*", "logs-endpoint.events.process-*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious pbpaste High Volume Activity"
note = """## Triage and analysis
To investigate `pbpaste` activity, focus on determining whether the binary is being used maliciously to collect clipboard data. Follow these steps:
> **Note**:
> This investigation guide uses the [Investigate Markdown Plugin](https://www.elastic.co/guide/en/security/current/interactive-investigation-guides.html) introduced in Elastic Stack version 8.8.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
1. **Identify Frequency and Pattern of Execution:**
- **What to check:** Analyze the frequency and timing of `pbpaste` executions. Look for consistent intervals that might indicate a script or loop is running.
- **Why:** A high volume of regular `pbpaste` executions could suggest a bash loop designed to continuously capture clipboard data.
2. **Examine Associated Scripts or Processes:**
- **What to check:** Investigate the parent processes or scripts invoking `pbpaste`. Look for any cron jobs, bash scripts, or automated tasks linked to these executions.
- **Why:** Understanding what is triggering `pbpaste` can help determine if this activity is legitimate or part of a malicious attempt to gather sensitive information.
- $investigate_1
- $investigate_2
3. **Review Clipboard Contents:**
- **What to check:** If possible, capture and review the clipboard contents during `pbpaste` executions to identify if sensitive data, such as user credentials, is being targeted.
- **Why:** Attackers may use `pbpaste` to harvest valuable information from the clipboard. Identifying the type of data being collected can indicate the severity of the threat.
4. **Check for Data Exfiltration:**
- **What to check:** Investigate any output files or network activity associated with `pbpaste` usage. Look for signs that the collected data is being saved to a file, transmitted over the network, or sent to an external location.
- **Why:** If data is being stored or transmitted, it may be part of an exfiltration attempt. Identifying this can help prevent sensitive information from being leaked.
5. **Correlate with User Activity:**
- **What to check:** Compare the `pbpaste` activity with the user’s normal behavior and system usage patterns.
- **Why:** If the `pbpaste` activity occurs during times when the user is not active, or if the user denies initiating such tasks, it could indicate unauthorized access or a compromised account.
By thoroughly investigating these aspects of `pbpaste` activity, you can determine whether this is part of a legitimate process or a potential security threat that needs to be addressed.
"""
references = ["https://www.loobins.io/binaries/pbpaste/"]
risk_score = 47
rule_id = "e29599ee-d6ad-46a9-9c6a-dc39f361890d"
setup = """## Setup
This rule requires data coming in from Jamf Protect.
### Jamf Protect Integration Setup
Jamf Protect is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events incoming events and send data to the Elastic.
#### Prerequisite Requirements:
- Fleet is required for Jamf Protect.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
#### The following steps should be executed in order to add the Jamf Protect integration:
- Go to the Kibana home page and click "Add integrations".
- In the query bar, search for "Jamf Protect" and select the integration to see more details about it.
- Click "Add Jamf Protect".
- Configure the integration name.
- Click "Save and Continue".
"""
severity = "medium"
tags = [
"Domain: Endpoint",
"OS: macOS",
"Use Case: Threat Detection",
"Tactic: Credential Access",
"Data Source: Jamf Protect",
"Data Source: Elastic Defend",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
sequence by host.hostname, host.id with maxspan=1m
[process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.name: "pbpaste"] with runs = 5
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1056"
name = "Input Capture"
reference = "https://attack.mitre.org/techniques/T1056/"
[rule.threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1115"
name = "Clipboard Data"
reference = "https://attack.mitre.org/techniques/T1115/"
[rule.threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"
Stages and Predicates
Stage 1: process ×5
[process where host.os.type == "macos" and event.type == "start" and event.action == "exec" and process.name: "pbpaste"] with runs = 5
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.action | eq |
| field:"EventType" kind:eq value:"exec" |
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.name | wildcard |
| field:"process_basename" kind:wildcard value:"pbpaste" |
Suspicious SUID Binary Execution
#Detects execution of SUID binaries that may be used for privilege escalation under the root effective user when the real user and parent user are not root, combined with minimal argument counts and suspicious parent context (interpreters, short shell -c invocations, or parents running from user-writable paths) to indicate potential misuse of SUID binaries for privilege escalation.
Known False Positives
- Some automation or break-glass tooling may invoke SUID binaries from scripts under /home; validate parent identity and change tickets before escalating.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2026/04/30"
integration = ["endpoint"]
maturity = "production"
updated_date = "2026/07/17"
[rule]
author = ["Elastic"]
description = """
Detects execution of SUID binaries that may be used for privilege escalation under the root effective user
when the real user and parent user are not root, combined with minimal argument counts and suspicious parent
context (interpreters, short shell -c invocations, or parents running from user-writable paths) to indicate
potential misuse of SUID binaries for privilege escalation.
"""
false_positives = [
"""
Some automation or break-glass tooling may invoke SUID binaries from scripts under /home; validate parent identity and
change tickets before escalating.
""",
]
from = "now-6m"
index = ["logs-endpoint.events.process*"]
language = "eql"
license = "Elastic License v2"
name = "Suspicious SUID Binary Execution"
note = """## Triage and analysis
### Investigating Suspicious SUID Binary Execution
Confirm whether the non-root real user should be invoking SUID binaries as root. Review the parent process tree, script path, and any preceding download or decode activity.
### Possible investigation steps
- Inspect `process.parent.command_line` and working directory for obfuscation or one-liners.
- Check authentication and sudoers policy for the user.
- Pivot on the host for additional privilege escalation or persistence in the same session.
### Response and remediation
- If unauthorized, contain the session, revoke elevated access, and review sudoers and polkit policy for tampering.
"""
references = [
"https://attack.mitre.org/techniques/T1548/",
]
risk_score = 73
rule_id = "e7856173-6489-449f-80ec-c1f5fcd7b87c"
severity = "high"
tags = [
"Data Source: Elastic Defend",
"Domain: Endpoint",
"OS: Linux",
"Use Case: Threat Detection",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
(process.user.id == "0" and process.real_user.id != "0" and process.parent.user.id != "0") or
(process.group.id == "0" and process.real_group.id != "0" and process.parent.group.id != "0")
) and
(
(process.name in ("su", "passwd", "unix_chkpwd") and process.args_count <= 2) or
(
process.name in ("pkexec", "fusermount", "fusermount3", "mount", "umount", "newgrp", "chsh") and
process.args_count == 1
) or
process.name in (
"sudoedit", "gpasswd", "chfn", "polkit-agent-helper-1", "dbus-daemon-launch-helper", "ssh-keysign",
"pam_extrausers_chkpwd", "expiry", "chage", "crontab", "wall", "bsd-write", "ssh-agent",
"ping6", "traceroute", "mtr", "ntfs-3g", "Xorg.wrap", "chrome-sandbox", "bwrap"
)
) and
(
process.parent.name like (".*", "python*", "perl*", "ruby*", "lua*", "php*", "node", "deno", "bun", "java") or
process.parent.executable like ("./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*", "/home/*/*") or
(
process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh") and
process.parent.args in ("-c", "-cl", "-lc", "--command", "-ic", "-ci", "-bash", "-sh", "-zsh", "-dash", "-fish", "-ksh", "-mksh") and
process.parent.args_count <= 4
)
) and
not (
(process.name == "crontab" and process.args in ("-l", "-e")) or
(process.name in ("passwd", "chsh") and process.args == "--version")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[rule.threat.technique.subtechnique]]
id = "T1548.001"
name = "Setuid and Setgid"
reference = "https://attack.mitre.org/techniques/T1548/001/"
[[rule.threat.technique.subtechnique]]
id = "T1548.003"
name = "Sudo and Sudo Caching"
reference = "https://attack.mitre.org/techniques/T1548/003/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
Stages and Predicates
Stage 1: process
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
(process.user.id == "0" and process.real_user.id != "0" and process.parent.user.id != "0") or
(process.group.id == "0" and process.real_group.id != "0" and process.parent.group.id != "0")
) and
(
(process.name in ("su", "passwd", "unix_chkpwd") and process.args_count <= 2) or
(
process.name in ("pkexec", "fusermount", "fusermount3", "mount", "umount", "newgrp", "chsh") and
process.args_count == 1
) or
process.name in (
"sudoedit", "gpasswd", "chfn", "polkit-agent-helper-1", "dbus-daemon-launch-helper", "ssh-keysign",
"pam_extrausers_chkpwd", "expiry", "chage", "crontab", "wall", "bsd-write", "ssh-agent",
"ping6", "traceroute", "mtr", "ntfs-3g", "Xorg.wrap", "chrome-sandbox", "bwrap"
)
) and
(
process.parent.name like (".*", "python*", "perl*", "ruby*", "lua*", "php*", "node", "deno", "bun", "java") or
process.parent.executable like ("./*", "/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/user/*", "/var/run/user/*", "/home/*/*") or
(
process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh") and
process.parent.args in ("-c", "-cl", "-lc", "--command", "-ic", "-ci", "-bash", "-sh", "-zsh", "-dash", "-fish", "-ksh", "-mksh") and
process.parent.args_count <= 4
)
) and
not (
(process.name == "crontab" and process.args in ("-l", "-e")) or
(process.name in ("passwd", "chsh") and process.args == "--version")
)
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
process.args | eq | --version | excludes:process.args field:"process.args" value:"--version" |
process.name | in | chsh, passwd | excludes:process.name field:"process.name" value:"chsh" field:"process.name" value:"passwd" |
process.args | in | -e, -l | excludes:process.args field:"process.args" value:"-e" field:"process.args" value:"-l" |
process.name | eq | crontab | excludes:process.name field:"process.name" value:"crontab" |
Tccutil Reset via Suspicious Binary
#Detects when Tccutils is used to reset the TCC database decisions for a specific service via a suspicious binary.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Telemetry Coverage
Rule Body
[rule]
description = "Detects when Tccutils is used to reset the TCC database decisions for a specific service via a suspicious binary."
id = "addfc3f1-4b1c-4005-9133-f64de1aabe6e"
license = "Elastic License v2"
name = "Tccutil Reset via Suspicious Binary"
os_list = ["macos"]
reference = [
"https://www.virustotal.com/gui/file/748581bf2586b76e9cbe550678dcbebde4ec56d1d9fa6bb8c3877878bc8a8fc2",
]
version = "1.0.4"
query = '''
process where event.type == "start" and event.action == "exec" and process.name == "tccutil" and
process.args like~ "reset" and
(process.parent.name == "osascript" or (process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false))
'''
min_endpoint_version = "8.10.2"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.006"
name = "TCC Manipulation"
reference = "https://attack.mitre.org/techniques/T1548/006/"
[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
[internal]
min_endpoint_version = "8.10.2"
Stages and Predicates
Stage 1: process
process where event.type == "start" and event.action == "exec" and process.name == "tccutil" and
process.args like~ "reset" and
(process.parent.name == "osascript" or (process.parent.code_signature.exists == false or process.parent.code_signature.trusted == false))
Indicators
These rows show field, operator, and value matches.
UAC Bypass via Malicious MMC Snap-In Execution
#Identifies attempts to bypass User Account Control (UAC) by executing a malicious Microsoft Management Console (MMC) snap-in. Attackers bypass UAC to stealthily execute code with elevated permissions.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Privilege Escalation |
Rule Body
[rule]
description = """
Identifies attempts to bypass User Account Control (UAC) by executing a malicious Microsoft Management Console (MMC)
snap-in. Attackers bypass UAC to stealthily execute code with elevated permissions.
"""
id = "ccdf56a8-697b-497c-ab90-3aa01bfc5f9f"
license = "Elastic License v2"
name = "UAC Bypass via Malicious MMC Snap-In Execution"
os_list = ["windows"]
reference = ["https://github.com/hfiref0x/UACME/"]
version = "1.0.31"
query = '''
sequence with maxspan=60s
[file where event.action != "deletion" and file.extension : "msc" and not user.name : "SYSTEM"]
[process where event.action == "start" and
process.name : "mmc.exe" and process.command_line : "*.msc *.msc*"]
[process where event.action == "start" and
process.parent.name : "mmc.exe" and process.Ext.token.integrity_level_name == "high" and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe")]
'''
min_endpoint_version = "7.15.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 2
[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 2
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1548"
name = "Abuse Elevation Control Mechanism"
reference = "https://attack.mitre.org/techniques/T1548/"
[[threat.technique.subtechnique]]
id = "T1548.002"
name = "Bypass User Account Control"
reference = "https://attack.mitre.org/techniques/T1548/002/"
[threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[internal]
min_endpoint_version = "7.15.0"
Stages and Predicates
Stage 1: file
[file where event.action != "deletion" and file.extension : "msc" and not user.name : "SYSTEM"]
Stage 2: process
[process where event.action == "start" and
process.name : "mmc.exe" and process.command_line : "*.msc *.msc*"]
Stage 3: process
[process where event.action == "start" and
process.parent.name : "mmc.exe" and process.Ext.token.integrity_level_name == "high" and
not process.executable :
("?:\\Windows\\System32\\WerFault.exe",
"?:\\Windows\\SysWOW64\\WerFault.exe")]
Indicators
These rows show field, operator, and value matches.
Exclusions
The rule actively suppresses these predicates.
| Field | Kind | Excluded values | Search |
|---|---|---|---|
user.name | eq | SYSTEM | excludes:user.name field:"user.name" value:"SYSTEM" |
process.executable | eq | ?:\Windows\System32\WerFault.exe, ?:\Windows\SysWOW64\WerFault.exe | excludes:process.executable field:"process.executable" value:"?:\Windows\System32\WerFault.exe" field:"process.executable" value:"?:\Windows\SysWOW64\WerFault.exe" |
Unusual Process Extension
#Identifies processes running with unusual extensions that are not typically valid for Windows executables.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Stealth |
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
[metadata]
creation_date = "2023/08/23"
integration = ["endpoint"]
maturity = "production"
updated_date = "2024/05/21"
[rule]
author = ["Elastic"]
building_block_type = "default"
description = "Identifies processes running with unusual extensions that are not typically valid for Windows executables.\n"
from = "now-119m"
index = ["logs-endpoint.events.process-*"]
interval = "60m"
language = "eql"
license = "Elastic License v2"
name = "Unusual Process Extension"
risk_score = 21
rule_id = "800e01be-a7a4-46d0-8de9-69f3c9582b44"
severity = "low"
tags = [
"Domain: Endpoint",
"OS: Windows",
"Use Case: Threat Detection",
"Tactic: Defense Evasion",
"Data Source: Elastic Defend",
"Rule Type: BBR",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "windows" and event.type == "start" and
process.executable : "?*" and
not process.name : ("*.exe", "*.com", "*.scr", "*.tmp", "*.dat") and
not process.executable :
(
"MemCompression",
"Registry",
"vmmem",
"vmmemWSL",
"?:\\Program Files\\Dell\\SupportAssistAgent\\*.p5x",
"?:\\Program Files\\Docker\\Docker\\com.docker.service",
"?:\\Users\\*\\AppData\\Local\\Intel\\AGS\\Libs\\AGSRunner.bin",
"\\Device\\Mup\\*\\Software Management\\Select.Html.dep",
"?:\\DJJApplications\\MedicalRecords\\bin\\Select.Html.dep",
"?:\\ProgramData\\Software Management\\Select.Html.dep",
"?:\\Program Files (x86)\\EnCase Applications\\Examiner Service\\EnCase64\\enhkey.dll",
"?:\\Program Files (x86)\\Panda Security\\WAC\\PSNAEInj64.dll",
"?:\\Program Files (x86)\\Johnson Controls\\LicenseActivator\\crp32002.ngn"
) and
not (
(process.name : "C9632CF058AE4321B6B0B5EA39B710FE" and process.code_signature.subject_name == "Dell Inc") or
(process.name : "*.upd" and process.code_signature.subject_name == "Bloomberg LP") or
(process.name: "FD552E21-686E-413C-931D-3B82A9D29F3B" and process.code_signature.subject_name: "Adobe Inc.") or
(process.name: "3B91051C-AE82-43C9-BCEF-0309CD2DD9EB" and process.code_signature.subject_name: "McAfee, LLC") or
(process.name: "soffice.bin" and process.code_signature.subject_name: "The Document Foundation") or
(process.name: ("VeeamVixProxy_*", "{????????-????-????-????-????????????}") and process.code_signature.subject_name: "Veeam Software Group GmbH") or
(process.name: "1cv8p64.bin" and process.code_signature.subject_name: "LLC 1C-Soft") or
(process.name: "AGSRunner.bin" and process.code_signature.subject_name: "Intel Corporation")
)
'''
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1036"
name = "Masquerading"
reference = "https://attack.mitre.org/techniques/T1036/"
[[rule.threat.technique.subtechnique]]
id = "T1036.008"
name = "Masquerade File Type"
reference = "https://attack.mitre.org/techniques/T1036/008/"
[rule.threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"
Stages and Predicates
Stage 1: process
process where host.os.type == "windows" and event.type == "start" and
process.executable : "?*" and
not process.name : ("*.exe", "*.com", "*.scr", "*.tmp", "*.dat") and
not process.executable :
(
"MemCompression",
"Registry",
"vmmem",
"vmmemWSL",
"?:\\Program Files\\Dell\\SupportAssistAgent\\*.p5x",
"?:\\Program Files\\Docker\\Docker\\com.docker.service",
"?:\\Users\\*\\AppData\\Local\\Intel\\AGS\\Libs\\AGSRunner.bin",
"\\Device\\Mup\\*\\Software Management\\Select.Html.dep",
"?:\\DJJApplications\\MedicalRecords\\bin\\Select.Html.dep",
"?:\\ProgramData\\Software Management\\Select.Html.dep",
"?:\\Program Files (x86)\\EnCase Applications\\Examiner Service\\EnCase64\\enhkey.dll",
"?:\\Program Files (x86)\\Panda Security\\WAC\\PSNAEInj64.dll",
"?:\\Program Files (x86)\\Johnson Controls\\LicenseActivator\\crp32002.ngn"
) and
not (
(process.name : "C9632CF058AE4321B6B0B5EA39B710FE" and process.code_signature.subject_name == "Dell Inc") or
(process.name : "*.upd" and process.code_signature.subject_name == "Bloomberg LP") or
(process.name: "FD552E21-686E-413C-931D-3B82A9D29F3B" and process.code_signature.subject_name: "Adobe Inc.") or
(process.name: "3B91051C-AE82-43C9-BCEF-0309CD2DD9EB" and process.code_signature.subject_name: "McAfee, LLC") or
(process.name: "soffice.bin" and process.code_signature.subject_name: "The Document Foundation") or
(process.name: ("VeeamVixProxy_*", "{????????-????-????-????-????????????}") and process.code_signature.subject_name: "Veeam Software Group GmbH") or
(process.name: "1cv8p64.bin" and process.code_signature.subject_name: "LLC 1C-Soft") or
(process.name: "AGSRunner.bin" and process.code_signature.subject_name: "Intel Corporation")
)
Indicators
These rows show field, operator, and value matches.
| Field | Kind | Values | Search |
|---|---|---|---|
event.type | eq |
| field:"event.type" kind:eq value:"start" |
process.executable | wildcard |
| field:"Image" kind:wildcard value:"?*" |
Exclusions
The rule actively suppresses these predicates.
Unusual Region Name for Windows Privileged Operations Detected
#A machine learning job has identified a user performing privileged operations in Windows from an uncommon geographical location, indicating potential privileged access activity. This could suggest a compromised account, unauthorized access, or an attacker using stolen credentials to escalate privileges.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Initial Access | |
| Privilege Escalation |
Rule Body
[metadata]
creation_date = "2025/02/18"
integration = ["pad", "system"]
maturity = "production"
updated_date = "2026/07/27"
min_stack_version = "9.4.0"
min_stack_comments = "Use EA (Entity Analytics) fields"
[rule]
anomaly_threshold = 75
author = ["Elastic"]
description = """
A machine learning job has identified a user performing privileged operations in Windows from an uncommon geographical
location, indicating potential privileged access activity. This could suggest a compromised account, unauthorized
access, or an attacker using stolen credentials to escalate privileges.
"""
from = "now-1h"
interval = "15m"
license = "Elastic License v2"
machine_learning_job_id = "pad_windows_rare_region_name_by_user_ea"
name = "Unusual Region Name for Windows Privileged Operations Detected"
note = """## Triage and analysis
> **Disclaimer**:
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
### Investigating Unusual Region Name for Windows Privileged Operations Detected
The detection leverages machine learning to identify privileged operations from atypical geographic locations, which may indicate compromised accounts or unauthorized access. Adversaries exploit this by using stolen credentials to perform privilege escalation. The rule flags such anomalies, aiding in early detection of potential security breaches.
### Possible investigation steps
- Review the alert details to identify the user account involved and the specific geographic location flagged as unusual.
- Check the user's recent login history and patterns to determine if the location is indeed uncommon for this user.
- Investigate any recent changes to the user's account, such as password resets or modifications to account permissions, that could indicate compromise.
- Correlate the alert with other security events or logs, such as VPN connections or remote access logs, to identify any unauthorized access attempts.
- Contact the user to verify if they were traveling or using a legitimate remote access method from the flagged location.
- Assess the risk by determining if the privileged operations performed align with the user's role and responsibilities within the organization.
### False positive analysis
- Users traveling for business or personal reasons may trigger alerts when accessing systems from uncommon locations. To manage this, create exceptions for known travel patterns or use a VPN to simulate access from a common location.
- Remote employees or contractors working from different regions might cause false positives. Regularly update the list of approved remote work locations to prevent unnecessary alerts.
- Use of cloud services or VPNs that route traffic through different geographic locations can lead to false positives. Implement a whitelist for known IP addresses associated with these services.
- Scheduled maintenance or administrative tasks performed by IT staff from different locations can be mistaken for unauthorized access. Document and schedule these activities to avoid triggering alerts.
- Employees using personal devices with location services disabled may appear to be accessing from unusual regions. Encourage the use of company-approved devices with location tracking enabled to ensure accurate detection.
### Response and remediation
- Immediately isolate the affected user account to prevent further unauthorized access. Disable the account temporarily until the investigation is complete.
- Review recent login activity and privileged operations performed by the affected account to identify any unauthorized changes or actions.
- Reset the password for the compromised account and enforce multi-factor authentication (MFA) to enhance security.
- Conduct a thorough review of the affected system and network for any signs of additional compromise or lateral movement by the attacker.
- Notify the security team and relevant stakeholders about the incident for awareness and further action if needed.
- Restore any unauthorized changes made during the incident from backups or logs, ensuring system integrity is maintained.
- Update security policies and access controls to prevent similar incidents, focusing on restricting privileged operations from uncommon geographic locations."""
references = [
"https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html",
"https://docs.elastic.co/en/integrations/pad",
]
risk_score = 21
rule_id = "d2703b82-f92c-4489-a4a7-62aa29a62542"
setup = """## Setup
The rule requires the Privileged Access Detection integration assets to be installed, as well as Windows logs collected by the System integration.
### Privileged Access Detection Setup
The Privileged Access Detection integration detects privileged access activity by identifying abnormalities in Windows, Linux and Okta events. Anomalies are detected using Elastic's Anomaly Detection feature.
#### Prerequisite Requirements:
- Fleet is required for Privileged Access Detection.
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
- Windows events collected by the [System](https://docs.elastic.co/en/integrations/system) integration.
- To add the System integration to an Elastic Agent policy, refer to [this](https://www.elastic.co/guide/en/fleet/current/add-integration-to-policy.html) guide.
#### The following steps should be executed to install assets associated with the Privileged Access Detection integration:
- Go to the Kibana homepage. Under Management, click Integrations.
- In the query bar, search for Privileged Access Detection and select the integration to see more details about it.
- Follow the instructions under the **Installation** section.
- For this rule to work, complete the instructions through **Add preconfigured anomaly detection jobs**.
"""
severity = "low"
tags = [
"Data Source: Windows Security Event Logs",
"Use Case: Privileged Access Detection",
"Rule Type: ML",
"Rule Type: Machine Learning",
"Tactic: Privilege Escalation",
"Resources: Investigation Guide",
]
type = "machine_learning"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[rule.threat.tactic]
id = "TA0004"
name = "Privilege Escalation"
reference = "https://attack.mitre.org/tactics/TA0004/"
[[rule.threat]]
framework = "MITRE ATT&CK"
[[rule.threat.technique]]
id = "T1078"
name = "Valid Accounts"
reference = "https://attack.mitre.org/techniques/T1078/"
[rule.threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"