Forum Discussion
dmarquesgn
Jan 03, 2023Iron Contributor
Kusto Query to extract the number of exploitable vulnerabilities
Hi, I need to build up a Kusto Query to extract the total number of Exploitable Vulnerabilities. The vulnerabilities are on the DeviceTvmSoftwareVulnerabilities table with their CVEID and the Exp...
- Jan 05, 2023
Thanks for the reference. But I found out what was the issue. Now it works as expected, like this:
$vulnUrl = '{ "query": "DeviceTvmSoftwareVulnerabilities | join (DeviceTvmSoftwareVulnerabilitiesKB) on CveId | where IsExploitable == 1 | count" }' $vulnUrlUri = "https://graph.microsoft.com/beta/security/runHuntingQuery" $vulnResponse = Invoke-WebRequest -Method Post -Uri $vulnUrlUri -Body $vulnUrl -Headers $headers -ErrorAction Stop
The difference was the " surrounding the 1 value. So I guess it doesn't deal well with multiple " on the variable.
Rod_Trent
Microsoft
Jan 04, 2023Looking at the following: https://learningbydoing.cloud/blog/query-log-analytics-with-kql-from-powershell/
There is an Invoke-AzOperationalInsightsQuery
There is an Invoke-AzOperationalInsightsQuery
dmarquesgn
Jan 05, 2023Iron Contributor
Thanks for the reference. But I found out what was the issue. Now it works as expected, like this:
$vulnUrl = '{ "query": "DeviceTvmSoftwareVulnerabilities | join (DeviceTvmSoftwareVulnerabilitiesKB) on CveId | where IsExploitable == 1 | count" }'
$vulnUrlUri = "https://graph.microsoft.com/beta/security/runHuntingQuery"
$vulnResponse = Invoke-WebRequest -Method Post -Uri $vulnUrlUri -Body $vulnUrl -Headers $headers -ErrorAction Stop
The difference was the " surrounding the 1 value. So I guess it doesn't deal well with multiple " on the variable.
- dmarquesgnJan 05, 2023Iron Contributor
This now leads me to an issue. I've got other query which I would like to run, which is this:
AlertInfo | where Title == "Email reported by user as malware or phish" | where Timestamp > ago(30d) | count
And in this case I cannot remove the " nor replace it on the variable by '.
So I don't know if there's any way to escape the ".