T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- scripts/gcp-roles.json:14
- Finding
- Excessive Project-Wide IAM Permissions Violate Least Privilege<![CDATA[ ## Vulnerability Details **File Location**: `scripts/gcp-roles.json:14-44`; related setup instructions in `SKILL.md:83-100` **Vulnerability Type**: Excessive cloud IAM privileges **Risk Level**: Medium ### Vulnerable Code ```json "roles": [ { "role": "roles/viewer", "scope": "Project", "reason": "Read access to most GCP resources (storage, compute, firewall, BigQuery)" }, { "role": "roles/iam.securityReviewer", "scope": "Project", "reason": "Read access to IAM policies, service account keys, and security settings" }, { "role": "roles/cloudsql.viewer", "scope": "Project", "reason": "Read access to Cloud SQL instance configurations and SSL settings" }, { "role": "roles/logging.viewer", "scope": "Project", "reason": "Read access to audit log configuration and log sinks" }, { "role": "roles/dns.reader", "scope": "Project", "reason": "Read access to Cloud DNS zones for DNSSEC verification" }, { "role": "roles/cloudkms.viewer", "scope": "Project", "reason": "Read access to KMS key rotation policies" } ] ``` The documented setup grants every role at project scope: ```bash for role in roles/viewer roles/iam.securityReviewer roles/cloudsql.viewer roles/logging.viewer roles/dns.reader roles/cloudkms.viewer; do gcloud projects add-iam-policy-binding PROJECT_ID \ --member=serviceAccount:auditclaw-scanner@PROJECT_ID.iam.gserviceaccount.com \ --role=$role done ``` ### Technical Analysis The Skill implements narrowly defined read-only checks, but its setup grants six broad predefined roles across the entire target project. In particular, `roles/viewer`, `roles/iam.securityReviewer`, and `roles/logging.viewer` provide access to substantially more project metadata than is necessary for the implemented checks. The code only requires selected list/get operations for bucket settings, firewall rules, IAM policy bindings, service-account key metadata, logging con ...[truncated 1954 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the broad predefined-role bundle with a dedicated GCP custom role containing only the exact list/get permissions exercised by the check modules. 2. Split permissions by check category so users running only selected checks do not need permissions for unrelated services. 3. Document the precise API permissions required by each check and provide separate minimal-role deployment examples. 4. Prefer short-lived Application Default Credentials, service-account impersonation, or Workload Identity Federation over downloadable service-account JSON keys. 5. If JSON keys remain supported: - Create them only when no keyless alternative is available. - Store them outside repositories and shared directories. - Apply restrictive filesystem permissions. - Rotate them regularly. - Revoke and securely delete them after use. 6. Add deployment validation that warns when the scanner identity has roles or permissions beyond the documented minimal set. 7. Where practical, constrain access using IAM Conditions and organization policies. ]]>
