Overview
Unused service identities are unnecessary attack surface.
What this control checks
Service identities with no observed usage during the evaluation window.
Why this matters
Removing unused identities reduces privilege sprawl and risk.
Remediation guidance
Remediation strategy
- Confirm identity is unused with owners and logs.
- Disable or remove permissions first.
- Delete identity after validation window.
GCP
gcloud iam service-accounts disable <sa>@<project-id>.iam.gserviceaccount.com
Azure
az identity list --query "[].{name:name,resourceGroup:resourceGroup,principalId:principalId}" -o table
az role assignment list --assignee <principal-id> -o table
References
- https://cloud.google.com/iam/docs/service-accounts-manage
- https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/manage-user-assigned-managed-identities-azure-cli
Service-wide remediation
Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.
AWS
Use AWS Organizations guardrails, AWS Config rules or conformance packs where they fit, approved account baselines, and IaC modules so new resources inherit the secure setting.
Azure
Use management group or subscription Azure Policy assignments, remediation tasks where supported, landing-zone standards, and IaC modules so drift is prevented at scale.
Google Cloud
Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.
Kubernetes
Use admission policies, baseline cluster configuration, GitOps templates, and namespace or workload guardrails so new deployments follow the control by default.
Alibaba Cloud
Use Resource Directory guardrails, account baselines, and IaC modules so the secure setting is applied consistently across environments.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
Unused AWS IAM Roles
Connectors
Covered asset types
Expected check: eq []
{
UnusedAWSIAMRoles {
...AssetFragment
}
}Unused Azure Managed Identities
Connectors
Covered asset types
Expected check: eq []
{
UnusedAzureManagedIdentities {
...AssetFragment
}
}Unused Google Cloud Service Accounts
Connectors
Covered asset types
Expected check: eq []
{
UnusedGoogleCloudIAMServiceAccounts {
...AssetFragment
}
}Unused Kubernetes Service Accounts
Connectors
Covered asset types
Expected check: eq []
{
UnusedK8sServiceAccounts {
...AssetFragment
}
}Unused Alibaba RAM Roles
Connectors
Covered asset types
Expected check: eq []
{
UnusedAlibabaIAMRoles {
...AssetFragment
}
}
Alibaba Cloud
AWS
Google Cloud
Kubernetes
Microsoft Azure