Azure-Sentinel: Solutions/Watchlists Utilities/Playbooks/Watchlist-ChangeIncidentSeverityandTitleIFUserVIP is not working as intended
Describe the bug Playbook (Watchlist-ChangeIncidentSeverityandTitleIFUserVIP) in “Watchlists Utilities” does not work as intended. I’ve tested this playbook with automation rule that triggers from an analytics rule “Guest accounts added in AAD Groups other than the ones specified”, but I’m quite sure any analytics rule will suffice.
What happens is that if my account is used to add guest user to a non-allowed AAD group (allowed groups are set in the watchlist), it will raise an incident. Great! In that incident there are two account entities: mine (as the actor of the operation) and the guest user’s account (as the target of the operation). Once I will trigger an automation rule that has this playbook it successfully executes.
The erroneous behaviour happens because my account has been used to create the VIP User watchlist. This means that in the body of the watchlist JSON there is not only VIP users but also my account name in the properties.createdBy and properties.updatedBy. As the playbook operates the for each loop it first suffixes the target account correctly to the incident title but will overwrite the correct title addition with my account name in the next for each loop. This is mistake as I’m not a VIP user in the watchlist.
As a side note, also the Sentinel actions after the condition evaluation should be updated to newer actions (mainly ‘Update incident’ action)
To Reproduce Steps to reproduce the behavior:
- Create an AAD group “Guest users” and copy object id. Create another groups “Members only”.
- Create an watchlist with schema that includes AAD group object id and display name. Make object id SearchKey. Make alias as “AAD-Guest-User-Groups”
- Add the “Guest users” AAD group object id and display name to the newly created watchlist.
- Install Azure Active Directory solution that has the “Guest accounts added in AAD Groups other than the ones specified” analytics rule
- Edit the rule to get the AAD group object IDs from watchlist instead of hardcoded values in query (only the first row of query is changed a bit)
// OBJECT ID of AAD Groups can be found by navigating to Azure Active Directory then from menu on the left, select Groups and from the list shown of AAD Groups, the Second Column shows the ObjectID of each
let GroupIDs = _GetWatchlist('AAD-Guest-User-Groups');
AuditLogs
| where OperationName in ('Add member to group', 'Add owner to group')
| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)
| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress
// Uncomment the following line to filter events where the inviting user was a guest user
//| where InitiatedBy has_any ("CUSTOM DOMAIN NAME#", "#EXT#")
| mv-apply TargetResource = TargetResources on
(
where TargetResource.type =~ "User"
| extend InvitedUser = trim(@'"',tostring(TargetResource.userPrincipalName)),
Properties = TargetResource.modifiedProperties
)
| mv-apply Property = Properties on
(
where Property.displayName =~ "Group.DisplayName"
| extend AADGroup = trim('"',tostring(Property.newValue))
)
| where InvitedUser has_any ("CUSTOM DOMAIN NAME#", "#EXT#")
| mv-apply Property = Properties on
(
where Property.displayName =~ "Group.ObjectID"
| extend AADGroupId = trim('"',tostring(Property.newValue))
)
| where AADGroupId !in (GroupIDs)
| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])
- Save the rule
- Create an automation rule that will trigger from incident creation and only from this analytics rule
- Add the playbook in question into the automation rule as an action and save the automation rule
- Invite a guest user and add guest as member to “Members only” group. Use same account that was used to create the watchlist.
- Wait for activity log to appear and analytics rule to run and automation rule to trigger and eventually run the playbook
- You should have an incident that has severity ‘High’ and which has either your account name suffixed instead of the target user (may depend of the for each loop order)
Expected behavior
I expect the playbook workflow to properly parse the watchlist JSON and only compare incident account entities in for each loop against watchlist body.properties.watchListItems.properties.itemsKeyValue which contains “User Principal Name” value that can be used to check with Account Name using ‘contains’. Checking against the whole watchlist body will result in unwanted situation.
Screenshots
Condition evaluation inside the for each loop returns ‘true’ for both accounts even if the other account is not a VIP user.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (18 by maintainers)
Hi @tohov , As discussed over teams meeting today,the issue has been resolved after code changes done over to logic app for this scenario based issue,will be Rasing PR for this fix,will update you.
Hi @tohov ,I have done changes in my logic app and testing it ,once done, will schedule call with you in next week middle i.e. 29Nov23
Hi @tohov ,Thanks for sharing time slot,will schedule the meeting during the time slots,Thanks
Hi @tohov , we are reaching out to the concerned team for this issue, once we receive an update on this, we will update you by 02Nov23. Thanks!