Forum Discussion
CurlX2305
Aug 27, 2022Copper Contributor
Advanced Hunting Query Powershell Command Line
I was testing if I was able to detect various PowerShell Commands in the Advanced Hunting and this was the result: Via Windows Powershell CommandLine I executed: (Invoke-Webrequest -Uri "https:/...
- Aug 28, 2022
You will need to enable Powershell script block logging via GPO to see the full commands that were run
Dutchboy
Dec 05, 2022Copper Contributor
this is because the actiontype is detected after the command successfully executed not while its being called.
Try the below, as a workaround, you might need to filter based on events , but power shell which has a invoke web request needs to be checked.
DeviceProcessEvents
| where FileName =~ "powershell.exe" or InitiatingProcessFileName =~"powershell.exe"
| where ProcessCommandLine has_any ("Invoke-WebRequest", "Invoke-Expression", "uri")
Try the below, as a workaround, you might need to filter based on events , but power shell which has a invoke web request needs to be checked.
DeviceProcessEvents
| where FileName =~ "powershell.exe" or InitiatingProcessFileName =~"powershell.exe"
| where ProcessCommandLine has_any ("Invoke-WebRequest", "Invoke-Expression", "uri")