Okta Sign-In Events via Third-Party IdP
Detects sign-in events where authentication is carried out via a third-party Identity Provider (IdP).
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2023/11/06"
3integration = ["okta"]
4maturity = "production"
5updated_date = "2024/09/23"
6
7[rule]
8author = ["Elastic"]
9description = "Detects sign-in events where authentication is carried out via a third-party Identity Provider (IdP)."
10from = "now-30m"
11index = ["filebeat-*", "logs-okta*"]
12interval = "15m"
13language = "kuery"
14license = "Elastic License v2"
15name = "Okta Sign-In Events via Third-Party IdP"
16note = """## Triage and analysis
17
18### Investigating Okta Sign-In Events via Third-Party IdP
19
20This rule detects sign-in events where authentication is carried out via a third-party Identity Provider (IdP).
21
22Adversaries may attempt to add an unauthorized IdP to an Okta tenant to gain access to the tenant. Following this action, adversaries may attempt to sign in to the tenant using the unauthorized IdP. This rule detects both the addition of an unauthorized IdP and the subsequent sign-in attempt.
23
24#### Possible investigation steps:
25- Identify the third-party IdP by examining the `okta.authentication_context.issuer.id` field.
26- Once the third-party IdP is identified, determine if this IdP is authorized to be used by the tenant.
27- If the IdP is unauthorized, deactivate it immediately via the Okta console.
28- Identify the actor associated with the IdP creation by examining the `okta.actor.id`, `okta.actor.type`, `okta.actor.alternate_id`, and `okta.actor.display_name` fields in historical data.
29 - The `New Okta Identity Provider (IdP) Added by Admin` rule may be helpful in identifying the actor and the IdP creation event.
30- Determine the client used by the actor. Review the `okta.client.ip`, `okta.client.user_agent.raw_user_agent`, `okta.client.zone`, `okta.client.device`, and `okta.client.id` fields.
31- If the client is a device, check the `okta.device.id`, `okta.device.name`, `okta.device.os_platform`, `okta.device.os_version`, and `okta.device.managed` fields.
32- Review the past activities of the actor involved in this action by checking their previous actions logged in the `okta.target` field.
33- Examine the `okta.request.ip_chain` field to potentially determine if the actor used a proxy or VPN to perform this action.
34- Evaluate the actions that happened just before and after this event in the `okta.event_type` field to help understand the full context of the activity.
35
36### False positive analysis:
37- It might be a false positive if this IdP is authorized to be used by the tenant.
38- This may be a false positive if an authorized third-party IdP is used to sign in to the tenant but failures occurred due to an incorrect configuration.
39
40### Response and remediation:
41- If the IdP is unauthorized, deactivate it immediately via the Okta console.
42- Reset the effected user's password and enforce MFA re-enrollment, if applicable.
43- Mobile device forensics may be required to determine if the user's device is compromised.
44- If the IdP is authorized, ensure that the actor who created it is authorized to do so.
45- If the actor is unauthorized, deactivate their account via the Okta console.
46- If the actor is authorized, ensure that the actor's account is not compromised.
47
48- Block the IP address or device used in the attempts if they appear suspicious, using the data from the `okta.client.ip` and `okta.device.id` fields.
49- Conduct a review of Okta policies and ensure they are in accordance with security best practices.
50- If the deactivated IdP was crucial to the organization, consider adding a new IdP and removing the unauthorized IdP.
51
52## Setup
53
54The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
55"""
56references = [
57 "https://blog.cloudflare.com/cloudflare-investigation-of-the-january-2022-okta-compromise/",
58 "https://www.elastic.co/security-labs/testing-okta-visibility-and-detection-dorothy",
59 "https://sec.okta.com/articles/2023/08/cross-tenant-impersonation-prevention-and-detection",
60 "https://unit42.paloaltonetworks.com/muddled-libra/",
61 "https://www.elastic.co/security-labs/monitoring-okta-threats-with-elastic-security",
62 "https://www.elastic.co/security-labs/starter-guide-to-understanding-okta",
63]
64risk_score = 47
65rule_id = "1ceb05c4-7d25-11ee-9562-f661ea17fbcd"
66severity = "medium"
67tags = ["Use Case: Identity and Access Audit", "Tactic: Initial Access", "Data Source: Okta"]
68timestamp_override = "event.ingested"
69type = "query"
70
71query = '''
72event.dataset:okta.system and okta.debug_context.debug_data.request_uri:/oauth2/v1/authorize/callback and
73 (not okta.authentication_context.issuer.id:Okta and event.action:(user.authentication.auth_via_IDP
74 or user.authentication.auth_via_inbound_SAML
75 or user.authentication.auth_via_mfa
76 or user.authentication.auth_via_social)
77 or event.action:user.session.start) or
78 (event.action:user.authentication.auth_via_IDP and okta.outcome.result:FAILURE
79 and okta.outcome.reason:("A SAML assert with the same ID has already been processed by Okta for a previous request"
80 or "Unable to match transformed username"
81 or "Unable to resolve IdP endpoint"
82 or "Unable to validate SAML Response"
83 or "Unable to validate incoming SAML Assertion"))
84'''
85
86
87[[rule.threat]]
88framework = "MITRE ATT&CK"
89[[rule.threat.technique]]
90id = "T1199"
91name = "Trusted Relationship"
92reference = "https://attack.mitre.org/techniques/T1199/"
93
94
95[rule.threat.tactic]
96id = "TA0001"
97name = "Initial Access"
98reference = "https://attack.mitre.org/tactics/TA0001/"
Triage and analysis
Investigating Okta Sign-In Events via Third-Party IdP
This rule detects sign-in events where authentication is carried out via a third-party Identity Provider (IdP).
Adversaries may attempt to add an unauthorized IdP to an Okta tenant to gain access to the tenant. Following this action, adversaries may attempt to sign in to the tenant using the unauthorized IdP. This rule detects both the addition of an unauthorized IdP and the subsequent sign-in attempt.
Possible investigation steps:
- Identify the third-party IdP by examining the
okta.authentication_context.issuer.id
field. - Once the third-party IdP is identified, determine if this IdP is authorized to be used by the tenant.
- If the IdP is unauthorized, deactivate it immediately via the Okta console.
- Identify the actor associated with the IdP creation by examining the
okta.actor.id
,okta.actor.type
,okta.actor.alternate_id
, andokta.actor.display_name
fields in historical data.- The
New Okta Identity Provider (IdP) Added by Admin
rule may be helpful in identifying the actor and the IdP creation event.
- The
- Determine the client used by the actor. Review the
okta.client.ip
,okta.client.user_agent.raw_user_agent
,okta.client.zone
,okta.client.device
, andokta.client.id
fields. - If the client is a device, check the
okta.device.id
,okta.device.name
,okta.device.os_platform
,okta.device.os_version
, andokta.device.managed
fields. - Review the past activities of the actor involved in this action by checking their previous actions logged in the
okta.target
field. - Examine the
okta.request.ip_chain
field to potentially determine if the actor used a proxy or VPN to perform this action. - Evaluate the actions that happened just before and after this event in the
okta.event_type
field to help understand the full context of the activity.
False positive analysis:
- It might be a false positive if this IdP is authorized to be used by the tenant.
- This may be a false positive if an authorized third-party IdP is used to sign in to the tenant but failures occurred due to an incorrect configuration.
Response and remediation:
-
If the IdP is unauthorized, deactivate it immediately via the Okta console.
-
Reset the effected user's password and enforce MFA re-enrollment, if applicable.
-
Mobile device forensics may be required to determine if the user's device is compromised.
-
If the IdP is authorized, ensure that the actor who created it is authorized to do so.
-
If the actor is unauthorized, deactivate their account via the Okta console.
-
If the actor is authorized, ensure that the actor's account is not compromised.
-
Block the IP address or device used in the attempts if they appear suspicious, using the data from the
okta.client.ip
andokta.device.id
fields. -
Conduct a review of Okta policies and ensure they are in accordance with security best practices.
-
If the deactivated IdP was crucial to the organization, consider adding a new IdP and removing the unauthorized IdP.
Setup
The Okta Fleet integration, Filebeat module, or similarly structured data is required to be compatible with this rule.
References
Related rules
- First Occurrence of Okta User Session Started via Proxy
- New Okta Authentication Behavior Detected
- Okta FastPass Phishing Detection
- Suspicious Activity Reported by Okta User
- Unauthorized Access to an Okta Application