-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into ben/check-packs-action/fix-comments
- Loading branch information
Showing
11 changed files
with
1,607 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
queries/okta_queries/okta_52_char_username_threat_hunt.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
AnalysisType: saved_query | ||
QueryName: "Okta Username Above 52 Characters Security Advisory" | ||
Description: > | ||
On October 30, 2024, a vulnerability was internally identified in generating the cache key for AD/LDAP DelAuth. The Bcrypt algorithm was used to generate the cache key where we hash a combined string of userId + username + password. Under a specific set of conditions, listed below, this could allow users to authenticate by providing the username with the stored cache key of a previous successful authentication. | ||
Customers meeting the pre-conditions should investigate their Okta System Log for unexpected authentications from usernames greater than 52 characters between the period of July 23rd, 2024 to October 30th, 2024. | ||
https://trust.okta.com/security-advisories/okta-ad-ldap-delegated-authentication-username/ | ||
Query: | | ||
SELECT | ||
p_event_time as p_timeline, | ||
* | ||
FROM | ||
panther_logs.public.okta_systemlog | ||
WHERE | ||
p_occurs_between('2024-07-22 00:00:00Z','2024-11-01 00:00:00Z') | ||
AND actor:type = 'User' | ||
AND eventType = 'user.session.start' | ||
AND outcome:result = 'SUCCESS' | ||
AND LEN(actor:alternateId) >= 52 | ||
ORDER by p_event_time ASC NULLS LAST | ||
LIMIT 100 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import panther_event_type_helpers as event_type | ||
import pycountry | ||
|
||
# Configuration Required: | ||
# Configure the below list of rogue states according to your needs/experience | ||
# Refer to the link below to find the alpha-2 code corresponding to your country | ||
# https://www.iban.com/country-codes | ||
ROGUE_STATES = {"CN", "IR", "RU"} | ||
|
||
|
||
def rule(event): | ||
# Only evaluate successful logins | ||
if event.udm("event_type") != event_type.SUCCESSFUL_LOGIN: | ||
return False | ||
|
||
# Ignore events with no IP data | ||
if not event.udm("source_ip"): | ||
return False | ||
|
||
# Get contry of request origin and compare to identified rogue state list | ||
country = get_country(event) | ||
if country is None: | ||
# We weren't able to find a matching country, therefore we don't have enough information | ||
# to alert on | ||
return False | ||
# Wrapping in 'bool' so that we can use mocking for 'is_rogue_state' | ||
return bool(is_rogue_state(country.alpha_2)) | ||
|
||
|
||
def title(event): | ||
log_type = event.get("p_log_type") | ||
country = get_country(event) | ||
account_name = get_account_name(event) | ||
return f"{log_type}: Sign-In for account {account_name} from Rogue State '{country.name}'" | ||
|
||
|
||
def alert_context(event): | ||
return { | ||
"source_ip": event.udm("source_ip"), | ||
"country": get_country(event).name, | ||
"account_name": get_account_name(event), | ||
} | ||
|
||
|
||
def get_country(event) -> str: | ||
"""Returns the country code from an event's IPinfo data.""" | ||
location_data = event.deep_get("p_enrichment", "ipinfo_location", event.udm_path("source_ip")) | ||
if not location_data: | ||
return None # Ignore event if we have no enrichment to analyze | ||
return pycountry.countries.get(alpha_2=location_data.get("country").upper()) | ||
|
||
|
||
def get_account_name(event) -> str: | ||
"""Returns the account name.""" | ||
if account_name := event.deep_get("p_udm", "user", "email"): | ||
return account_name | ||
if account_name := event.deep_get("p_udm", "user", "name"): | ||
return account_name | ||
if account_name := event.udm("actor_user"): | ||
return account_name | ||
return "UNKNWON ACCOUNT" | ||
|
||
|
||
def is_rogue_state(country_code: str) -> bool: | ||
"""Returns whether the country code provided belongs to an identified rogue state.""" | ||
# This function makes it easy for us to use unit test mocks to ensure altering the ROGUE_STATES | ||
# dict doesn't break our test suite. | ||
return country_code in ROGUE_STATES |
Oops, something went wrong.