VM instance has 'Enable Connecting to Serial Ports' disabled
Compute Engine VM instance with the interactive serial console enabled via metadata serial-port-enable (1/true). Instances with this flag disabled do not allow interactive serial console connections.
Risk
Enabling the serial console creates out-of-band access that can bypass network controls. Abuse can grant low-level OS interaction, expose sensitive boot logs, alter configuration, or disrupt services, degrading confidentiality, integrity, and availability.
Run this check with Prowler
Run in Prowler Cloudprowler gcp --checks compute_instance_serial_ports_in_useRecommendation
Disable the interactive serial console on production VMs (serial-port-enable=false). Use it only for break-glass cases. Enforce least privilege for console roles, prefer controlled access paths (IAP/SSH or session tools), and monitor access. Apply defense in depth to reduce alternate entry points.
Remediation
CLI
gcloud compute instances add-metadata <INSTANCE_NAME> --zone=<ZONE> --metadata=serial-port-enable=falseTerraform
resource "google_compute_instance" "<example_resource_name>" {
name = "<example_resource_name>"
machine_type = "e2-micro"
zone = "us-central1-a"
boot_disk {
initialize_params { image = "debian-cloud/debian-12" }
}
network_interface { network = "default" }
metadata = {
serial-port-enable = "false" # Critical: disables connecting to serial ports to pass the check
}
}Other
Check Code
from prowler.lib.check.models import Check, Check_Report_GCP
from prowler.providers.gcp.services.compute.compute_client import compute_client
class compute_instance_serial_ports_in_use(Check):
def execute(self) -> Check_Report_GCP:
findings = []
for instance in compute_client.instances:
report = Check_Report_GCP(metadata=self.metadata(), resource=instance)
report.status = "PASS"
report.status_extended = f"VM Instance {instance.name} has Enable Connecting to Serial Ports off."
if instance.metadata.get("items"):
for item in instance.metadata["items"]:
if item["key"] == "serial-port-enable" and item["value"] in [
"1",
"true",
]:
report.status = "FAIL"
report.status_extended = f"VM Instance {instance.name} has Enable Connecting to Serial Ports set to on."
break
findings.append(report)
return findings