-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat(m365): add CIS M365 v7.0.0 entra password protection and default user permission checks #12153
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d6948a6
feat(m365): add CIS M365 v7.0.0 entra device registration checks
pedrooot aafc331
feat(m365): add CIS M365 v7.0.0 entra password protection and default…
pedrooot 06b5790
chore: merge master into PR 12153
HugoPBrito c6e2a31
fix(m365): address Entra policy review findings
HugoPBrito 22d305a
test(m365): isolate Entra client mocks
HugoPBrito aefa276
chore: merge master into PR 12153
HugoPBrito dc5b5a9
Merge branch 'master' of https://github.com/prowler-cloud/prowler int…
HugoPBrito cbd01c5
Merge branch 'master' of https://github.com/prowler-cloud/prowler int…
HugoPBrito File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
prowler/changelog.d/m365-cis7-entra-device-registration.added.md
This file contains hidden or 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| `entra_device_registration_join_restricted`, `entra_device_registration_max_devices_per_user_limited`, `entra_device_registration_global_admins_not_local_admins`, `entra_device_registration_registering_user_not_local_admin`, `entra_device_registration_laps_enabled` and `entra_policy_default_user_cannot_read_bitlocker_keys` checks for M365 provider, covering CIS Microsoft 365 Foundations Benchmark v7.0.0 device registration controls (5.1.4.x) | ||
| 6 M365 Entra checks covering CIS Microsoft 365 Foundations Benchmark v7.0.0 device registration controls (5.1.4.x): `entra_device_registration_join_restricted`, `entra_device_registration_max_devices_per_user_limited`, `entra_device_registration_global_admins_not_local_admins`, `entra_device_registration_registering_user_not_local_admin`, `entra_device_registration_laps_enabled`, and `entra_policy_default_user_cannot_read_bitlocker_keys`. |
1 change: 1 addition & 0 deletions
1
prowler/changelog.d/m365-cis7-entra-directory-settings.added.md
This file contains hidden or 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 @@ | ||
| 7 M365 Entra checks covering CIS Microsoft 365 Foundations Benchmark v7.0.0 password protection, default user permissions, and guest invitation domain restrictions |
This file contains hidden or 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
Empty file.
37 changes: 37 additions & 0 deletions
37
..._banned_list_enforced/entra_password_protection_custom_banned_list_enforced.metadata.json
This file contains hidden or 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,37 @@ | ||
| { | ||
| "Provider": "m365", | ||
| "CheckID": "entra_password_protection_custom_banned_list_enforced", | ||
| "CheckTitle": "Entra custom banned password list is enforced", | ||
| "CheckType": [], | ||
| "ServiceName": "entra", | ||
| "SubServiceName": "", | ||
| "ResourceIdTemplate": "", | ||
| "Severity": "medium", | ||
| "ResourceType": "NotDefined", | ||
| "ResourceGroup": "IAM", | ||
| "Description": "The tenant Password Rule Settings should enforce a **custom banned password list** (**EnableBannedPasswordCheck** true with a non-empty **BannedPasswordList**). This blocks organization-specific weak or predictable passwords (e.g., company name, products, locations) in addition to Microsoft's global banned list.", | ||
| "Risk": "Without a custom **banned password** list, users can choose passwords that are predictable for the specific organization (brand names, local terms), which are easy targets for **password spraying** and guessing attacks.", | ||
| "RelatedUrl": "", | ||
| "AdditionalURLs": [ | ||
| "https://learn.microsoft.com/en-us/entra/identity/authentication/concept-password-ban-bad" | ||
| ], | ||
| "Remediation": { | ||
| "Code": { | ||
| "CLI": "", | ||
| "NativeIaC": "", | ||
| "Other": "1. Navigate to the Microsoft Entra admin center at https://entra.microsoft.com/\n2. Go to **Protection** > **Authentication methods** > **Password protection**\n3. Set **Enforce custom list** to **Yes**\n4. Add organization-specific terms to the **Custom banned password list**\n5. Click **Save**", | ||
| "Terraform": "" | ||
| }, | ||
| "Recommendation": { | ||
| "Text": "Enable the custom banned password list and populate it with terms relevant to the organization to strengthen protection against weak passwords beyond the global banned list.", | ||
| "Url": "https://hub.prowler.com/check/entra_password_protection_custom_banned_list_enforced" | ||
| } | ||
| }, | ||
| "Categories": [ | ||
| "identity-access", | ||
| "e3" | ||
| ], | ||
| "DependsOn": [], | ||
| "RelatedTo": [], | ||
| "Notes": "" | ||
| } |
63 changes: 63 additions & 0 deletions
63
...tion_custom_banned_list_enforced/entra_password_protection_custom_banned_list_enforced.py
This file contains hidden or 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,63 @@ | ||
| from typing import List | ||
|
|
||
| from prowler.lib.check.models import Check, CheckReportM365 | ||
| from prowler.providers.m365.services.entra.entra_client import entra_client | ||
| from prowler.providers.m365.services.entra.entra_service import ( | ||
| PASSWORD_RULE_SETTINGS_TEMPLATE_ID, | ||
| ) | ||
|
|
||
|
|
||
| class entra_password_protection_custom_banned_list_enforced(Check): | ||
| """Check if the Entra custom banned password list is enforced. | ||
|
|
||
| The Password Rule Settings directory setting should enforce a custom banned | ||
| password list (EnableBannedPasswordCheck) with a non-empty BannedPasswordList so | ||
| that organization-specific weak passwords are rejected in addition to the global | ||
| banned list. | ||
|
|
||
| - PASS: The custom banned password list is enforced and non-empty. | ||
| - FAIL: The custom banned password list is not enforced or is empty. | ||
| """ | ||
|
|
||
| def execute(self) -> List[CheckReportM365]: | ||
| """Execute the custom banned password list enforcement check. | ||
|
|
||
| Evaluate whether the Password Rule Settings directory setting enforces a | ||
| non-empty custom banned password list. When the settings object is absent, | ||
| no finding is produced. | ||
|
|
||
| Returns: | ||
| List[CheckReportM365]: A list with a single report when the Password Rule | ||
| Settings exist, or an empty list when they are absent. | ||
| """ | ||
| findings = [] | ||
| settings = entra_client.directory_settings.get( | ||
| PASSWORD_RULE_SETTINGS_TEMPLATE_ID | ||
| ) | ||
| if not settings: | ||
| return findings | ||
|
|
||
| report = CheckReportM365( | ||
| metadata=self.metadata(), | ||
| resource=settings or {}, | ||
| resource_name="Password Rule Settings", | ||
| resource_id=PASSWORD_RULE_SETTINGS_TEMPLATE_ID, | ||
| ) | ||
| report.status = "FAIL" | ||
| report.status_extended = ( | ||
| "The custom banned password list is not enforced in the tenant." | ||
| ) | ||
|
|
||
| if settings: | ||
| enforced = ( | ||
| str(settings.get("EnableBannedPasswordCheck", "")).lower() == "true" | ||
| ) | ||
| banned_list = settings.get("BannedPasswordList", "") or "" | ||
| if enforced and banned_list.strip(): | ||
| report.status = "PASS" | ||
| report.status_extended = ( | ||
| "The custom banned password list is enforced in the tenant." | ||
| ) | ||
|
|
||
| findings.append(report) | ||
| return findings |
Empty file.
37 changes: 37 additions & 0 deletions
37
...t_duration_configured/entra_password_protection_lockout_duration_configured.metadata.json
This file contains hidden or 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,37 @@ | ||
| { | ||
| "Provider": "m365", | ||
| "CheckID": "entra_password_protection_lockout_duration_configured", | ||
| "CheckTitle": "Smart lockout duration is set to 60 seconds or more", | ||
| "CheckType": [], | ||
| "ServiceName": "entra", | ||
| "SubServiceName": "", | ||
| "ResourceIdTemplate": "", | ||
| "Severity": "low", | ||
| "ResourceType": "NotDefined", | ||
| "ResourceGroup": "IAM", | ||
| "Description": "The tenant Password Rule Settings should set the smart **LockoutDurationInSeconds** to **60 or more**. The lockout duration determines how long an account remains locked out before the user can attempt to sign in again.", | ||
| "Risk": "A short lockout duration allows attackers to resume **brute-force** or **password-spray** attempts sooner, reducing the effectiveness of **smart lockout** as a throttling control.", | ||
| "RelatedUrl": "", | ||
| "AdditionalURLs": [ | ||
| "https://learn.microsoft.com/en-us/entra/identity/authentication/howto-password-smart-lockout" | ||
| ], | ||
| "Remediation": { | ||
| "Code": { | ||
| "CLI": "", | ||
| "NativeIaC": "", | ||
| "Other": "1. Navigate to the Microsoft Entra admin center at https://entra.microsoft.com/\n2. Go to **Protection** > **Authentication methods** > **Password protection**\n3. Set **Lockout duration in seconds** to **60** or higher\n4. Click **Save**", | ||
| "Terraform": "" | ||
| }, | ||
| "Recommendation": { | ||
| "Text": "Set the smart lockout duration to 60 seconds or more so locked-out accounts remain locked long enough to throttle automated password attacks.", | ||
| "Url": "https://hub.prowler.com/check/entra_password_protection_lockout_duration_configured" | ||
| } | ||
| }, | ||
| "Categories": [ | ||
| "identity-access", | ||
| "e3" | ||
| ], | ||
| "DependsOn": [], | ||
| "RelatedTo": [], | ||
| "Notes": "" | ||
| } |
62 changes: 62 additions & 0 deletions
62
...tion_lockout_duration_configured/entra_password_protection_lockout_duration_configured.py
This file contains hidden or 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,62 @@ | ||
| from typing import List | ||
|
|
||
| from prowler.lib.check.models import Check, CheckReportM365 | ||
| from prowler.providers.m365.services.entra.entra_client import entra_client | ||
| from prowler.providers.m365.services.entra.entra_service import ( | ||
| PASSWORD_RULE_SETTINGS_TEMPLATE_ID, | ||
| ) | ||
|
|
||
| # CIS recommends a lockout duration of 60 seconds or more. | ||
| MIN_LOCKOUT_DURATION_SECONDS = 60 | ||
|
|
||
|
|
||
| class entra_password_protection_lockout_duration_configured(Check): | ||
| """Check if the smart lockout duration is set to 60 seconds or more. | ||
|
|
||
| The Password Rule Settings directory setting should set LockoutDurationInSeconds | ||
| to 60 or more so a locked-out account remains locked long enough to slow down | ||
| automated attacks. | ||
|
|
||
| - PASS: The lockout duration is 60 seconds or more. | ||
| - FAIL: The lockout duration is less than 60 seconds or not configured. | ||
| """ | ||
|
|
||
| def execute(self) -> List[CheckReportM365]: | ||
| """Execute the smart lockout duration check. | ||
|
|
||
| Returns: | ||
| List[CheckReportM365]: Reports for the Password Rule Settings, or an | ||
| empty list when the settings are absent. | ||
| """ | ||
| findings = [] | ||
| settings = entra_client.directory_settings.get( | ||
| PASSWORD_RULE_SETTINGS_TEMPLATE_ID | ||
| ) | ||
| if not settings: | ||
| return findings | ||
|
|
||
| report = CheckReportM365( | ||
| metadata=self.metadata(), | ||
| resource=settings or {}, | ||
| resource_name="Password Rule Settings", | ||
| resource_id=PASSWORD_RULE_SETTINGS_TEMPLATE_ID, | ||
| ) | ||
| report.status = "FAIL" | ||
| report.status_extended = ( | ||
| "The smart lockout duration is not set to 60 seconds or more." | ||
| ) | ||
|
|
||
| if settings: | ||
| try: | ||
| duration = int(settings.get("LockoutDurationInSeconds")) | ||
| except (TypeError, ValueError): | ||
| duration = None | ||
| if duration is not None and duration >= MIN_LOCKOUT_DURATION_SECONDS: | ||
| report.status = "PASS" | ||
| report.status_extended = ( | ||
| f"The smart lockout duration is set to {duration} seconds, at or " | ||
| f"above the recommended minimum of {MIN_LOCKOUT_DURATION_SECONDS}." | ||
| ) | ||
|
|
||
| findings.append(report) | ||
| return findings | ||
Empty file.
37 changes: 37 additions & 0 deletions
37
...ckout_threshold_limited/entra_password_protection_lockout_threshold_limited.metadata.json
This file contains hidden or 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,37 @@ | ||
| { | ||
| "Provider": "m365", | ||
| "CheckID": "entra_password_protection_lockout_threshold_limited", | ||
| "CheckTitle": "Smart lockout threshold is set to 10 or less", | ||
| "CheckType": [], | ||
| "ServiceName": "entra", | ||
| "SubServiceName": "", | ||
| "ResourceIdTemplate": "", | ||
| "Severity": "medium", | ||
| "ResourceType": "NotDefined", | ||
| "ResourceGroup": "IAM", | ||
| "Description": "The tenant Password Rule Settings should set the smart **LockoutThreshold** to **10 or less**. The lockout threshold determines how many failed sign-in attempts are permitted before an account is placed in a locked-out state.", | ||
| "Risk": "A high lockout threshold gives attackers more attempts per account during **password spraying** and **brute-force** attacks before lockout is triggered, increasing the chance of a successful credential compromise.", | ||
| "RelatedUrl": "", | ||
| "AdditionalURLs": [ | ||
| "https://learn.microsoft.com/en-us/entra/identity/authentication/howto-password-smart-lockout" | ||
| ], | ||
| "Remediation": { | ||
| "Code": { | ||
| "CLI": "", | ||
| "NativeIaC": "", | ||
| "Other": "1. Navigate to the Microsoft Entra admin center at https://entra.microsoft.com/\n2. Go to **Protection** > **Authentication methods** > **Password protection**\n3. Set **Lockout threshold** to **10** or less\n4. Click **Save**", | ||
| "Terraform": "" | ||
| }, | ||
| "Recommendation": { | ||
| "Text": "Set the smart lockout threshold to 10 or less so accounts lock after a small number of failed sign-in attempts, limiting brute-force and password-spray attacks.", | ||
| "Url": "https://hub.prowler.com/check/entra_password_protection_lockout_threshold_limited" | ||
| } | ||
| }, | ||
| "Categories": [ | ||
| "identity-access", | ||
| "e3" | ||
| ], | ||
| "DependsOn": [], | ||
| "RelatedTo": [], | ||
| "Notes": "" | ||
| } |
63 changes: 63 additions & 0 deletions
63
...otection_lockout_threshold_limited/entra_password_protection_lockout_threshold_limited.py
This file contains hidden or 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,63 @@ | ||
| from typing import List | ||
|
|
||
| from prowler.lib.check.models import Check, CheckReportM365 | ||
| from prowler.providers.m365.services.entra.entra_client import entra_client | ||
| from prowler.providers.m365.services.entra.entra_service import ( | ||
| PASSWORD_RULE_SETTINGS_TEMPLATE_ID, | ||
| ) | ||
|
|
||
| # CIS recommends a smart lockout threshold of 10 or less. | ||
| MAX_LOCKOUT_THRESHOLD = 10 | ||
|
|
||
|
|
||
| class entra_password_protection_lockout_threshold_limited(Check): | ||
| """Check if the smart lockout threshold is set to 10 or less. | ||
|
|
||
| The Password Rule Settings directory setting should set LockoutThreshold to 10 or | ||
| less so that accounts are locked after a small number of failed sign-in attempts. | ||
|
|
||
| - PASS: The lockout threshold is 10 or less. | ||
| - FAIL: The lockout threshold is greater than 10 or not configured. | ||
| """ | ||
|
|
||
| def execute(self) -> List[CheckReportM365]: | ||
| """Execute the smart lockout threshold check. | ||
|
|
||
| Evaluate whether the Password Rule Settings directory setting limits the smart | ||
| lockout threshold to the recommended maximum. When the settings object is | ||
| absent, no finding is produced. | ||
|
|
||
| Returns: | ||
| List[CheckReportM365]: A list with a single report when the Password Rule | ||
| Settings exist, or an empty list when they are absent. | ||
| """ | ||
| findings = [] | ||
| settings = entra_client.directory_settings.get( | ||
| PASSWORD_RULE_SETTINGS_TEMPLATE_ID | ||
| ) | ||
| if not settings: | ||
| return findings | ||
|
|
||
| report = CheckReportM365( | ||
| metadata=self.metadata(), | ||
| resource=settings or {}, | ||
| resource_name="Password Rule Settings", | ||
| resource_id=PASSWORD_RULE_SETTINGS_TEMPLATE_ID, | ||
| ) | ||
| report.status = "FAIL" | ||
| report.status_extended = "The smart lockout threshold is not set to 10 or less." | ||
|
|
||
| if settings: | ||
| try: | ||
| threshold = int(settings.get("LockoutThreshold")) | ||
| except (TypeError, ValueError): | ||
| threshold = None | ||
| if threshold is not None and threshold <= MAX_LOCKOUT_THRESHOLD: | ||
| report.status = "PASS" | ||
| report.status_extended = ( | ||
| f"The smart lockout threshold is set to {threshold}, within the " | ||
| f"recommended limit of {MAX_LOCKOUT_THRESHOLD}." | ||
| ) | ||
|
|
||
| findings.append(report) | ||
| return findings |
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.