Detection rules › Kusto
Device Registration from Malicious IP
This query identifies Device Registration from IP addresses identified as malicious by Okta ThreatInsight.
MITRE ATT&CK coverage
| Tactic | Techniques |
|---|---|
| Persistence | T1098 Account Manipulation |
Event coverage
Rules detecting the same action
Other rules on this platform that filter on the same API call or operation.
- Okta Security Threat Detected (Sigma)
- Okta ThreatInsight Login Failure With High Unknown Users (YARA-L)
- Okta ThreatInsight Suspected Bruteforce Attack (YARA-L)
- Okta ThreatInsight Suspected Password Spray Attack (YARA-L)
- Okta ThreatInsight Targeted Bruteforce Attack (YARA-L)
- Okta ThreatInsight Threat Detected (Splunk)
- Okta ThreatInsight Threat Suspected Promotion (Elastic)
Rule body kusto
id: e36c6bd6-f86a-4282-93a5-b4a1b48dd849
name: Device Registration from Malicious IP
description: |
'This query identifies Device Registration from IP addresses identified as malicious by Okta ThreatInsight.'
severity: High
status: Available
requiredDataConnectors:
- connectorId: OktaSSO
dataTypes:
- Okta_CL
- connectorId: OktaSSOv2
dataTypes:
- OktaSSO
queryFrequency: 1h
queryPeriod: 1h
triggerOperator: gt
triggerThreshold: 0
tactics:
- Persistence
relevantTechniques:
- T1098
query: |
let Events = dynamic(["device.enrollment.create"]);
let ThreatInsightOperations = dynamic(["security.threat.detected", "security.attack.start", "security.attack.end" ]);
let DeviceRegistrations = OktaSSO
| where eventType_s in (Events)
| where outcome_result_s == "SUCCESS"
| extend oktaDeviceId_ = tostring(parse_json(tostring(parse_json(target_s)[0].detailEntry)).oktaDeviceId), NewDevice_osPlatform = tostring(parse_json(tostring(parse_json(target_s)[0].detailEntry)).osPlatform), NewDevice_osVersion = tostring(parse_json(tostring(parse_json(target_s)[0].detailEntry)).osVersion), displayName_ = tostring(parse_json(target_s)[0].displayName)
| extend Location = strcat(client_geographicalContext_city_s, " | ", client_geographicalContext_state_s," | ", client_geographicalContext_country_s)
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by actor_alternateId_s, actor_displayName_s, client_userAgent_os_s, client_ipAddress_s, displayMessage_s, outcome_result_s,
outcome_reason_s, column_ifexists('debugContext_debugData_logOnlySecurityData_s', ""), column_ifexists('debugContext_debugData_threatSuspected_s',""), client_userAgent_rawUserAgent_s,client_userAgent_browser_s, severity_s, NewDevice_osPlatform, NewDevice_osVersion, eventType_s, Location ;
let ThreatInsightEvents = OktaSSO
| where eventType_s in (ThreatInsightOperations)
| extend SuspiciousIP = actor_displayName_s
| project TimeGenerated, column_ifexists('debugContext_debugData_threatDetections_s', ""), client_userAgent_rawUserAgent_s, severity_s, outcome_result_s, eventType_s, displayMessage_s, SuspiciousIP, transaction_id_s;
DeviceRegistrations
| join kind=inner (ThreatInsightEvents) on $left.client_ipAddress_s == $right.SuspiciousIP
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: actor_alternateId_s
- identifier: DisplayName
columnName: actor_displayName_s
- entityType: IP
fieldMappings:
- identifier: Address
columnName: client_ipAddress_s
version: 1.1.1
kind: Scheduled
Stages and Predicates
Parameters
let Events = dynamic(["device.enrollment.create"]);
let ThreatInsightOperations = dynamic(["security.threat.detected", "security.attack.start", "security.attack.end" ]);
Let binding: ThreatInsightEvents
let ThreatInsightEvents = OktaSSO
| where eventType_s in (ThreatInsightOperations)
| extend SuspiciousIP = actor_displayName_s
| project TimeGenerated, column_ifexists('debugContext_debugData_threatDetections_s', ""), client_userAgent_rawUserAgent_s, severity_s, outcome_result_s, eventType_s, displayMessage_s, SuspiciousIP, transaction_id_s;
Derived from ThreatInsightOperations.
The stages below define let DeviceRegistrations (the rule's main pipeline source).
Stage 1: source
OktaSSO
Stage 2: where
| where eventType_s in (Events)
Stage 3: where
| where outcome_result_s == "SUCCESS"
Stage 4: extend
| extend oktaDeviceId_ = tostring(parse_json(tostring(parse_json(target_s)[0].detailEntry)).oktaDeviceId), NewDevice_osPlatform = tostring(parse_json(tostring(parse_json(target_s)[0].detailEntry)).osPlatform), NewDevice_osVersion = tostring(parse_json(tostring(parse_json(target_s)[0].detailEntry)).osVersion), displayName_ = tostring(parse_json(target_s)[0].displayName)
Stage 5: extend
| extend Location = strcat(client_geographicalContext_city_s, " | ", client_geographicalContext_state_s," | ", client_geographicalContext_country_s)
Stage 6: summarize
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by actor_alternateId_s, actor_displayName_s, client_userAgent_os_s, client_ipAddress_s, displayMessage_s, outcome_result_s,
outcome_reason_s, column_ifexists('debugContext_debugData_logOnlySecurityData_s', ""), column_ifexists('debugContext_debugData_threatSuspected_s',""), client_userAgent_rawUserAgent_s,client_userAgent_browser_s, severity_s, NewDevice_osPlatform, NewDevice_osVersion, eventType_s, Location
The stages below run on DeviceRegistrations (the outer pipeline).
Stage 7: join
DeviceRegistrations
| join kind=inner (ThreatInsightEvents) on $left.client_ipAddress_s == $right.SuspiciousIP
Indicators
Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.
| Field | Kind | Values |
|---|---|---|
eventType_s | in |
|
outcome_result_s | eq |
|
Output fields
Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.
| Field | Source |
|---|---|
EndTime | summarize |
Location | summarize |
NewDevice_osPlatform | summarize |
NewDevice_osVersion | summarize |
StartTime | summarize |
actor_alternateId_s | summarize |
actor_displayName_s | summarize |
client_ipAddress_s | summarize |
client_userAgent_browser_s | summarize |
client_userAgent_os_s | summarize |
client_userAgent_rawUserAgent_s | summarize |
displayMessage_s | summarize |
eventType_s | summarize |
outcome_reason_s | summarize |
outcome_result_s | summarize |
severity_s | summarize |