Detection rules › Kusto

API - API Scraping

Status
available
Severity
high
Time window
5m
Source
github.com/Azure/Azure-Sentinel

'42Crunch API protection against API scraping'

MITRE ATT&CK coverage

TacticTechniques
Reconnaissance
Collection

Rule body

id: d944d564-b6fa-470d-b5ab-41b341878c5e
name: API - API Scraping
description: |
  '42Crunch API protection against API scraping'
severity: High
requiredDataConnectors:
  - connectorId: 42CrunchAPIProtection
    dataTypes:
      - FortyTwoCrunchAPIProtection
  - connectorId: FortyTwoCrunchAPIProtection
    dataTypes:
      - FortyTwoCrunchAPIProtection
queryFrequency: 5m
queryPeriod: 5m
triggerOperator: gt
triggerThreshold: 0
eventGroupingSettings:
  aggregationKind: SingleAlert
status: Available
tactics:
  - Reconnaissance
  - Collection
relevantTechniques:
  - T1593
  - T1119
query: |
  let firstRec = FortyTwoCrunchAPIProtection
  | where TimeGenerated >= ago(5m) 
  | project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid
  | where UriPath has "/api/properties?page=" and Status == 200;
  let rateLimitCount = (toscalar(firstRec | count));
  let recCount = iff((rateLimitCount > 100), 1, 0);
  firstRec | top recCount by Timestamp desc;
customDetails:
entityMappings:
  - entityType: IP
    fieldMappings:
      - identifier: Address
        columnName: SourceIp
  - entityType: Host
    fieldMappings:
      - identifier: HostName
        columnName: Hostname
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: InstanceName
version: 3.0.1
kind: Scheduled

Stages and Predicates

Parameters

let recCount = iff((rateLimitCount > 100), 1, 0);

let firstRec is inlined into the numbered stages below.

Let binding: rateLimitCount

let rateLimitCount = (toscalar(firstRec | count));

Stages 1 to 4 define let firstRec (the rule's main pipeline source); stage 5 runs on it.

Stage 1: source

FortyTwoCrunchAPIProtection

Stage 2: where

| where TimeGenerated >= ago(5m)

Stage 3: project-away

| project-away NonBlockingMode, SourcePort, DestinationPort, Query, ApiId, RequestHeader, ResponseHeader, Errors, EventType, Uuid

Stage 4: where

| where UriPath has "/api/properties?page=" and Status == 200

Stage 5: top

firstRec
| top recCount by Timestamp desc;

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
Statuseq
  • 200
field:"Status" kind:eq value:"200"
UriPathmatch
  • /api/properties?page= transforms: term
field:"UriPath" kind:match value:"/api/properties?page="