Skip to content

Commit

Permalink
SIEM_search_PB_query_fix (demisto#36422)
Browse files Browse the repository at this point in the history
* Queries fixes

* RN
  • Loading branch information
OmriItzhak authored Sep 23, 2024
1 parent d6e337f commit 0919508
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ tasks:
extend-context:
simple: AzureUncommonCountryLogon=
query:
simple: "BehaviorAnalytics\n| where ActivityInsights.FirstTimeUserConnectedFromCountry == \"True\"\n| where UserPrincipalName == \"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(ActionType)"
simple: "BehaviorAnalytics\n| where ActivityInsights.FirstTimeUserConnectedFromCountry == \"True\"\n| where UserPrincipalName == @\"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(ActionType)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -354,7 +354,7 @@ tasks:
extend-context:
simple: AzureUncommonVolume=
query:
simple: "BehaviorAnalytics\n| where ActivityInsights.UncommonHighVolumeOfActions == \"True\"\n| where UserPrincipalName == \"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(ActionType)"
simple: "BehaviorAnalytics\n| where ActivityInsights.UncommonHighVolumeOfActions == \"True\"\n| where UserPrincipalName == @\"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(ActionType)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -394,7 +394,7 @@ tasks:
simple: |-
BehaviorAnalytics
| where ActivityInsights.ActionUncommonlyPerformedByUser == "True"
| where UserPrincipalName == "${inputs.Username}"
| where UserPrincipalName == @"${inputs.Username}"
| where TimeGenerated > ${inputs.AzureSearchTime}
| summarize Count = count(), Events = make_list(ActionType)
separatecontext: false
Expand Down Expand Up @@ -437,7 +437,7 @@ tasks:
IdentityInfo
| where RiskState contains "Risk"
| where RiskLevel == "High"
| where AccountUPN == "${inputs.Username}"
| where AccountUPN == @"${inputs.Username}"
| where TimeGenerated > ${inputs.AzureSearchTime}
| summarize Count = count()
separatecontext: false
Expand Down Expand Up @@ -476,7 +476,7 @@ tasks:
extend-context:
simple: AzureAnomalies=
query:
simple: "Anomalies \n| where UserPrincipalName == \"${inputs.Username}\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(AnomalyDetails)"
simple: "Anomalies \n| where UserPrincipalName == @\"${inputs.Username}\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(AnomalyDetails)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -513,7 +513,7 @@ tasks:
extend-context:
simple: AzureNumOfFailLogin=
query:
simple: "SigninLogs \n| where parse_json(Status) contains \"fail\"\n| where UserPrincipalName == \"${inputs.Username}\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize ActionCount = count() by UserPrincipalName\n| where ActionCount > ${inputs.failedLogonThreshold}\n| summarize Count = count()"
simple: "SigninLogs \n| where parse_json(Status) contains \"fail\"\n| where UserPrincipalName == @\"${inputs.Username}\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize ActionCount = count() by UserPrincipalName\n| where ActionCount > ${inputs.failedLogonThreshold}\n| summarize Count = count()"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -552,7 +552,7 @@ tasks:
ignore-outputs:
simple: "false"
query:
simple: "AuditLogs \n| where parse_json(tostring(InitiatedBy.user)).userPrincipalName == \"${inputs.Username}\" \n| where AdditionalDetails[0].value contains \"python\" or AdditionalDetails[0].value contains \"curl\" or AdditionalDetails[0].value contains \"axios\" or AdditionalDetails[0].value contains \"httpie\" or AdditionalDetails[0].value contains \"wget\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(AdditionalDetails)"
simple: "AuditLogs \n| where parse_json(tostring(InitiatedBy.user)).userPrincipalName == @\"${inputs.Username}\" \n| where AdditionalDetails[0].value contains \"python\" or AdditionalDetails[0].value contains \"curl\" or AdditionalDetails[0].value contains \"axios\" or AdditionalDetails[0].value contains \"httpie\" or AdditionalDetails[0].value contains \"wget\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(AdditionalDetails)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -589,7 +589,7 @@ tasks:
extend-context:
simple: AzureSuccessSecurityRulesChange=
query:
simple: "AzureActivity\n| where OperationName in (\"Delete Security Rule\",\"Create or Update Security Rule\",\"Update Alert Rules\",\"Delete Alert Rules\",\"Delete Watchlists\",\"Update Watchlists\",\"Microsoft.SecurityInsights/watchlists/watchlistItems/delete\",\"Create or Update Application Gateway WAF Policy\",\"Delete Application Gateway WAF Policy\",\"Update database threat detection policy\")\n| where ActivityStatus == \"Succeeded\"\n| where Caller == \"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(OperationName)"
simple: "AzureActivity\n| where OperationName in (\"Delete Security Rule\",\"Create or Update Security Rule\",\"Update Alert Rules\",\"Delete Alert Rules\",\"Delete Watchlists\",\"Update Watchlists\",\"Microsoft.SecurityInsights/watchlists/watchlistItems/delete\",\"Create or Update Application Gateway WAF Policy\",\"Delete Application Gateway WAF Policy\",\"Update database threat detection policy\")\n| where ActivityStatus == \"Succeeded\"\n| where Caller == @\"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(OperationName)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -626,7 +626,7 @@ tasks:
extend-context:
simple: AzureUnsuccessSecurityRulesChange=
query:
simple: "AzureActivity\n| where OperationName in (\"Delete Security Rule\",\"Create or Update Security Rule\",\"Update Alert Rules\",\"Delete Alert Rules\",\"Delete Watchlists\",\"Update Watchlists\",\"Microsoft.SecurityInsights/watchlists/watchlistItems/delete\",\"Create or Update Application Gateway WAF Policy\",\"Delete Application Gateway WAF Policy\",\"Update database threat detection policy\")\n| where ActivityStatus != \"Succeeded\"\n| where Caller == \"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(OperationName)"
simple: "AzureActivity\n| where OperationName in (\"Delete Security Rule\",\"Create or Update Security Rule\",\"Update Alert Rules\",\"Delete Alert Rules\",\"Delete Watchlists\",\"Update Watchlists\",\"Microsoft.SecurityInsights/watchlists/watchlistItems/delete\",\"Create or Update Application Gateway WAF Policy\",\"Delete Application Gateway WAF Policy\",\"Update database threat detection policy\")\n| where ActivityStatus != \"Succeeded\"\n| where Caller == @\"${inputs.Username}\" \n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(OperationName)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -665,7 +665,7 @@ tasks:
ignore-outputs:
simple: "false"
query:
simple: "AuditLogs\n| where parse_json(tostring(InitiatedBy.user)).userPrincipalName == \"${inputs.Username}\" \n| where Category in (\"ApplicationManagement\", \"UserManagement\", \"PolicyManagement\", \"GroupManagement\")| where Result == \"success\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(OperationName)"
simple: "AuditLogs\n| where parse_json(tostring(InitiatedBy.user)).userPrincipalName == @\"${inputs.Username}\" \n| where Category in (\"ApplicationManagement\", \"UserManagement\", \"PolicyManagement\", \"GroupManagement\")| where Result == \"success\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize Count = count(), Events = make_list(OperationName)"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down Expand Up @@ -741,7 +741,7 @@ tasks:
extend-context:
simple: AzureNumOfFailMFA=
query:
simple: "SigninLogs \n| where ResultType =~ \"50074\"\n| where UserPrincipalName == \"${inputs.Username}\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize ActionCount = count() by UserPrincipalName\n| where ActionCount > ${inputs.MfaAttemptThreshold}"
simple: "SigninLogs \n| where ResultType =~ \"50074\"\n| where UserPrincipalName == @\"${inputs.Username}\"\n| where TimeGenerated > ${inputs.AzureSearchTime}\n| summarize ActionCount = count() by UserPrincipalName\n| where ActionCount > ${inputs.MfaAttemptThreshold}"
separatecontext: false
continueonerrortype: ""
view: |-
Expand Down
6 changes: 6 additions & 0 deletions Packs/Azure-Enrichment-Remediation/ReleaseNotes/1_1_20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Playbooks

##### Azure - User Investigation

Updated the Azure Log Analytics queries to support special characters.
2 changes: 1 addition & 1 deletion Packs/Azure-Enrichment-Remediation/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Azure Enrichment and Remediation",
"description": "Playbooks using multiple Azure content packs for enrichment and remediation purposes",
"support": "xsoar",
"currentVersion": "1.1.19",
"currentVersion": "1.1.20",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ tasks:
simple: |-
SecurityEvent
| where EventID == 4771 or EventID == 4625 and (LogonType == 2 or LogonType == 7 or LogonType == 10)
| where TargetAccount == '${inputs.Username}'
| where TargetAccount == @'${inputs.Username}'
| where TimeGenerated > ${inputs.AzureSearchTime}
separatecontext: false
continueonerrortype: ""
Expand Down Expand Up @@ -774,7 +774,7 @@ outputs:
- contextPath: AzureFailedLogonLogs
description: The result of the Azure Log Analytics search.
type: unknown
quiet: true
quiet: false
tests:
- No tests
fromversion: 6.5.0
Expand Down
6 changes: 6 additions & 0 deletions Packs/CommonPlaybooks/ReleaseNotes/2_6_41.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Playbooks

##### SIEM - Search for Failed logins

Updated the Azure Log Analytics query to support special characters.
2 changes: 1 addition & 1 deletion Packs/CommonPlaybooks/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Common Playbooks",
"description": "Frequently used playbooks pack.",
"support": "xsoar",
"currentVersion": "2.6.40",
"currentVersion": "2.6.41",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down

0 comments on commit 0919508

Please sign in to comment.