Detection rules › Kusto

OracleDBAudit - User connected to database from new IP

Status
available
Severity
low
Time window
14d
Group by
DstUserName
Source
github.com/Azure/Azure-Sentinel

'Detects when a user connects to database from new IP address.'

MITRE ATT&CK coverage

TacticTechniques
Initial Access

Rule body

id: 39a0995e-f4a9-4869-a0ae-36d6d9049bfd
name: OracleDBAudit - User connected to database from new IP
description: |
  'Detects when a user connects to database from new IP address.'
severity: Low
status: Available
requiredDataConnectors:
  - connectorId: SyslogAma
    datatypes:
      - Syslog
queryFrequency: 1h
queryPeriod: 14d
triggerOperator: gt
triggerThreshold: 0
tactics:
  - InitialAccess
relevantTechniques:
  - T1078
query: |
  let lbtime_d = 14d;
  let lbtime_24h = 24h;
  OracleDatabaseAuditEvent
  | where TimeGenerated between (ago(lbtime_d) .. ago(lbtime_24h))
  | where isnotempty(SrcIpAddr)
  | where isnotempty(DstUserName)
  | summarize knownIPs = make_set(SrcIpAddr) by DstUserName
  | join (OracleDatabaseAuditEvent
        | where isnotempty(SrcIpAddr)
        | where isnotempty(DstUserName)
        | where DbAction =~ 'connect'
        ) on DstUserName
  | where knownIPs !contains SrcIpAddr
  | project DstUserName, SrcIpAddr
  | extend AccountCustomEntity = DstUserName
  | extend IPCustomEntity = SrcIpAddr
entityMappings:
  - entityType: Account
    fieldMappings:
      - identifier: FullName
        columnName: AccountCustomEntity
  - entityType: IP
    fieldMappings:
      - identifier: Address
        columnName: IPCustomEntity
version: 1.0.2
kind: Scheduled

Stages and Predicates

Parameters

let lbtime_d = 14d;
let lbtime_24h = 24h;

Stage 1: source

OracleDatabaseAuditEvent

Stage 2: where

| where TimeGenerated between (ago(lbtime_d) .. ago(lbtime_24h))

Stage 3: where

| where isnotempty(SrcIpAddr)

Stage 4: where

| where isnotempty(DstUserName)

Stage 5: summarize

| summarize knownIPs = make_set(SrcIpAddr) by DstUserName

Stage 6: join

| join (OracleDatabaseAuditEvent
      | where isnotempty(SrcIpAddr)
      | where isnotempty(DstUserName)
      | where DbAction =~ 'connect'
      ) on DstUserName

Stage 7: where

| where knownIPs !contains SrcIpAddr

Stage 8: project

| project DstUserName, SrcIpAddr

Stage 9: extend

| extend AccountCustomEntity = DstUserName

Stage 10: extend

| extend IPCustomEntity = SrcIpAddr

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
DbActioneq
  • connect
field:"DbAction" kind:eq value:"connect"
DstUserNameis_not_null
  • (no value, null check)
field:"DstUserName" kind:is_not_null
SrcIpAddris_not_null
  • (no value, null check)
field:"src_ip" kind:is_not_null
knownIPscross_field_compare
  • SrcIpAddr transforms: op:not_contains
field:"knownIPs" kind:cross_field_compare value:"SrcIpAddr"

Output fields

These fields are emitted when the rule matches.

FieldSource
DstUserNameproject
SrcIpAddrproject
AccountCustomEntityextend
IPCustomEntityextend