Query Details

Executables In App Data Local Roaming

Query

//Remains a common TTP despite other user writtable and executable paths in windows
//Once hunted, consider checking out AaronLocker which is a Applocker Strategy
DeviceProcessEvents
| where InitiatingProcessFolderPath contains "\\appdata\\roaming\\" and InitiatingProcessFileName has_any (".exe",".ps1",".msi",".bat",".scr",".cmd",".inf",".cab",".iso",".dll",".hta",".jar",".msc",".msix",".docm",".xlsm",".pif",".ppa",".reg",".scf",".sct",".sys",".vb",".vbe",".vbs",".wsh",".psm1",".py",".js")
| summarize by InitiatingProcessVersionInfoProductName,InitiatingProcessFileName,InitiatingProcessFolderPath,DeviceName, AccountName, ProcessCommandLine
//Lots more executable types can be added not a comprehensive list, filter out as apprioprate 

Explanation

This KQL (Kusto Query Language) query is designed to identify potentially suspicious processes running on a Windows device. Here's a simplified explanation of what the query does:

  1. Data Source: It starts by looking at DeviceProcessEvents, which contains information about processes that have been executed on a device.

  2. Filter Criteria: The query filters for processes that were initiated from a folder path containing \\appdata\\roaming\\. This is a common location where malicious software might try to execute because it is user-writable and often overlooked.

  3. File Types: It specifically looks for files with certain extensions that are commonly associated with executable or script files, such as .exe, .ps1, .msi, .bat, and many others. These file types are often used in attacks to execute malicious code.

  4. Summarization: The query summarizes the results by grouping them based on several attributes: the product name of the initiating process, the file name, the folder path, the device name, the account name, and the command line used to execute the process. This helps in identifying patterns or anomalies.

  5. Commentary: The comments in the query suggest that this is a common technique used by attackers (TTP - Tactics, Techniques, and Procedures) and recommend considering the use of AaronLocker, which is a strategy for implementing AppLocker, a Windows feature that helps control which applications can run on a system.

Overall, this query is used for threat hunting to detect potentially malicious activities by identifying suspicious processes executed from a specific directory with certain file types.

Details

Jay Kerai profile picture

Jay Kerai

Released: November 27, 2025

Tables

DeviceProcessEvents

Keywords

DeviceProcessEventsInitiatingProcessFolderPathInitiatingProcessFileNameInitiatingProcessVersionInfoProductNameDeviceNameAccountNameProcessCommandLine

Operators

containshas_anysummarize by

Actions