Default Cypher queries for the OktaHound extension
The following custom Cypher queries can be imported into BloodHound to enhance visibility.
Each query is defined in a JSON file located in the Queries directory of the OktaHound repository.
This file is automatically generated from the JSON query files
that are bundled with the OktaHound collector.
Lists Okta agents, their associated agent pools, and the AD servers hosting each agent.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_AgentPool)<-[:Okta_AgentMemberOf|Okta_HostsAgent*1..2]-(:Okta_Agent:Computer)RETURN pLIMIT 1000
This query can be imported into BloodHound from the ad-agents.json file.
List all devices, their owners, and any mobile admins.
MATCH p = (:Okta_Device)-[:Okta_DeviceOf]->(:Okta_User)OPTIONAL MATCH q = (:Okta_User:Okta_Group:Okta_Application)-[:Okta_MobileAdmin]->(:Okta_Device)RETURN p,qLIMIT 1000
This query can be imported into BloodHound from the devices.json file.
Identity Provider Assignments - Direct Privileged Access
Identity providers associated with users or groups that hold direct privileged role assignments in Okta.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_IdentityProvider)-[:Okta_IdentityProviderFor|Okta_IdpGroupAssignment]->(:Okta_User:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Identity providers associated with users who hold privileged role assignments through group membership in Okta.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_IdentityProvider)-[:Okta_IdentityProviderFor]->(:Okta_User)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Lists all identity providers and the users and groups they are associated with, including per-user trust relationships and automatic group assignments.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_IdentityProvider)-[:Okta_IdentityProviderFor|Okta_IdpGroupAssignment]->(:Okta_User:Okta_Group)RETURN pLIMIT 1000
Lists all org-to-org trust relationships including inbound and outbound SSO federation, Secure Web Authentication (SWA), and Kerberos SSO relationships between Okta applications and supported external organizations or tenants.
MATCH p = (:Okta_Application:Okta_IdentityProvider)-[:Okta_InboundOrgSSO|Okta_OutboundOrgSSO|Okta_OrgSWA|Okta_KerberosSSO]-()RETURN pLIMIT 1000
Lists permissions to reset passwords and MFA factors.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_User:Okta_Group:Okta_Application)-[:Okta_ResetPassword|Okta_ResetFactors|Okta_HelpDeskAdmin|Okta_OrgAdmin|Okta_GroupAdmin]->(:Okta_User)RETURN pLIMIT 1000
Finds active JWKs or client secrets older than 365 days on applications that have role assignments.
MATCH p = (s:Okta_JWK:Okta_ClientSecret)-[:Okta_KeyOf|Okta_SecretOf]->(:Okta_Application)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE s.status = "ACTIVE" AND datetime(s.created) <= datetime() - duration("P365D")RETURN pLIMIT 1000
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_Application)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Synced Principals with Privileged Access (Direct) - Hybrid Edges
Users, groups, and applications with inbound hybrid relationships (sync, SSO, or AD agent) that hold privileged role assignments in Okta.
MATCH p = ()-[:Okta_UserSync|Okta_MembershipSync|Okta_InboundSSO|Okta_HostsAgent]->(:Okta_User:Okta_Group:Okta_Application)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Synced Principals with Privileged Access (Indirect) - Hybrid Edges
Users and applications with inbound hybrid relationships (sync, SSO, or AD agent) that hold privileged role assignments through group membership in Okta.
MATCH p = ()-[:Okta_UserSync|Okta_InboundSSO|Okta_HostsAgent]->(:Okta_User:Okta_Application)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Synced Principals with Privileged Access (Direct) - Okta Edges
Users and groups synchronized from external sources that have privileged role assignments.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_Application:Okta_IdentityProvider)-[:Okta_UserPull|Okta_GroupPull|Okta_IdentityProviderFor|Okta_IdpGroupAssignment]->(:Okta)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Synced Principals with Privileged Access (Indirect) - Okta Edges
Users synchronized from external sources that hold privileged role assignments through group membership in Okta.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_Application:Okta_IdentityProvider)-[:Okta_UserPull|Okta_IdentityProviderFor]->(:Okta_User)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
Users who do not have multi-factor authentication enabled and hold privileged role assignments through group membership.
MATCH p = (u:Okta_User)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.authenticationFactors = 0RETURN pLIMIT 1000
Finds users whose last password change was more than a year ago and directly hold privileged role assignments.
MATCH p = (u:Okta_User)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.passwordChanged IS NOT NULL AND datetime(u.passwordChanged) <= datetime() - duration("P365D")RETURN pLIMIT 1000
Finds users whose last password change was more than a year ago and hold privileged role assignments through group membership.
MATCH p = (u:Okta_User)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.passwordChanged IS NOT NULL AND datetime(u.passwordChanged) <= datetime() - duration("P365D")RETURN pLIMIT 1000
Finds users whose status is not ACTIVE and directly hold privileged role assignments, including deactivated, suspended, or provisioning-incomplete accounts.
MATCH p = (u:Okta_User)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.status <> "ACTIVE"RETURN pLIMIT 1000
Privileged Users with Non-Active Status (Indirect)
Finds users whose status is not ACTIVE and hold privileged role assignments through group membership, including deactivated, suspended, or provisioning-incomplete accounts.
MATCH p = (u:Okta_User)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.status <> "ACTIVE"RETURN pLIMIT 1000
Searches for client secrets associated with privileged applications that are readable to non-Super Admins.
MATCH p = (:Okta)-[:Okta_ReadClientSecret|Okta_MemberOf*1..2]->(:Okta_ClientSecret)-[:Okta_SecretOf]->(:Okta_Application)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)RETURN pLIMIT 1000
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_User:Okta_Group:Okta_Application)-[:Okta_AppAdmin|Okta_ManageApp]->(:Okta_Application:Okta_ApiServiceIntegration)RETURN pLIMIT 1000
List all Group Administrators and Group Membership Administrators.
MATCH p = (:Okta_Organization)-[:Okta_Contains]->(:Okta_User:Okta_Group:Okta_Application)-[:Okta_GroupAdmin|Okta_GroupMembershipAdmin|Okta_OrgAdmin]->(:Okta_Group)RETURN pLIMIT 1000
Finds user accounts that have not logged in for at least 180 days and directly hold privileged role assignments.
MATCH p = (u:Okta_User)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.lastLogin IS NULL OR datetime(u.lastLogin) <= datetime() - duration("P180D")RETURN pLIMIT 1000
Finds user accounts that have not logged in for at least 180 days and hold privileged role assignments through group membership.
MATCH p = (u:Okta_User)-[:Okta_MemberOf]->(:Okta_Group)-[:Okta_HasRoleAssignment]->(:Okta_RoleAssignment)-[:Okta_ScopedTo]->(:Okta)WHERE u.lastLogin IS NULL OR datetime(u.lastLogin) <= datetime() - duration("P180D")RETURN pLIMIT 1000