host.os.type:windows and event.category:process and event.type:start and
(
(process.name.caseless:"reg.exe" and process.args:"query") or
(process.name.caseless:("powershell.exe" or "powershell_ise.exe" or "pwsh.exe") and
process.args:(
("get-childitem" or "Get-ChildItem" or "gci" or "dir" or "ls" or
"get-item" or "Get-Item" or "gi" or
"get-itemproperty" or "Get-ItemProperty" or "gp") and
("hkcu" or "HKCU" or "hkey_current_user" or "HKEY_CURRENT_USER" or
"hkey_local_machine" or "HKEY_LOCAL_MACHINE" or
"hklm" or "HKLM" or registry\:\:*)
)
)
) and
not process.command_line : (
"C:\\Windows\\system32\\reg.exe query hklm\\software\\microsoft\\windows\\softwareinventorylogging /v collectionstate /reg:64" or
"reg query \"HKLM\\Software\\WOW6432Node\\Npcap\" /ve "
)
Install detection rules in Elastic Security
Detect Query Registry using Built-in Tools in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).