-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kbailey: rule for phished okta session #500
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
holding block for now
…om/panther-labs/panther-analysis into kbailey-okta-stolen-session-cookie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that in the current state, we'll only add the session to the kv_table if there are zero entries for the item already. I also suspect that we should user a counter vs string set to stash the count.
…om/panther-labs/panther-analysis into kbailey-okta-stolen-session-cookie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool 🎉 A few comments but stoked to get this one out!
[prev_ua] = [x for x in PREVIOUS_SESSION if "user_agent:" in x] or ["prev_ua_not_found"] | ||
prev_ua = prev_ua.split("_agent:")[1] | ||
|
||
diff_ratio = SequenceMatcher( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to send this as alert context? It'd be super interesting and helpful for tuning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may also be great to just include this as a helper function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will investigate the helper function. That is a good point.
re: alert context -- It is returned. On line 78 I add the diff ratio to the PREVIOUS_SESSION set (I figured this would be relevant for adjusting the ratio when tuning false positives) and then line 93 appends the previous session info to the default Okta alert context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatted with @arielkr256 about this a bit today -- everything looks good.
Background
This rule detects two different devices using the same Okta session. Using tools like Evilginx2, attackers can phish session cookies, effectively bypassing non-FIDO2 MFA devices. When this occurs, the user and attacker use the same session token. This detection takes advantage of that abnormality. This attack vector has recently become one of the most popular initial access vectors for attackers.
To determine if multiple devices are using the same session, this rule uses two data points, the ASN of the request and a fuzzy string match of the user agents. We implement a fuzzing string match in this situation because it is possible in some instances for a session to persist across a browser upgrade, causing false positives. The sensitivity of the match can be adjusted in the rule.
Changes
Testing