Skip to content

Commit 1b4f2b2

Browse files
author
Evan Gibler
authored
Merge branch 'main' into egibs-exfiltration-rules
2 parents b391332 + 33f8922 commit 1b4f2b2

38 files changed

+78
-24
lines changed

global_helpers/panther_base_helpers.py

+8-18
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from functools import reduce
88
from ipaddress import ip_address, ip_network
99
from typing import Any, List, Optional, Sequence, Union
10+
from panther_config import config
1011

1112
# # # # # # # # # # # # # #
1213
# Exceptions #
@@ -35,47 +36,36 @@ def in_pci_scope_tags(resource):
3536
return resource["Tags"].get(CDE_TAG_KEY) == CDE_TAG_VALUE
3637

3738

39+
PCI_NETWORKS = config.PCI_NETWORKS
3840
# Expects a string in cidr notation (e.g. '10.0.0.0/24') indicating the ip range being checked
3941
# Returns True if any ip in the range is marked as in scope
40-
PCI_NETWORKS = [
41-
ip_network("10.0.0.0/24"),
42-
]
43-
44-
4542
def is_pci_scope_cidr(ip_range):
4643
return any(ip_network(ip_range).overlaps(pci_network) for pci_network in PCI_NETWORKS)
4744

4845

46+
DMZ_NETWORKS = config.DMZ_NETWORKS
4947
# Expects a string in cidr notation (e.g. '10.0.0.0/24') indicating the ip range being checked
5048
# Returns True if any ip in the range is marked as DMZ space.
51-
DMZ_NETWORKS = [
52-
ip_network("10.1.0.0/24"),
53-
ip_network("100.1.0.0/24"),
54-
]
55-
56-
5749
def is_dmz_cidr(ip_range):
5850
"""This function determines whether a given IP range is within the defined DMZ IP range."""
5951
return any(ip_network(ip_range).overlaps(dmz_network) for dmz_network in DMZ_NETWORKS)
6052

6153

62-
DMZ_TAG_KEY = "environment"
63-
DMZ_TAG_VALUE = "dmz"
64-
65-
6654
# Defaults to False to assume something is not a DMZ if it is not tagged
67-
def is_dmz_tags(resource):
55+
def is_dmz_tags(resource, dmz_tags):
6856
"""This function determines whether a given resource is tagged as existing in a DMZ."""
6957
if resource["Tags"] is None:
7058
return False
71-
return resource["Tags"].get(DMZ_TAG_KEY) == DMZ_TAG_VALUE
59+
for key, value in dmz_tags:
60+
if resource["Tags"].get(key) == value:
61+
return True
62+
return False
7263

7364

7465
# Function variables here so that implementation details of these functions can be changed without
7566
# having to rename the function in all locations its used, or having an outdated name on the actual
7667
# function being used, etc.
7768
IN_PCI_SCOPE = in_pci_scope_tags
78-
IS_DMZ = is_dmz_tags
7969

8070
# # # # # # # # # # # # # #
8171
# GSuite Helpers #

global_helpers/panther_config_defaults.py

+14
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,17 @@
1313
MS_EXCHANGE_ALLOWED_FORWARDING_DESTINATION_DOMAINS = ORGANIZATION_DOMAINS
1414
MS_EXCHANGE_ALLOWED_FORWARDING_DESTINATION_EMAILS = ["postmaster@" + ORGANIZATION_DOMAINS[0]]
1515
TELEPORT_ORGANIZATION_DOMAINS = ORGANIZATION_DOMAINS
16+
17+
DMZ_NETWORKS = [
18+
# ip_network("10.1.0.0/24"),
19+
]
20+
21+
DMZ_TAGS = set(
22+
[
23+
("environment", "dmz"),
24+
]
25+
)
26+
27+
PCI_NETWORKS = [
28+
# ip_network("10.0.0.0/24"),
29+
]

policies/aws_vpc_policies/aws_only_dmz_security_groups_publicly_accessible.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import json
12
from ipaddress import ip_network
3+
from unittest.mock import MagicMock
24

3-
from panther_base_helpers import IS_DMZ
5+
from panther_base_helpers import is_dmz_tags
6+
from panther_config import config
7+
8+
DMZ_TAGS = config.DMZ_TAGS
49

510

611
def policy(resource):
@@ -9,7 +14,10 @@ def policy(resource):
914
return True
1015

1116
# DMZ security groups can have inbound permissions from the internet
12-
if IS_DMZ(resource):
17+
global DMZ_TAGS # pylint: disable=global-statement
18+
if isinstance(DMZ_TAGS, MagicMock):
19+
DMZ_TAGS = {tuple(kv) for kv in json.loads(DMZ_TAGS())}
20+
if is_dmz_tags(resource, DMZ_TAGS):
1321
return True
1422

1523
for permission in resource["IpPermissions"]:

policies/aws_vpc_policies/aws_only_dmz_security_groups_publicly_accessible.yml

+9
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Tests:
2525
-
2626
Name: DMZ Security Group Does Allows Public Access
2727
ExpectedResult: true
28+
Mocks:
29+
- objectName: DMZ_TAGS
30+
returnValue: '[["environment", "dmz"]]'
2831
Resource:
2932
{
3033
"Description": "example VPC security group",
@@ -88,6 +91,9 @@ Tests:
8891
-
8992
Name: Non DMZ Security Group Allows Public Access
9093
ExpectedResult: false
94+
Mocks:
95+
- objectName: DMZ_TAGS
96+
returnValue: '[["environment", "dmz"]]'
9197
Resource:
9298
{
9399
"Description": "example VPC security group",
@@ -151,6 +157,9 @@ Tests:
151157
-
152158
Name: Non DMZ Security Group Does Not Allow Public Access
153159
ExpectedResult: true
160+
Mocks:
161+
- objectName: DMZ_TAGS
162+
returnValue: '[["environment", "dmz"]]'
154163
Resource:
155164
{
156165
"Description": "example VPC security group",

rules/okta_rules/okta_app_unauthorized_access_attempt.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DisplayName: "Okta App Unauthorized Access Attempt"
44
Enabled: true
55
Filename: okta_app_unauthorized_access_attempt.py
66
Severity: Low
7+
Reference: https://support.okta.com/help/s/article/App-Sign-on-Error-403-User-attempted-unauthorized-access-to-app?language=en_US
78
Tests:
89
- ExpectedResult: true
910
Log:

rules/okta_rules/okta_geo_improbable_access.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Reports:
1515
Severity: High
1616
Description: A user has subsequent logins from two geographic locations that are very far apart
1717
Runbook: Reach out to the user if needed to validate the activity, then lock the account
18+
Reference: https://www.blinkops.com/blog/how-to-detect-and-remediate-okta-impossible-traveler-alerts
1819
SummaryAttributes:
1920
- eventType
2021
- severity

rules/okta_rules/okta_group_admin_role_assigned.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description: Detect when an admin role is assigned to a group
33
DisplayName: "Okta Group Admin Role Assigned"
44
Enabled: true
55
Filename: okta_group_admin_role_assigned.py
6+
Reference: https://support.okta.com/help/s/article/How-to-assign-Administrator-roles-to-groups?language=en_US#:~:text=Log%20in%20to%20the%20Admin,user%20and%20click%20Save%20changes
67
Severity: High
78
Tests:
89
- ExpectedResult: true

rules/okta_rules/okta_user_account_locked.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description: An Okta user has locked their account.
33
DisplayName: "Okta User Account Locked"
44
Enabled: true
55
Filename: okta_user_account_locked.py
6+
Reference: https://support.okta.com/help/s/article/How-to-Configure-the-Number-of-Failed-Login-Attempts-Before-User-Lockout?language=en_US
67
Severity: Low
78
Tests:
89
- ExpectedResult: true

rules/okta_rules/okta_user_mfa_factor_suspend.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description: Suspend factor or authenticator enrollment method for user.
33
DisplayName: "Okta User MFA Factor Suspend"
44
Enabled: true
55
Filename: okta_user_mfa_factor_suspend.py
6+
Reference: https://help.okta.com/en-us/content/topics/security/mfa/mfa-factors.htm
67
Severity: High
78
Tests:
89
- ExpectedResult: true

rules/okta_rules/okta_user_mfa_reset.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DisplayName: "Okta User MFA Own Reset"
44
RuleID: "Okta.User.MFA.Reset.Single"
55
Enabled: true
66
Filename: okta_user_mfa_reset.py
7+
Reference: https://support.okta.com/help/s/article/How-to-avoid-lockouts-and-reset-your-Multifactor-Authentication-MFA-for-Okta-Admins?language=en_US
78
Severity: Info
89
Tests:
910
-

rules/okta_rules/okta_user_mfa_reset_all.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Description: 'All MFA factors have been reset for a user.'
33
DisplayName: "Okta User MFA Reset All"
44
Enabled: true
55
Filename: okta_user_mfa_reset_all.py
6+
Reference: https://help.okta.com/en-us/content/topics/security/mfa/mfa-reset-users.htm#:~:text=the%20Admin%20Console%3A-,In%20the%20Admin%20Console%2C%20go%20to%20DirectoryPeople.,Selected%20Factors%20or%20Reset%20All
67
Severity: Low
78
Tests:
89
- ExpectedResult: true

rules/osquery_rules/osquery_mac_enable_auto_update.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Description: >
2121
Verifies that MacOS has automatic software updates enabled.
2222
Runbook: >
2323
Enable the auto updates on the host.
24+
Reference: https://support.apple.com/en-gb/guide/mac-help/mchlpx1065/mac
2425
SummaryAttributes:
2526
- name
2627
- action

rules/osquery_rules/osquery_mac_unwanted_chrome_extensions.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Severity: Medium
1717
Description: >
1818
Monitor for chrome extensions that could lead to a credential compromise.
1919
Runbook: Uninstall the unwanted extension
20+
Reference: https://securelist.com/threat-in-your-browser-extensions/107181/
2021
SummaryAttributes:
2122
- action
2223
- hostIdentifier

rules/osquery_rules/osquery_ossec.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Description: >
1717
Checks if any results are returned for the Osquery OSSEC Rootkit pack.
1818
Runbook: >
1919
Verify the presence of the rootkit and re-image the machine.
20+
Reference: https://panther.com/blog/osquery-log-analysis/
2021
SummaryAttributes:
2122
- name
2223
- hostIdentifier

rules/osquery_rules/osquery_outdated.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from panther_base_helpers import deep_get
22

3-
LATEST_VERSION = "4.2.0"
3+
LATEST_VERSION = "5.10.2"
44

55

66
def rule(event):

rules/osquery_rules/osquery_outdated.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ Tags:
99
- Osquery
1010
- Compliance
1111
Severity: Info
12-
Description: Keep track of osquery versions, current is 4.1.2.
12+
Description: Keep track of osquery versions, current is 5.10.2.
1313
Runbook: Update the osquery agent.
14+
Reference: https://www.osquery.io/downloads/official/5.10.2
1415
SummaryAttributes:
1516
- name
1617
- hostIdentifier
@@ -74,7 +75,7 @@ Tests:
7475
"system_time": "12472",
7576
"user_time": "31800",
7677
"uuid": "37821E12-CC8A-5AA3-A90C-FAB28A5BF8F9",
77-
"version": "4.2.0",
78+
"version": "5.10.2",
7879
"watcher": "92"
7980
},
8081
"counter": "255",

rules/osquery_rules/osquery_outdated_macos.yml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Severity: Low
1212
Description: >
1313
Check that all laptops on the corporate environment are on a version of MacOS supported by IT.
1414
Runbook: Update the MacOs version
15+
Reference: https://support.apple.com/en-eg/HT201260
1516
SummaryAttributes:
1617
- name
1718
- hostIdentifier

rules/osquery_rules/osquery_ssh_listener.yml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Description: >
1616
Check if SSH is listening in a non-production environment. This could be an indicator of persistent access within an environment.
1717
Runbook: >
1818
Terminate the SSH daemon, investigate for signs of compromise.
19+
Reference: https://medium.com/uptycs/osquery-what-it-is-how-it-works-and-how-to-use-it-ce4e81e60dfc
1920
SummaryAttributes:
2021
- action
2122
- hostIdentifier

rules/standard_rules/admin_assigned.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ Severity: Medium
1818
Reports:
1919
MITRE ATT&CK:
2020
- TA0004:T1078
21-
Description: Attaching an audit role manually could be a sign of privilege escalation
21+
Description: Assigning an admin role manually could be a sign of privilege escalation
2222
Runbook: Verify with the user who attached the role or add to a allowlist
23+
Reference: https://medium.com/@gokulelango1040/privilege-escalation-attacks-28a9ef226abb
2324
SummaryAttributes:
2425
- p_any_ip_addresses
2526
Tests:

rules/standard_rules/brute_force_by_ip.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Reports:
2323
- TA0006:T1110
2424
Description: An actor user was denied login access more times than the configured threshold.
2525
Runbook: Analyze the IP they came from, and other actions taken before/after. Check if a user from this ip eventually authenticated successfully.
26+
Reference: https://owasp.org/www-community/controls/Blocking_Brute_Force_Attacks
2627
SummaryAttributes:
2728
- p_any_ip_addresses
2829
Tests:

rules/standard_rules/impossible_travel_login.yml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Runbook: >
2121
2222
If the user responds that the geolocation on the new location is incorrect, you can directly
2323
report the inaccuracy via https://ipinfo.io/corrections
24+
Reference: https://expertinsights.com/insights/what-are-impossible-travel-logins/#:~:text=An%20impossible%20travel%20login%20is,of%20the%20logins%20is%20fraudulent
2425
SummaryAttributes:
2526
- p_any_usernames
2627
- p_any_ip_addresses

rules/standard_rules/malicious_sso_dns_lookup.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Reports:
1919
- TA0001:T1566
2020
Description: The rule looks for DNS requests to sites potentially posing as SSO domains.
2121
Runbook: Verify if the destination domain is owned by your organization.
22+
Reference: https://www.cloudns.net/wiki/article/254/#:~:text=A%20DNS%20query%20(also%20known,associated%20with%20a%20domain%20name
2223
SummaryAttributes:
2324
- p_any_ip_addresses
2425
Tests:

rules/standard_rules/mfa_disabled.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Tags:
1515
Reports:
1616
MITRE ATT&CK:
1717
- TA0005:T1556
18+
Reference: https://en.wikipedia.org/wiki/Multi-factor_authentication
1819
Severity: High
1920
Description: Detects when Multi-Factor Authentication (MFA) is disabled
2021
SummaryAttributes:

rules/standard_rules/standard_dns_base64.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Description: Detects DNS queries with Base64 encoded subdomains, which could ind
44
RuleID: "Standard.DNSBase64"
55
Enabled: false
66
Filename: standard_dns_base64.py
7+
Reference: https://zofixer.com/what-is-base64-disclosure-vulnerability/
78
Severity: Medium
89
DedupPeriodMinutes: 60
910
Threshold: 1

rules/standard_rules/unusual_login_deprecated.yml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Runbook: >
2929
Reach out to the user to ensure the login was legitimate. Be sure to use a means outside the one the unusual login originated from, if one is available. CC an individual that works with the user for visibility, usually the user’s manager if they’re available. The second user is not expected to respond, unless they find the response unusual or the location unexpected.
3030
3131
To reduce noise, geolocation history length can be configured in the rule body to increase the number of allowed locations per user.
32+
Reference: https://d3fend.mitre.org/technique/d3f:UserGeolocationLogonPatternAnalysis/
3233
SummaryAttributes:
3334
- p_any_ip_addresses
3435
Tests:

rules/zendesk_rules/zendesk_mobile_app_access.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Reports:
1414
- TA0003:T1078
1515
Severity: Medium
1616
Description: A user updated account setting that enabled or disabled mobile app access.
17+
Reference: https://support.zendesk.com/hc/en-us/articles/4408846407066-About-the-Zendesk-Support-mobile-app#:~:text=More%20settings.-,Configuring%20the%20mobile%20app,-Activate%20the%20new
1718
SummaryAttributes:
1819
- p_any_ip_addresses
1920
Tests:

rules/zendesk_rules/zendesk_new_api_token.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Reports:
1515
- TA0006:T1528
1616
Description: A user created a new API token to be used with Zendesk.
1717
Runbook: Validate the api token was created for valid use case, otherwise delete the token immediately.
18+
Reference: https://support.zendesk.com/hc/en-us/articles/4408889192858-Managing-access-to-the-Zendesk-API#topic_bsw_lfg_mmb:~:text=enable%20token%20access.-,Generating%20API%20tokens,-To%20generate%20an
1819
SummaryAttributes:
1920
- p_any_ip_addresses
2021
Tests:

rules/zendesk_rules/zendesk_new_owner.yml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Reports:
1414
MITRE ATT&CK:
1515
- TA0004:T1078
1616
Description: Only one admin user can be the account owner. Ensure the change in ownership is expected.
17+
Reference: https://support.zendesk.com/hc/en-us/articles/4408822084634-Changing-the-account-owner
1718
SummaryAttributes:
1819
- p_any_ip_addresses
1920
Tests:

rules/zendesk_rules/zendesk_sensitive_data_redaction.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Reports:
1515
Severity: High
1616
Description: A user updated account setting that disabled credit card redaction.
1717
Runbook: Re-enable credit card redaction.
18+
Reference: https://support.zendesk.com/hc/en-us/articles/4408822124314-Automatically-redacting-credit-card-numbers-from-tickets
1819
SummaryAttributes:
1920
- p_any_ip_addresses
2021
Tests:

rules/zendesk_rules/zendesk_user_assumption.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Severity: Medium
1515
Description: User enabled or disabled zendesk support user assumption.
1616
Runbook: >
1717
Investigate whether allowing zendesk support to assume users is necessary. If not, disable the feature.
18+
Reference: https://support.zendesk.com/hc/en-us/articles/4408894200474-Assuming-end-users#:~:text=In%20Support%2C%20click%20the%20Customers,user%20in%20the%20information%20dialog
1819
SummaryAttributes:
1920
- p_any_ip_addresses
2021
Tests:

rules/zendesk_rules/zendesk_user_role.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ LogTypes:
88
- Zendesk.Audit
99
Severity: Info
1010
Description: A user's Zendesk role was changed
11+
Reference: https://support.zendesk.com/hc/en-us/articles/4408824375450-Setting-roles-and-access-in-Zendesk-Admin-Center
1112
SummaryAttributes:
1213
- p_any_ip_addresses
1314
Tests:

rules/zendesk_rules/zendesk_user_suspension.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Reports:
1515
Severity: High
1616
Description: A user's Zendesk suspension status was changed.
1717
Runbook: Ensure the user's suspension status is appropriate.
18+
Reference: https://support.zendesk.com/hc/en-us/articles/4408889293978-Suspending-a-user#:~:text=select%20Unsuspend%20access.-,Identifying%20suspended%20users,name%20on%20the%20Customers%20page
1819
SummaryAttributes:
1920
- p_any_ip_addresses
2021
Tests:

rules/zoom_operation_rules/zoom_all_meetings_secured_with_one_option_disabled.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DisplayName: "Zoom All Meetings Secured With One Option Disabled"
44
Enabled: true
55
Filename: zoom_all_meetings_secured_with_one_option_disabled.py
66
Runbook: Confirm this user acted with valid business intent and determine whether this activity was authorized.
7+
Reference: https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0059862
78
Severity: Medium
89
Tests:
910
- ExpectedResult: true

rules/zoom_operation_rules/zoom_new_meeting_passcode_required_disabled.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DisplayName: "Zoom New Meeting Passcode Required Disabled"
44
Enabled: true
55
Filename: zoom_new_meeting_passcode_required_disabled.py
66
Runbook: Confirm this user acted with valid business intent and determine whether this activity was authorized.
7+
Reference: https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0063160#:~:text=Since%20September%202022%2C%20Zoom%20requires,enforced%20for%20all%20free%20accounts
78
Severity: Medium
89
Tests:
910
- ExpectedResult: true

rules/zoom_operation_rules/zoom_sign_in_method_modified.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ DisplayName: "Zoom Sign In Method Modified"
44
Enabled: true
55
Filename: zoom_sign_in_method_modified.py
66
Runbook: Confirm this user acted with valid business intent and determine whether this activity was authorized.
7+
Reference: https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0067602#:~:text=Go%20to%20the%20Zoom%20site,click%20Link%20and%20Sign%20In
78
Severity: Medium
89
Tests:
910
- ExpectedResult: true

0 commit comments

Comments
 (0)