Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Server Oriented Cmdlet And User Oriented Cmdlet used

Back
Id7bce901b-9bc8-4948-8dfc-8f68878092d5
RulenameServer Oriented Cmdlet And User Oriented Cmdlet used
DescriptionDetect if a server oriented cmdlet and a user oriented cmdlet that are monitored are launched by the same user in the same server within a 10 minutes timeframe
SeverityHigh
TacticsExfiltration
Persistence
Collection
TechniquesT1020
T1098
T1114
Required data connectorsESI-ExchangeAdminAuditLogEvents
KindScheduled
Query frequency1d
Query period1d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Exchange Security - Exchange On-Premises/Analytic Rules/ServerOrientedWithUserOrientedAdministration.yaml
Version1.2.0
Arm template7bce901b-9bc8-4948-8dfc-8f68878092d5.json
Deploy To Azure
let timeframe = 1d;
let spanoftime = 10m;
let threshold = 0;
ExchangeAdminAuditLogs 
  | where TimeGenerated > ago(2 * timeframe)
  | where isempty(UserOriented)
  | project serverExecutedTime = TimeGenerated,
    ServerCmdlet = CmdletName,
    ServerCmdletParams = CmdletParameters,
    Computer,
    Caller,
    ServerCmdletTargetObject = TargetObject
  | join kind= inner (
      ExchangeAdminAuditLogs
      | where TimeGenerated > ago(timeframe)
      | where UserOriented =~ 'Yes'
      | project userExecutedTime = TimeGenerated,
        UserCmdlet = CmdletName,
        UserCmdletParams = CmdletParameters,
        Computer,
        Caller,
        UserCmdletTargetObject = TargetObject,
        userPrincipalName,
        objectGUID,
        sAMAccountName,
        IsVIP)
    on Computer, Caller
  | where userExecutedTime - serverExecutedTime < spanoftime
  | extend TimeDelta = userExecutedTime - serverExecutedTime
  | extend TimeDeltaInverse = serverExecutedTime - userExecutedTime
  | where tolong(TimeDelta) >= threshold or tolong(TimeDeltaInverse) >= threshold
queryFrequency: 1d
severity: High
id: 7bce901b-9bc8-4948-8dfc-8f68878092d5
status: Available
requiredDataConnectors:
- dataTypes:
  - Event
  connectorId: ESI-ExchangeAdminAuditLogEvents
kind: Scheduled
description: |
    'Detect if a server oriented cmdlet and a user oriented cmdlet that are monitored are launched by the same user in the same server within a 10 minutes timeframe'
query: |
  let timeframe = 1d;
  let spanoftime = 10m;
  let threshold = 0;
  ExchangeAdminAuditLogs 
    | where TimeGenerated > ago(2 * timeframe)
    | where isempty(UserOriented)
    | project serverExecutedTime = TimeGenerated,
      ServerCmdlet = CmdletName,
      ServerCmdletParams = CmdletParameters,
      Computer,
      Caller,
      ServerCmdletTargetObject = TargetObject
    | join kind= inner (
        ExchangeAdminAuditLogs
        | where TimeGenerated > ago(timeframe)
        | where UserOriented =~ 'Yes'
        | project userExecutedTime = TimeGenerated,
          UserCmdlet = CmdletName,
          UserCmdletParams = CmdletParameters,
          Computer,
          Caller,
          UserCmdletTargetObject = TargetObject,
          userPrincipalName,
          objectGUID,
          sAMAccountName,
          IsVIP)
      on Computer, Caller
    | where userExecutedTime - serverExecutedTime < spanoftime
    | extend TimeDelta = userExecutedTime - serverExecutedTime
    | extend TimeDeltaInverse = serverExecutedTime - userExecutedTime
    | where tolong(TimeDelta) >= threshold or tolong(TimeDeltaInverse) >= threshold  
tactics:
- Exfiltration
- Persistence
- Collection
triggerThreshold: 0
triggerOperator: gt
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Exchange Security - Exchange On-Premises/Analytic Rules/ServerOrientedWithUserOrientedAdministration.yaml
relevantTechniques:
- T1020
- T1098
- T1114
entityMappings:
- entityType: Mailbox
  fieldMappings:
  - identifier: MailboxPrimaryAddress
    columnName: userPrincipalName
  - identifier: Upn
    columnName: userPrincipalName
- entityType: Host
  fieldMappings:
  - identifier: FullName
    columnName: Computer
- entityType: Host
  fieldMappings:
  - identifier: HostName
    columnName: ServerCmdletTargetObject
- entityType: Account
  fieldMappings:
  - identifier: Name
    columnName: Caller
  - identifier: ObjectGuid
    columnName: objectGUID
version: 1.2.0
name: Server Oriented Cmdlet And User Oriented Cmdlet used
queryPeriod: 1d
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2023-02-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/7bce901b-9bc8-4948-8dfc-8f68878092d5')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/7bce901b-9bc8-4948-8dfc-8f68878092d5')]",
      "properties": {
        "alertRuleTemplateName": "7bce901b-9bc8-4948-8dfc-8f68878092d5",
        "customDetails": null,
        "description": "'Detect if a server oriented cmdlet and a user oriented cmdlet that are monitored are launched by the same user in the same server within a 10 minutes timeframe'\n",
        "displayName": "Server Oriented Cmdlet And User Oriented Cmdlet used",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Mailbox",
            "fieldMappings": [
              {
                "columnName": "userPrincipalName",
                "identifier": "MailboxPrimaryAddress"
              },
              {
                "columnName": "userPrincipalName",
                "identifier": "Upn"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "Computer",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "ServerCmdletTargetObject",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "Caller",
                "identifier": "Name"
              },
              {
                "columnName": "objectGUID",
                "identifier": "ObjectGuid"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Exchange Security - Exchange On-Premises/Analytic Rules/ServerOrientedWithUserOrientedAdministration.yaml",
        "query": "let timeframe = 1d;\nlet spanoftime = 10m;\nlet threshold = 0;\nExchangeAdminAuditLogs \n  | where TimeGenerated > ago(2 * timeframe)\n  | where isempty(UserOriented)\n  | project serverExecutedTime = TimeGenerated,\n    ServerCmdlet = CmdletName,\n    ServerCmdletParams = CmdletParameters,\n    Computer,\n    Caller,\n    ServerCmdletTargetObject = TargetObject\n  | join kind= inner (\n      ExchangeAdminAuditLogs\n      | where TimeGenerated > ago(timeframe)\n      | where UserOriented =~ 'Yes'\n      | project userExecutedTime = TimeGenerated,\n        UserCmdlet = CmdletName,\n        UserCmdletParams = CmdletParameters,\n        Computer,\n        Caller,\n        UserCmdletTargetObject = TargetObject,\n        userPrincipalName,\n        objectGUID,\n        sAMAccountName,\n        IsVIP)\n    on Computer, Caller\n  | where userExecutedTime - serverExecutedTime < spanoftime\n  | extend TimeDelta = userExecutedTime - serverExecutedTime\n  | extend TimeDeltaInverse = serverExecutedTime - userExecutedTime\n  | where tolong(TimeDelta) >= threshold or tolong(TimeDeltaInverse) >= threshold\n",
        "queryFrequency": "P1D",
        "queryPeriod": "P1D",
        "severity": "High",
        "status": "Available",
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Collection",
          "Exfiltration",
          "Persistence"
        ],
        "techniques": [
          "T1020",
          "T1098",
          "T1114"
        ],
        "templateVersion": "1.2.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}