-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(googleworkspace): add Gmail consequence-based checks for attachment safety and spoofing #10980
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
danibarranqueroo
merged 3 commits into
master
from
PROWLER-1452-implement-gmail-consequence-based-checks-for-google-workspace-provider-pr-2
May 7, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
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
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
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
...attachment_protection_enabled/gmail_anomalous_attachment_protection_enabled.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,40 @@ | ||
| { | ||
| "Provider": "googleworkspace", | ||
| "CheckID": "gmail_anomalous_attachment_protection_enabled", | ||
| "CheckTitle": "Protection against anomalous attachment types in emails is enabled", | ||
| "CheckType": [], | ||
| "ServiceName": "gmail", | ||
| "SubServiceName": "", | ||
| "ResourceIdTemplate": "", | ||
| "Severity": "medium", | ||
| "ResourceType": "NotDefined", | ||
| "ResourceGroup": "collaboration", | ||
| "Description": "Verifies that Gmail is configured to take a protective action (such as moving to spam, quarantining, or showing a warning) when emails contain anomalous attachment types. Unusual file types that are uncommon for the sender or organization may indicate an attempt to deliver malware through less-scrutinized formats.", | ||
| "Risk": "Without protection against anomalous attachment types, users may receive **emails with unusual file formats** that are designed to bypass standard security filters. Attackers may use **uncommon file extensions or MIME types** to deliver malware that evades signature-based detection.", | ||
| "RelatedUrl": "", | ||
| "AdditionalURLs": [ | ||
| "https://support.google.com/a/answer/7676854", | ||
| "https://cloud.google.com/identity/docs/concepts/supported-policy-api-settings" | ||
| ], | ||
| "Remediation": { | ||
| "Code": { | ||
| "CLI": "", | ||
| "NativeIaC": "", | ||
| "Other": "1. Sign in to the Google **Admin console** at https://admin.google.com\n2. Navigate to **Apps** > **Google Workspace** > **Gmail**\n3. Click **Safety** > **Attachments**\n4. Check **Protect against anomalous attachment types in emails**\n5. Select the desired action (e.g., Move email to spam)\n6. Click **Save**", | ||
| "Terraform": "" | ||
| }, | ||
| "Recommendation": { | ||
| "Text": "Enable protection against anomalous attachment types in emails and configure an appropriate action such as moving to spam or quarantining.", | ||
| "Url": "https://hub.prowler.com/check/gmail_anomalous_attachment_protection_enabled" | ||
| } | ||
| }, | ||
| "Categories": [ | ||
| "email-security" | ||
| ], | ||
| "DependsOn": [], | ||
| "RelatedTo": [ | ||
| "gmail_encrypted_attachment_protection_enabled", | ||
| "gmail_script_attachment_protection_enabled" | ||
| ], | ||
| "Notes": "" | ||
| } |
71 changes: 71 additions & 0 deletions
71
..._anomalous_attachment_protection_enabled/gmail_anomalous_attachment_protection_enabled.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,71 @@ | ||
| from typing import List | ||
|
|
||
| from prowler.lib.check.models import Check, CheckReportGoogleWorkspace | ||
| from prowler.providers.googleworkspace.services.gmail.gmail_client import gmail_client | ||
|
|
||
|
|
||
| class gmail_anomalous_attachment_protection_enabled(Check): | ||
| """Check that protection against anomalous attachment types in emails is enabled. | ||
|
|
||
| This check verifies that Gmail is configured to take action on | ||
| emails containing unusual attachment types, helping prevent | ||
| malware delivery via uncommon file formats. | ||
| """ | ||
|
|
||
| def execute(self) -> List[CheckReportGoogleWorkspace]: | ||
| findings = [] | ||
|
|
||
| if gmail_client.policies_fetched: | ||
| report = CheckReportGoogleWorkspace( | ||
| metadata=self.metadata(), | ||
| resource=gmail_client.provider.domain_resource, | ||
| ) | ||
|
|
||
| enabled = gmail_client.policies.enable_anomalous_attachment_protection | ||
| consequence = ( | ||
| gmail_client.policies.anomalous_attachment_protection_consequence | ||
| ) | ||
|
|
||
| if enabled is False: | ||
| report.status = "FAIL" | ||
| report.status_extended = ( | ||
| f"Protection against anomalous attachment types in emails " | ||
| f"is disabled in domain " | ||
| f"{gmail_client.provider.identity.domain}. " | ||
| f"Enable the protection and configure a protective action." | ||
| ) | ||
| elif enabled is None: | ||
| report.status = "FAIL" | ||
| report.status_extended = ( | ||
| f"Protection against anomalous attachment types in emails " | ||
| f"is not configured and uses Google's insecure default " | ||
| f"(disabled) in domain " | ||
| f"{gmail_client.provider.identity.domain}. " | ||
| f"Enable the protection and configure a protective action." | ||
| ) | ||
| elif consequence == "NO_ACTION": | ||
| report.status = "FAIL" | ||
| report.status_extended = ( | ||
| f"Protection against anomalous attachment types in emails " | ||
| f"is set to take no action in domain " | ||
| f"{gmail_client.provider.identity.domain}. " | ||
| f"A protective action should be configured." | ||
| ) | ||
| elif consequence is None: | ||
| report.status = "PASS" | ||
| report.status_extended = ( | ||
| f"Protection against anomalous attachment types in emails " | ||
| f"is enabled in domain " | ||
| f"{gmail_client.provider.identity.domain}." | ||
| ) | ||
| else: | ||
| report.status = "PASS" | ||
| report.status_extended = ( | ||
| f"Protection against anomalous attachment types in emails " | ||
| f"is enabled with consequence '{consequence}' " | ||
| f"in domain {gmail_client.provider.identity.domain}." | ||
| ) | ||
|
|
||
| findings.append(report) | ||
|
|
||
| return findings |
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
...domain_spoofing_protection_enabled/gmail_domain_spoofing_protection_enabled.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,42 @@ | ||
| { | ||
| "Provider": "googleworkspace", | ||
| "CheckID": "gmail_domain_spoofing_protection_enabled", | ||
| "CheckTitle": "Protection against domain spoofing based on similar domain names is enabled", | ||
| "CheckType": [], | ||
| "ServiceName": "gmail", | ||
| "SubServiceName": "", | ||
| "ResourceIdTemplate": "", | ||
| "Severity": "medium", | ||
| "ResourceType": "NotDefined", | ||
| "ResourceGroup": "collaboration", | ||
| "Description": "Verifies that Gmail is configured to take a protective action (such as moving to spam, quarantining, or showing a warning) when emails appear to come from domain names that look similar to the organization's domain. Lookalike domains are a common phishing technique used to trick users into trusting malicious messages.", | ||
| "Risk": "Without protection against domain spoofing based on similar domain names, users may receive **phishing emails from lookalike domains** (e.g., examp1e.com instead of example.com) that appear legitimate. This enables **credential theft, malware delivery, and business email compromise** attacks.", | ||
| "RelatedUrl": "", | ||
| "AdditionalURLs": [ | ||
| "https://support.google.com/a/answer/9157861", | ||
| "https://cloud.google.com/identity/docs/concepts/supported-policy-api-settings" | ||
| ], | ||
| "Remediation": { | ||
| "Code": { | ||
| "CLI": "", | ||
| "NativeIaC": "", | ||
| "Other": "1. Sign in to the Google **Admin console** at https://admin.google.com\n2. Navigate to **Apps** > **Google Workspace** > **Gmail**\n3. Click **Safety** > **Spoofing and authentication**\n4. Check **Protect against domain spoofing based on similar domain names**\n5. Select the desired action (e.g., Move email to spam)\n6. Click **Save**", | ||
| "Terraform": "" | ||
| }, | ||
| "Recommendation": { | ||
| "Text": "Enable protection against domain spoofing based on similar domain names and configure an appropriate action such as moving to spam or quarantining.", | ||
| "Url": "https://hub.prowler.com/check/gmail_domain_spoofing_protection_enabled" | ||
| } | ||
| }, | ||
| "Categories": [ | ||
| "email-security" | ||
| ], | ||
| "DependsOn": [], | ||
| "RelatedTo": [ | ||
| "gmail_employee_name_spoofing_protection_enabled", | ||
| "gmail_inbound_domain_spoofing_protection_enabled", | ||
| "gmail_unauthenticated_email_protection_enabled", | ||
| "gmail_groups_spoofing_protection_enabled" | ||
| ], | ||
| "Notes": "" | ||
| } |
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.