-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(gcp): add check to detect Compute Engine configuration changes #9698
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
HugoPBrito
merged 12 commits into
master
from
PROWLER-364-gcp-compute-new-check-detect-configuration-changes
Jan 12, 2026
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
446eb27
feat(gcp): add check to detect Compute Engine configuration changes
lydiavilchez 2aa8871
feat(gcp): add check to detect Compute Engine configuration changes
lydiavilchez ef4501f
docs: update CHANGELOG
lydiavilchez 138a55e
Merge branch 'master' into PROWLER-364-gcp-compute-new-check-detect-c…
lydiavilchez 211f01c
fix: update gcp_provider_test to include compute_audit_log_lookback_days
lydiavilchez 46e4858
fix: update config_test to include compute_audit_log_lookback_days in…
lydiavilchez fcfc3ab
fix: add pagination coverage for logging service audit entries
lydiavilchez 0dc0dac
fix: revert change
lydiavilchez ac3bf6b
Merge branch 'master' into PROWLER-364-gcp-compute-new-check-detect-c…
danibarranqueroo 69b4e3d
chore(gcp): add configurable check to the docs
danibarranqueroo c0ca1c7
refactor(gcp): relocate compute configuration changes check to loggin…
lydiavilchez 03d7dbf
chore: revision
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
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
Empty file.
39 changes: 39 additions & 0 deletions
39
...ervices/compute/compute_configuration_changes/compute_configuration_changes.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,39 @@ | ||
| { | ||
| "Provider": "gcp", | ||
| "CheckID": "compute_configuration_changes", | ||
| "CheckTitle": "Compute Engine resource has no recent configuration changes in audit logs", | ||
| "CheckType": [], | ||
| "ServiceName": "compute", | ||
| "SubServiceName": "", | ||
| "ResourceIdTemplate": "", | ||
| "Severity": "low", | ||
| "ResourceType": "compute.googleapis.com/Instance", | ||
| "ResourceGroup": "monitoring", | ||
| "Description": "This check examines Cloud Audit Logs for recent Compute Engine configuration changes. It surfaces modifications to instance settings, disks, and networks within a configurable lookback window so operators can review unexpected changes.", | ||
| "Risk": "Unreviewed Compute Engine configuration changes may indicate:\n\n- **Unauthorized access** - Malicious actors modifying resources\n- **Lateral movement** - Attackers expanding their foothold\n- **Security policy violations** - Unapproved changes bypassing change management\n\nWithout monitoring, unexpected changes could compromise security posture.", | ||
| "RelatedUrl": "", | ||
| "AdditionalURLs": [ | ||
| "https://www.trendmicro.com/cloudoneconformity/knowledge-base/gcp/ComputeEngine/gcp-compute-engine-configuration-changes.html", | ||
| "https://cloud.google.com/logging/docs/audit" | ||
| ], | ||
| "Remediation": { | ||
| "Code": { | ||
| "CLI": "gcloud logging read 'protoPayload.serviceName=\"compute.googleapis.com\" AND logName:\"cloudaudit.googleapis.com%2Factivity\"' --project=PROJECT_ID --limit=100 --format=json", | ||
| "NativeIaC": "", | ||
| "Other": "1. Navigate to **Cloud Logging** in the GCP Console\n2. Select **Logs Explorer**\n3. Filter logs with: `protoPayload.serviceName=\"compute.googleapis.com\"`\n4. Review the Admin Activity logs for unexpected changes\n5. Investigate any unauthorized modifications", | ||
| "Terraform": "" | ||
| }, | ||
| "Recommendation": { | ||
| "Text": "Apply the **Principle of Least Privilege** to limit who can modify Compute Engine resources. Configure Cloud Monitoring alerts for configuration changes and establish a formal change management process to review all modifications.", | ||
| "Url": "https://hub.prowler.com/check/compute_configuration_changes" | ||
| } | ||
| }, | ||
| "Categories": [ | ||
| "logging" | ||
| ], | ||
| "DependsOn": [], | ||
| "RelatedTo": [ | ||
| "logging_log_metric_filter_and_alert_for_audit_configuration_changes_enabled" | ||
| ], | ||
| "Notes": "This check requires Cloud Audit Logs to be enabled. The lookback window is configurable via the `compute_audit_log_lookback_days` parameter in the configuration file (default: 1 day)." | ||
| } | ||
59 changes: 59 additions & 0 deletions
59
...iders/gcp/services/compute/compute_configuration_changes/compute_configuration_changes.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,59 @@ | ||
| from prowler.lib.check.models import Check, Check_Report_GCP | ||
| from prowler.providers.gcp.services.logging.logging_client import logging_client | ||
|
|
||
|
|
||
| class compute_configuration_changes(Check): | ||
| """Detect Compute Engine configuration changes in Cloud Audit Logs. | ||
|
|
||
| This check examines Cloud Audit Logs (Admin Activity) for recent Compute Engine | ||
| configuration changes within a configurable lookback window. It surfaces | ||
| configuration modifications such as instance settings, disks, and network changes | ||
| so operators can review unexpected modifications. | ||
|
|
||
| - PASS: No Compute Engine configuration changes detected in the lookback period. | ||
| - FAIL: Compute Engine configuration changes were detected in the lookback period. | ||
| """ | ||
|
|
||
| def execute(self) -> list[Check_Report_GCP]: | ||
| findings = [] | ||
|
|
||
| for project_id in logging_client.project_ids: | ||
| audit_entries = logging_client.compute_audit_entries.get(project_id, []) | ||
|
|
||
| if not audit_entries: | ||
| project_obj = logging_client.projects.get(project_id) | ||
| report = Check_Report_GCP( | ||
| metadata=self.metadata(), | ||
| resource=project_obj, | ||
| project_id=project_id, | ||
| location=logging_client.region, | ||
| resource_name=(getattr(project_obj, "name", None) or project_id), | ||
| resource_id=project_id, | ||
| ) | ||
| report.status = "PASS" | ||
| report.status_extended = f"No Compute Engine configuration changes detected in project {project_id}." | ||
| findings.append(report) | ||
| else: | ||
| for entry in audit_entries: | ||
| report = Check_Report_GCP( | ||
| metadata=self.metadata(), | ||
| resource=entry, | ||
| project_id=project_id, | ||
| location=logging_client.region, | ||
| resource_name=entry.resource_name, | ||
| resource_id=entry.insert_id, | ||
| ) | ||
| report.status = "FAIL" | ||
|
|
||
| actor = entry.principal_email or "unknown actor" | ||
| timestamp = entry.timestamp | ||
| method = entry.method_name | ||
|
|
||
| report.status_extended = ( | ||
| f"Compute Engine configuration change detected: {method} " | ||
| f"on resource {entry.resource_name} by {actor} at {timestamp} " | ||
| f"in project {project_id}." | ||
| ) | ||
| findings.append(report) | ||
|
|
||
| return findings |
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
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
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.