Back
Id1b047dc3-a879-4f99-949b-d1dc867efc83
RulenameAPI - BOLA
Description42Crunch API protection against BOLA
SeverityMedium
TacticsExfiltration
TechniquesT1020
Required data connectors42CrunchAPIProtection
FortyTwoCrunchAPIProtection
KindScheduled
Query frequency5m
Query period5m
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/42Crunch%20API%20Protection/Analytic%20Rules/APIBOLA.yaml
Version3.0.1
Arm template1b047dc3-a879-4f99-949b-d1dc867efc83.json
Deploy To Azure
let loginRec = FortyTwoCrunchAPIProtection
| where TimeGenerated >= ago(5m) 
| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
| where UriPath has "/api/login" and Status == 200;
let ipAddress = toscalar(loginRec
| top 1 by Timestamp desc
| summarize by SourceIp);
let listRec = FortyTwoCrunchAPIProtection
| where TimeGenerated >= ago(5m) 
| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
| where UriPath has "/api/accounts/list" and Status == 200;
let listCnt = (toscalar(listRec | count));
let accountRec = FortyTwoCrunchAPIProtection
| where TimeGenerated >= ago(5m) 
| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
| where SourceIp == ipAddress and UriPath 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
triggerThreshold: 0
queryPeriod: 5m
severity: Medium
query: |
  let loginRec = FortyTwoCrunchAPIProtection
  | where TimeGenerated >= ago(5m) 
  | project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
  | where UriPath has "/api/login" and Status == 200;
  let ipAddress = toscalar(loginRec
  | top 1 by Timestamp desc
  | summarize by SourceIp);
  let listRec = FortyTwoCrunchAPIProtection
  | where TimeGenerated >= ago(5m) 
  | project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
  | where UriPath has "/api/accounts/list" and Status == 200;
  let listCnt = (toscalar(listRec | count));
  let accountRec = FortyTwoCrunchAPIProtection
  | where TimeGenerated >= ago(5m) 
  | project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
  | where SourceIp == ipAddress and UriPath 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
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/42Crunch%20API%20Protection/Analytic%20Rules/APIBOLA.yaml
requiredDataConnectors:
- dataTypes:
  - FortyTwoCrunchAPIProtection
  connectorId: 42CrunchAPIProtection
- dataTypes:
  - FortyTwoCrunchAPIProtection
  connectorId: FortyTwoCrunchAPIProtection
kind: Scheduled
queryFrequency: 5m
id: 1b047dc3-a879-4f99-949b-d1dc867efc83
tactics:
- Exfiltration
relevantTechniques:
- T1020
version: 3.0.1
triggerOperator: gt
eventGroupingSettings:
  aggregationKind: SingleAlert
name: API - BOLA
status: Available
customDetails: 
description: |
  '42Crunch API protection against BOLA'
entityMappings:
- entityType: IP
  fieldMappings:
  - columnName: SourceIp
    identifier: Address
- entityType: Host
  fieldMappings:
  - columnName: Hostname
    identifier: HostName
- entityType: Account
  fieldMappings:
  - columnName: InstanceName
    identifier: FullName
{
  "$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": "SourceIp",
                "identifier": "Address"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "Hostname",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "InstanceName",
                "identifier": "FullName"
              }
            ]
          }
        ],
        "eventGroupingSettings": {
          "aggregationKind": "SingleAlert"
        },
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/42Crunch%20API%20Protection/Analytic%20Rules/APIBOLA.yaml",
        "query": "let loginRec = FortyTwoCrunchAPIProtection\n| where TimeGenerated >= ago(5m) \n| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid\n| where UriPath has \"/api/login\" and Status == 200;\nlet ipAddress = toscalar(loginRec\n| top 1 by Timestamp desc\n| summarize by SourceIp);\nlet listRec = FortyTwoCrunchAPIProtection\n| where TimeGenerated >= ago(5m) \n| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid\n| where UriPath has \"/api/accounts/list\" and Status == 200;\nlet listCnt = (toscalar(listRec | count));\nlet accountRec = FortyTwoCrunchAPIProtection\n| where TimeGenerated >= ago(5m) \n| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid\n| where SourceIp == ipAddress and UriPath 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": "3.0.1",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}