gcp-gce-metadata-secret

startup-script / custom metadata frequently embeds secrets, readable via instances.get.

derived gcp emits ExposesCredential

match (effective permission)

{ "action": "compute.instances.get", "resource_type": "compute.googleapis.com/Instance" }

emit

source<instance>
target<credential in metadata>
permissionscompute.instances.get
conditionsiam_permission

Narrative

{principal.name} can read {instance.name}'s metadata (compute.instances.get), which may embed credentials in startup-script or custom keys.

Raw rule rules/derived/gcp/gce.yaml

id: gcp-gce-metadata-secret
emits: ExposesCredential
description: startup-script / custom metadata frequently embeds secrets, readable via instances.get.
match_effective_permission:
  action: compute.instances.get
  resource_type: compute.googleapis.com/Instance
emit:
  source: <instance>
  target: <credential in metadata>
  permissions:
  - compute.instances.get
  conditions:
  - iam_permission
  false_positive_note: Only a real ExposesCredential when the metadata actually contains a secret; otherwise
    recon only.
  narrative: '{principal.name} can read {instance.name}''s metadata (compute.instances.get), which may
    embed credentials in startup-script or custom keys.'
move · open · esc close