Query Details

Live Response File Collection

Query

# Live Response File Collection

## Query Information

### Description
This query lists all the Getfile activities that have been executed. This includes listing the SHA256 hash of the collected file (when available).

### References
- https://kqlquery.com/posts/leveraging-live-response/
- https://learn.microsoft.com/en-us/defender-endpoint/live-response-command-examples
- https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-fileprofile-function

## Defender For Endpoint
```
CloudAppEvents
| where Timestamp > ago(30d)
| where ActionType == "LiveResponseGetFile"
| extend FileName = tostring(parse_json(RawEventData).FileName), FileSHA256 = tostring(parse_json(RawEventData).FileSHA256)
| project-rename InitiatedByAccountName = AccountDisplayName, InitiatedByAccounttId = AccountId, SHA256 = FileSHA256
| invoke FileProfile(SHA256, 1000)
| project-reorder Timestamp, FileName, SHA256, InitiatedByAccountName, InitiatedByAccounttId, GlobalPrevalence, SignatureState
```
## Sentinel
```
CloudAppEvents
| where TimeGenerated > ago(30d)
| where ActionType == "LiveResponseGetFile"
| extend FileName = tostring(parse_json(RawEventData).FileName), FileSHA256 = tostring(parse_json(RawEventData).FileSHA256)
| project-rename InitiatedByAccountName = AccountDisplayName, InitiatedByAccounttId = AccountId, SHA256 = FileSHA256
| invoke FileProfile(SHA256, 1000)
| project-reorder TimeGenerated, FileName, SHA256, InitiatedByAccountName, InitiatedByAccounttId, GlobalPrevalence, SignatureState
```

Explanation

This query retrieves information about files collected during Live Response activities, including the SHA256 hash of the file. It lists details such as file name, SHA256 hash, account name, account ID, global prevalence, and signature state. The query is executed in both Defender for Endpoint and Sentinel environments.

Details

Bert-Jan Pals profile picture

Bert-Jan Pals

Released: May 25, 2024

Tables

CloudAppEvents

Keywords

CloudAppEvents,Timestamp,ActionType,LiveResponseGetFile,FileName,FileSHA256,RawEventData,AccountDisplayName,AccountId,SHA256,FileProfile,GlobalPrevalence,SignatureState,TimeGenerated.

Operators

whereagoextendtostringparse_jsonproject-renameinvokeproject-reorder

Actions