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

GSA Enriched Office 365 - Sharepoint File Transfer Above Threshold

Back
Id30375d00-68cc-4f95-b89a-68064d566358
RulenameGSA Enriched Office 365 - Sharepoint File Transfer Above Threshold
DescriptionIdentifies Office365 SharePoint file transfers above a certain threshold in a 15-minute time period.

Please note that entity mapping for arrays is not supported, so when there is a single value in an array, we will pull that value from the array as a single string to populate the entity to support entity mapping features within Sentinel. Additionally, if the array is multivalued, we will input a string to indicate this with a unique hash so that matching will not occur.
SeverityMedium
TacticsExfiltration
TechniquesT1020
Required data connectorsAzureActiveDirectory
Office365
KindScheduled
Query frequency15m
Query period15m
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Global Secure Access/Analytic Rules/Office 365 - sharepoint_file_transfer_above_threshold.yaml
Version1.0.6
Arm template30375d00-68cc-4f95-b89a-68064d566358.json
Deploy To Azure
let threshold = 5000;
// EnrichedMicrosoft365AuditLogs Query
let EnrichedEvents = EnrichedMicrosoft365AuditLogs
    | where Workload has_any("SharePoint", "OneDrive")
    | where Operation has_any("FileDownloaded", "FileSyncDownloadedFull", "FileSyncUploadedFull", "FileUploaded")
    | extend ClientIP = ClientIp
    | summarize TransferCount = dcount(ObjectId), fileslist = make_set(ObjectId, 10000)
        by UserId, ClientIP, bin(TimeGenerated, 15m)
    | where TransferCount >= threshold
    | extend FileSample = iff(array_length(fileslist) == 1, tostring(fileslist[0]),
             strcat("SeeFilesListField_", tostring(hash(tostring(fileslist)))))
    | extend AccountName = tostring(split(UserId, "@")[0]),
             AccountUPNSuffix = tostring(split(UserId, "@")[1]);
// OfficeActivity Query
let OfficeEvents = OfficeActivity
    | where EventSource == "SharePoint"
    | where OfficeWorkload has_any("SharePoint", "OneDrive")
    | where Operation has_any("FileDownloaded", "FileSyncDownloadedFull", "FileSyncUploadedFull", "FileUploaded")
    | summarize TransferCount = dcount(OfficeObjectId), fileslist = make_set(OfficeObjectId, 10000)
        by UserId, ClientIP, bin(TimeGenerated, 15m)
    | where TransferCount >= threshold
    | extend FileSample = iff(array_length(fileslist) == 1, tostring(fileslist[0]),
             strcat("SeeFilesListField_", tostring(hash(tostring(fileslist)))))
    | extend AccountName = tostring(split(UserId, "@")[0]),
             AccountUPNSuffix = tostring(split(UserId, "@")[1]);
// Combine Office and Enriched Logs
let CombinedEvents = OfficeEvents
    | union EnrichedEvents
    | summarize arg_min(TimeGenerated, *) by UserId, ClientIP;
// Final Output
CombinedEvents
    | project TimeGenerated, UserId, ClientIP, AccountName, AccountUPNSuffix, FileSample, TransferCount, fileslist
    | order by TimeGenerated desc
relevantTechniques:
- T1020
incidentConfiguration:
  createIncident: true
  groupingConfiguration:
    lookbackDuration: PT5H
    enabled: true
    reopenClosedIncident: false
    matchingMethod: Selected
    groupByEntities:
    - Account
name: GSA Enriched Office 365 - Sharepoint File Transfer Above Threshold
requiredDataConnectors:
- dataTypes:
  - EnrichedMicrosoft365AuditLogs
  connectorId: AzureActiveDirectory
- dataTypes:
  - OfficeActivity (SharePoint)
  connectorId: Office365
entityMappings:
- fieldMappings:
  - identifier: FullName
    columnName: UserId
  - identifier: Name
    columnName: AccountName
  - identifier: UPNSuffix
    columnName: AccountUPNSuffix
  entityType: Account
- fieldMappings:
  - identifier: Address
    columnName: ClientIP
  entityType: IP
- fieldMappings:
  - identifier: Name
    columnName: FileSample
  entityType: File
triggerThreshold: 0
id: 30375d00-68cc-4f95-b89a-68064d566358
tactics:
- Exfiltration
version: 1.0.6
customDetails:
  FilesList: fileslist
  TransferCount: TransferCount
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Global Secure Access/Analytic Rules/Office 365 - sharepoint_file_transfer_above_threshold.yaml
queryPeriod: 15m
kind: Scheduled
queryFrequency: 15m
severity: Medium
status: Available
description: |
  'Identifies Office365 SharePoint file transfers above a certain threshold in a 15-minute time period.
  Please note that entity mapping for arrays is not supported, so when there is a single value in an array, we will pull that value from the array as a single string to populate the entity to support entity mapping features within Sentinel. Additionally, if the array is multivalued, we will input a string to indicate this with a unique hash so that matching will not occur.'  
query: |
  let threshold = 5000;
  // EnrichedMicrosoft365AuditLogs Query
  let EnrichedEvents = EnrichedMicrosoft365AuditLogs
      | where Workload has_any("SharePoint", "OneDrive")
      | where Operation has_any("FileDownloaded", "FileSyncDownloadedFull", "FileSyncUploadedFull", "FileUploaded")
      | extend ClientIP = ClientIp
      | summarize TransferCount = dcount(ObjectId), fileslist = make_set(ObjectId, 10000)
          by UserId, ClientIP, bin(TimeGenerated, 15m)
      | where TransferCount >= threshold
      | extend FileSample = iff(array_length(fileslist) == 1, tostring(fileslist[0]),
               strcat("SeeFilesListField_", tostring(hash(tostring(fileslist)))))
      | extend AccountName = tostring(split(UserId, "@")[0]),
               AccountUPNSuffix = tostring(split(UserId, "@")[1]);
  // OfficeActivity Query
  let OfficeEvents = OfficeActivity
      | where EventSource == "SharePoint"
      | where OfficeWorkload has_any("SharePoint", "OneDrive")
      | where Operation has_any("FileDownloaded", "FileSyncDownloadedFull", "FileSyncUploadedFull", "FileUploaded")
      | summarize TransferCount = dcount(OfficeObjectId), fileslist = make_set(OfficeObjectId, 10000)
          by UserId, ClientIP, bin(TimeGenerated, 15m)
      | where TransferCount >= threshold
      | extend FileSample = iff(array_length(fileslist) == 1, tostring(fileslist[0]),
               strcat("SeeFilesListField_", tostring(hash(tostring(fileslist)))))
      | extend AccountName = tostring(split(UserId, "@")[0]),
               AccountUPNSuffix = tostring(split(UserId, "@")[1]);
  // Combine Office and Enriched Logs
  let CombinedEvents = OfficeEvents
      | union EnrichedEvents
      | summarize arg_min(TimeGenerated, *) by UserId, ClientIP;
  // Final Output
  CombinedEvents
      | project TimeGenerated, UserId, ClientIP, AccountName, AccountUPNSuffix, FileSample, TransferCount, fileslist
      | order by TimeGenerated desc  
triggerOperator: gt
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/30375d00-68cc-4f95-b89a-68064d566358')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/30375d00-68cc-4f95-b89a-68064d566358')]",
      "properties": {
        "alertRuleTemplateName": "30375d00-68cc-4f95-b89a-68064d566358",
        "customDetails": {
          "FilesList": "fileslist",
          "TransferCount": "TransferCount"
        },
        "description": "'Identifies Office365 SharePoint file transfers above a certain threshold in a 15-minute time period.\nPlease note that entity mapping for arrays is not supported, so when there is a single value in an array, we will pull that value from the array as a single string to populate the entity to support entity mapping features within Sentinel. Additionally, if the array is multivalued, we will input a string to indicate this with a unique hash so that matching will not occur.'\n",
        "displayName": "GSA Enriched Office 365 - Sharepoint File Transfer Above Threshold",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "UserId",
                "identifier": "FullName"
              },
              {
                "columnName": "AccountName",
                "identifier": "Name"
              },
              {
                "columnName": "AccountUPNSuffix",
                "identifier": "UPNSuffix"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "ClientIP",
                "identifier": "Address"
              }
            ]
          },
          {
            "entityType": "File",
            "fieldMappings": [
              {
                "columnName": "FileSample",
                "identifier": "Name"
              }
            ]
          }
        ],
        "incidentConfiguration": {
          "createIncident": true,
          "groupingConfiguration": {
            "enabled": true,
            "groupByEntities": [
              "Account"
            ],
            "lookbackDuration": "PT5H",
            "matchingMethod": "Selected",
            "reopenClosedIncident": false
          }
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Global Secure Access/Analytic Rules/Office 365 - sharepoint_file_transfer_above_threshold.yaml",
        "query": "let threshold = 5000;\n// EnrichedMicrosoft365AuditLogs Query\nlet EnrichedEvents = EnrichedMicrosoft365AuditLogs\n    | where Workload has_any(\"SharePoint\", \"OneDrive\")\n    | where Operation has_any(\"FileDownloaded\", \"FileSyncDownloadedFull\", \"FileSyncUploadedFull\", \"FileUploaded\")\n    | extend ClientIP = ClientIp\n    | summarize TransferCount = dcount(ObjectId), fileslist = make_set(ObjectId, 10000)\n        by UserId, ClientIP, bin(TimeGenerated, 15m)\n    | where TransferCount >= threshold\n    | extend FileSample = iff(array_length(fileslist) == 1, tostring(fileslist[0]),\n             strcat(\"SeeFilesListField_\", tostring(hash(tostring(fileslist)))))\n    | extend AccountName = tostring(split(UserId, \"@\")[0]),\n             AccountUPNSuffix = tostring(split(UserId, \"@\")[1]);\n// OfficeActivity Query\nlet OfficeEvents = OfficeActivity\n    | where EventSource == \"SharePoint\"\n    | where OfficeWorkload has_any(\"SharePoint\", \"OneDrive\")\n    | where Operation has_any(\"FileDownloaded\", \"FileSyncDownloadedFull\", \"FileSyncUploadedFull\", \"FileUploaded\")\n    | summarize TransferCount = dcount(OfficeObjectId), fileslist = make_set(OfficeObjectId, 10000)\n        by UserId, ClientIP, bin(TimeGenerated, 15m)\n    | where TransferCount >= threshold\n    | extend FileSample = iff(array_length(fileslist) == 1, tostring(fileslist[0]),\n             strcat(\"SeeFilesListField_\", tostring(hash(tostring(fileslist)))))\n    | extend AccountName = tostring(split(UserId, \"@\")[0]),\n             AccountUPNSuffix = tostring(split(UserId, \"@\")[1]);\n// Combine Office and Enriched Logs\nlet CombinedEvents = OfficeEvents\n    | union EnrichedEvents\n    | summarize arg_min(TimeGenerated, *) by UserId, ClientIP;\n// Final Output\nCombinedEvents\n    | project TimeGenerated, UserId, ClientIP, AccountName, AccountUPNSuffix, FileSample, TransferCount, fileslist\n    | order by TimeGenerated desc\n",
        "queryFrequency": "PT15M",
        "queryPeriod": "PT15M",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Exfiltration"
        ],
        "techniques": [
          "T1020"
        ],
        "templateVersion": "1.0.6",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}