CVE-2021-30476
📋 TL;DR
This vulnerability in HashiCorp Terraform's Vault Provider incorrectly configures GCE-type bound labels for Vault's GCP authentication method, potentially allowing unauthorized access to Vault secrets. It affects organizations using Terraform to manage Vault with GCP authentication. The misconfiguration could bypass intended access controls.
💻 Affected Systems
- HashiCorp Terraform Vault Provider
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Attackers could gain unauthorized access to all Vault secrets, potentially compromising sensitive credentials, certificates, and encryption keys across the entire infrastructure.
Likely Case
Unauthorized access to Vault secrets by GCP entities that should be restricted, leading to credential theft and privilege escalation within cloud environments.
If Mitigated
With proper network segmentation and additional authentication layers, impact would be limited to specific Vault instances using vulnerable configurations.
🎯 Exploit Status
Exploitation requires access to GCP environment and knowledge of vulnerable Terraform configurations.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 2.19.1
Vendor Advisory: https://discuss.hashicorp.com/t/hcsec-2021-11-terraform-s-vault-provider-did-not-correctly-configure-bound-labels-for-gcp-auth/23464/2
Restart Required: No
Instructions:
1. Update terraform-provider-vault to version 2.19.1 or later. 2. Run 'terraform init -upgrade' to update provider. 3. Apply Terraform configuration changes. 4. Verify GCP auth method configurations are correct.
🔧 Temporary Workarounds
Manual GCP Auth Configuration
allConfigure Vault's GCP auth method manually via Vault CLI/API instead of Terraform provider
vault write auth/gcp/config credentials=@gcp-creds.json
vault write auth/gcp/role/my-role type="gce" bound_labels="key=value" policies="default"
Disable GCP Auth Method
allTemporarily disable GCP authentication method if not essential
vault auth disable gcp
🧯 If You Can't Patch
- Implement network-level access controls to restrict Vault access to trusted IP ranges only.
- Enable additional authentication factors (MFA) for Vault access and implement strict secret access policies.
🔍 How to Verify
Check if Vulnerable:
Check Terraform configuration files for 'terraform-provider-vault' version <2.19.1 and GCP auth method configurations with bound labels.
Check Version:
terraform version | grep -A5 'terraform-provider-vault'
Verify Fix Applied:
Verify provider version is ≥2.19.1 with 'terraform version' and validate GCP auth configurations in Vault.
📡 Detection & Monitoring
Log Indicators:
- Unusual authentication patterns from GCP entities in Vault audit logs
- Failed authentication attempts followed by successful access from unexpected GCP resources
Network Indicators:
- Vault API requests from unexpected GCP IP ranges
- Authentication requests without proper GCP metadata
SIEM Query:
source="vault-audit" (gcp_auth OR gce_auth) AND result="success" | stats count by entity_id, source_ip
🔗 References
- https://discuss.hashicorp.com/t/hcsec-2021-11-terraform-s-vault-provider-did-not-correctly-configure-bound-labels-for-gcp-auth/23464/2
- https://github.com/hashicorp/terraform-provider-vault/issues/996
- https://discuss.hashicorp.com/t/hcsec-2021-11-terraform-s-vault-provider-did-not-correctly-configure-bound-labels-for-gcp-auth/23464/2
- https://github.com/hashicorp/terraform-provider-vault/issues/996