jan-karel.nl

GCP Hardening

GCP Hardening

Cloud Snel, Cloud Strak

Cloudomgevingen veranderen snel. Daarom moet beveiliging hier standaard en geautomatiseerd meebewegen.

Voor GCP Hardening is automatisering leidend: guardrails in code, least privilege en continue driftcontrole.

Zo houd je snelheid in de cloud, zonder dat veiligheid afhankelijk wordt van handmatig geluk.

Directe maatregelen (15 minuten)

Waarom dit telt

De kern van GCP Hardening is risicoreductie in de praktijk. Technische context ondersteunt de maatregelkeuze, maar implementatie en borging staan centraal.

Verdedigingsmaatregelen

Organization Policies

Organization Policies zijn beperkingen die op organisatie-niveau worden afgedwongen. Ze overschrijven IAM: zelfs als een IAM policy iets toestaat, kan een Organization Policy het blokkeren.

Policy Beschrijving Welke aanval het mitigeert
constraints/iam.disableServiceAccountKeyCreation Blokkeer aanmaken van SA-keys Key theft
constraints/compute.requireOsLogin Verplicht OS Login voor SSH SSH key injection
constraints/storage.uniformBucketLevelAccess Verplicht uniform access ACL-misconfiguratie
constraints/iam.allowedPolicyMemberDomains Beperk leden tot specifieke domeinen allUsers/allAuthenticatedUsers
constraints/compute.requireShieldedVm Verplicht Shielded VMs Boot-level attacks
constraints/cloudfunctions.allowedIngressSettings Beperk function ingress Publieke function invocatie
# Actieve Organization Policies bekijken
gcloud resource-manager org-policies list --organization=ORG_ID

# Specifieke policy details
gcloud resource-manager org-policies describe constraints/iam.disableServiceAccountKeyCreation \
    --organization=ORG_ID

VPC Service Controls

VPC Service Controls creëren een “perimeter” rond GCP resources die data exfiltratie voorkomt. Resources binnen de perimeter kunnen niet communiceren met resources buiten de perimeter, zelfs niet als IAM het toestaat.

# VPC Service Controls perimeters bekijken
gcloud access-context-manager perimeters list --policy=POLICY_ID

# Perimeter details
gcloud access-context-manager perimeters describe PERIMETER_NAME --policy=POLICY_ID

VPC Service Controls zijn de meest effectieve verdediging tegen data exfiltratie in GCP. Ze voorkomen dat een aanvaller met leesrechten op BigQuery de data kopieert naar een eigen project. Het is een harde grens, niet een zachte suggestie.

BeyondCorp Enterprise

BeyondCorp is Google’s implementatie van zero trust: geen netwerk is vertrouwd, geen device is vertrouwd, elke toegangspoging wordt geëvalueerd op basis van identity, device trust, en context. Het is de GCP-variant van Azure Conditional Access, maar met een focus op continue evaluatie in plaats van point-in-time checks.

Overige Aanbevelingen

Maatregel Beschrijving
Disable default SA Gebruik dedicated SAs met minimale rechten
Enable Data Access logs Ondanks de kosten, essentieel voor detectie
Workload Identity in GKE Voorkom node SA-misbruik vanuit pods
Uniform bucket access Voorkom ACL-inconsistenties
Disable SA key creation Via Organization Policy
Secret Manager Migreer van env vars naar Secret Manager
Binary Authorization Voorkom deployment van ongetrusted containers
Monitor SA key usage Alert op ongebruikelijke SA-authenticatie

Referentietabel

Onderwerp Techniek Tool MITRE ATT&CK Moeilijkheid
Project/org enumeratie Resource discovery gcloud CLI T1580 (Cloud Infrastructure Discovery) Laag
IAM policy analyse Permission mapping gcloud, custom scripts T1087.004 (Cloud Account Discovery) Laag
Service account key theft Credential file discovery find, grep, gcloud T1552.001 (Credentials in Files) Laag
SA impersonation Token generation via actAs gcloud CLI T1098.003 (Additional Cloud Roles) Gemiddeld
SA key creation Persistent SA access gcloud CLI T1098.001 (Additional Cloud Credentials) Gemiddeld
Metadata server token theft IMDS exploitation curl T1552.005 (Cloud Instance Metadata API) Laag
Startup script secrets Credential in metadata curl, gcloud T1552.005 (Cloud Instance Metadata API) Laag
SSH key injection Metadata modification gcloud CLI T1098.004 (SSH Authorized Keys) Gemiddeld
Cloud Function secrets Environment variable theft gcloud CLI T1552.001 (Credentials in Files) Laag
Cloud Function source Source code access gcloud, gsutil T1213 (Data from Information Repositories) Gemiddeld
Public bucket access Storage enumeration curl, gsutil T1530 (Data from Cloud Storage) Laag
Signed URL abuse Token reuse curl T1550.001 (Application Access Token) Laag
GKE RBAC abuse Kubernetes privilege escalation kubectl T1078.004 (Cloud Accounts) Gemiddeld-Hoog
GKE metadata access Pod → node escalation curl T1552.005 (Cloud Instance Metadata API) Gemiddeld
BigQuery data access Cross-project queries bq CLI T1530 (Data from Cloud Storage) Gemiddeld
setIamPolicy abuse Direct policy modification gcloud CLI T1098.003 (Additional Cloud Roles) Laag (als je de perm hebt)
actAs escalation Resource creation as SA gcloud CLI T1098.003 (Additional Cloud Roles) Gemiddeld
Custom role privesc Overprivileged role abuse gcloud CLI T1078.004 (Cloud Accounts) Gemiddeld
Audit log evasion SA impersonation, timing gcloud CLI T1562.008 (Disable Cloud Logs) Hoog
Data exfiltratie Storage/BQ export gsutil, bq T1537 (Transfer Data to Cloud Account) Gemiddeld

De cloud is geen magie. Het is andermans datacenter met een mooie API erboven. De aanvallen zijn anders dan on-premises — geen NTLM-hashes, geen Kerberos-tickets, geen vergeten service accounts met wachtwoorden uit 2019. Maar de patronen zijn hetzelfde: te brede rechten, vergeten configuratie, en het onwrikbare geloof dat iemand anders het wel in de gaten houdt. Niemand houdt het in de gaten. Behalve wij.

Op de hoogte blijven?

Ontvang maandelijks cybersecurity-inzichten in je inbox.

← Cloudbeveiliging ← Home