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

API - BOLA

Back
Id1b047dc3-a879-4f99-949b-d1dc867efc83
RulenameAPI - BOLA
Description42Crunch API protection against BOLA
SeverityMedium
TacticsExfiltration
TechniquesT1020
Required data connectors42CrunchAPIProtection
KindScheduled
Query frequency5m
Query period5m
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/42Crunch API Protection/Analytic Rules/APIBOLA.yaml
Version1.0.1
Arm template1b047dc3-a879-4f99-949b-d1dc867efc83.json
Deploy To Azure
let loginRec = apifirewall_log_1_CL
| where TimeGenerated >= ago(5m) 
| project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g
| where Instance_Name_s == "Instance_5" and URI_Path_s has "/api/login" and Status_d == 200;
let ipAddress = toscalar(loginRec
| top 1 by Timestamp_t desc
| summarize by Source_IP_s);
let listRec = apifirewall_log_1_CL
| where TimeGenerated >= ago(5m) 
| project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g
| where Instance_Name_s == "Instance_5" and URI_Path_s has "/api/accounts/list" and Status_d == 200;
let listCnt = (toscalar(listRec | count));
let accountRec = apifirewall_log_1_CL
| where TimeGenerated >= ago(5m) 
| project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g
| where Instance_Name_s == "Instance_5" and Source_IP_s == ipAddress and URI_Path_s matches regex "/api/accounts/\\d{6}$";
let accountCnt = (toscalar(accountRec | count));
let recCount = iff((toscalar(listRec | count) == 0) and (accountCnt > 5), accountCnt, 0);
accountRec | take recCount
name: API - BOLA
version: 1.0.1
severity: Medium
queryFrequency: 5m
triggerOperator: gt
customDetails: 
relevantTechniques:
- T1020
status: Available
description: |
    '42Crunch API protection against BOLA'
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/42Crunch API Protection/Analytic Rules/APIBOLA.yaml
requiredDataConnectors:
- connectorId: 42CrunchAPIProtection
  dataTypes:
  - apifirewall_log_1_CL
entityMappings:
- fieldMappings:
  - identifier: Address
    columnName: Source_IP_s
  entityType: IP
- fieldMappings:
  - identifier: HostName
    columnName: Hostname_s
  entityType: Host
- fieldMappings:
  - identifier: FullName
    columnName: Instance_Name_s
  entityType: Account
eventGroupingSettings:
  aggregationKind: SingleAlert
queryPeriod: 5m
tactics:
- Exfiltration
query: |
  let loginRec = apifirewall_log_1_CL
  | where TimeGenerated >= ago(5m) 
  | project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g
  | where Instance_Name_s == "Instance_5" and URI_Path_s has "/api/login" and Status_d == 200;
  let ipAddress = toscalar(loginRec
  | top 1 by Timestamp_t desc
  | summarize by Source_IP_s);
  let listRec = apifirewall_log_1_CL
  | where TimeGenerated >= ago(5m) 
  | project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g
  | where Instance_Name_s == "Instance_5" and URI_Path_s has "/api/accounts/list" and Status_d == 200;
  let listCnt = (toscalar(listRec | count));
  let accountRec = apifirewall_log_1_CL
  | where TimeGenerated >= ago(5m) 
  | project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g
  | where Instance_Name_s == "Instance_5" and Source_IP_s == ipAddress and URI_Path_s matches regex "/api/accounts/\\d{6}$";
  let accountCnt = (toscalar(accountRec | count));
  let recCount = iff((toscalar(listRec | count) == 0) and (accountCnt > 5), accountCnt, 0);
  accountRec | take recCount  
kind: Scheduled
triggerThreshold: 0
id: 1b047dc3-a879-4f99-949b-d1dc867efc83
{
  "$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/1b047dc3-a879-4f99-949b-d1dc867efc83')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/1b047dc3-a879-4f99-949b-d1dc867efc83')]",
      "properties": {
        "alertRuleTemplateName": "1b047dc3-a879-4f99-949b-d1dc867efc83",
        "customDetails": null,
        "description": "'42Crunch API protection against BOLA'\n",
        "displayName": "API - BOLA",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "columnName": "Source_IP_s",
                "identifier": "Address"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "Hostname_s",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "Instance_Name_s",
                "identifier": "FullName"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "SingleAlert"
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/42Crunch API Protection/Analytic Rules/APIBOLA.yaml",
        "query": "let loginRec = apifirewall_log_1_CL\n| where TimeGenerated >= ago(5m) \n| project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g\n| where Instance_Name_s == \"Instance_5\" and URI_Path_s has \"/api/login\" and Status_d == 200;\nlet ipAddress = toscalar(loginRec\n| top 1 by Timestamp_t desc\n| summarize by Source_IP_s);\nlet listRec = apifirewall_log_1_CL\n| where TimeGenerated >= ago(5m) \n| project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g\n| where Instance_Name_s == \"Instance_5\" and URI_Path_s has \"/api/accounts/list\" and Status_d == 200;\nlet listCnt = (toscalar(listRec | count));\nlet accountRec = apifirewall_log_1_CL\n| where TimeGenerated >= ago(5m) \n| project-away Non_blocking_mode_b, Source_Port_d, Destination_Port_d, Query_s, API_ID_g, Request_Header_s, Response_Header_s, Errors_s, Type, UUID_g\n| where Instance_Name_s == \"Instance_5\" and Source_IP_s == ipAddress and URI_Path_s matches regex \"/api/accounts/\\\\d{6}$\";\nlet accountCnt = (toscalar(accountRec | count));\nlet recCount = iff((toscalar(listRec | count) == 0) and (accountCnt > 5), accountCnt, 0);\naccountRec | take recCount\n",
        "queryFrequency": "PT5M",
        "queryPeriod": "PT5M",
        "severity": "Medium",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Exfiltration"
        ],
        "techniques": [
          "T1020"
        ],
        "templateVersion": "1.0.1",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}