I'm currently building a detection that needs to extract data from one field and pass it to a variable to match events for that particular user over 30 days and add the user to the outcome section.
Essentially this rule should look for LDAP users who have not received vault temp credits over the last 30 days.
here's the error message
semantic analysis: match variable event is not assigned to an event field
rule auth0_anomaly_ldap_vault_creds {
events:
// Retrieve all Auth0 events regarding the issuance of vault temp creds for ldap users
$event.metadata.log_type = "AUTH_ZERO"
$event.principal.hostname = /^Temp Vault Client auth=ldap/
// Extract LDAP user
$ldap_user_extract = re.regex($event.principal.hostname, "auth=([^ ]+) expires")
$ldap_user = $ldap_user_extract
match:
$ldap_user over 30d
outcome:
// Alert Meta
$alert_severity = array_distinct("HIGH")
// Alert Details
$principal_ip = array_distinct($event.principal.ip)
$auth0_event_type = array_distinct($event.metadata.product_event_type)
$auth0_signup_email = array_distinct($event.additional.fields["email"])
$auth0_user_id = array_distinct($event.target.user.userid)
$auth0_user_full_name = array_distinct($event.principal.user.userid)
$user = array_distinct($ldap_user)
$network_org_name = array_distinct($event.principal.ip_geo_artifact.network.organization_name)
$source_state = array_distinct($event.principal.location.state)
$source_country = array_distinct($event.principal.location.country_or_region)
$user_agent = array_distinct($event.network.http.user_agent)
$referrer = array_distinct($event.network.http.referral_url)
$principal_ip_asn = array_distinct($event.principal.ip_geo_artifact.network.asn)
// Alert Risk Score
$risk_score = max(
// Base score for High Severity
75 +
// Increase Risk if SRE, CloudOps, or IT Support
if ( $event.principal.user.department = "IT Technical Operations", 20) +
if ( $event.principal.user.department = "IT Support", 10) +
// Increase Risk in cases of elevated Risk_Level (Okta Logs)
if ( $event.security_result.outcomes["Risk_Level"] = "MEDIUM" nocase, 10) +
if ( $event.security_result.outcomes["Risk_Level"] = "HIGH" nocase, 20) +
// Increase Risk if an Identity Threat is detected (Okta Logs)
if ( $event.security_result.outcomes["threatSuspected"] = "true" nocase, 10) +
// Increase Risk if user is an Admin or Delegated Admin
if ( $event.target.user.attribute.labels["is_admin"] = "true", 10) +
if ( $event.target.user.attribute.labels["is_delegated_admin"] = "true", 10)
)
condition:
$event
}

