How to Reduce the Risk of AWS Access Keys with Least-Privilege IAM

Summary
Wiz outlines ways to reduce AWS access-key risk: identify high-impact keys, remove unnecessary IAM permissions, add policy restrictions, proxy sensitive access, and isolate key-dependent functionality.
Key points
- Prioritize keys with broad privileges or access to sensitive accounts and data.
- Use IAM Access Advisor to identify unnecessary service-level permissions and Access Analyzer policy generation to help determine required actions; recommendations depend on CloudTrail data.
- Review permissions that enable privilege escalation or resource discovery, such as some iam or sts privileges and s3:ListAllMyBuckets.
- Restrict access to specific resources where feasible, using CloudTrail logs or application source code to guide review.
- Consider policy conditions such as aws:SourceIp, while accounting for possible IP changes; VPC endpoints may be preferable in some network setups.
- Proxy sensitive operations or isolate access-key-dependent tasks in a narrowly privileged service to add controls and limit exposure.
Article Details
- Defense Focus
- Reduce the risk of compromised AWS access keys and other identity principals through least-privilege IAM policies, access restrictions, and isolation of sensitive operations.
- Detection Methods
- Identify high-risk keys by reviewing attached privileges, sensitive account context, and access to sensitive data.
- Use IAM Access Advisor information to identify service-level permissions that may be unnecessary.
- Use Access Analyzer policy generator to review required action-level permissions, recognizing that its suggestions depend on CloudTrail records and may miss cases.
- Review CloudTrail logs or application source code to determine which individual resources a principal needs to access.
- Data Sources
- IAM policy and principal configuration
- IAM Access Advisor information
- Access Analyzer policy-generator findings
- CloudTrail logs
- Application source code
- Account sensitivity and sensitive-data access context
- Platforms
- AWS
- Defensive Actions
- Remove unnecessary permissions and scope policies from broad administrative access to required services, actions, and resources.
- Review IAM and STS permissions for potential privilege-escalation capability, and remove resource-listing permissions such as s3:ListAllMyBuckets when they are not needed.
- Apply an aws:SourceIp policy condition where the source address is stable; consider VPC endpoints when appropriate to the network setup.
- Proxy sensitive data access through a service that can enforce rate limits, geo-IP restrictions, and data redaction or tokenization; consider S3 Object Lambdas where suitable.
- Isolate access-key-dependent functionality, such as generating long-lived S3 pre-signed URLs, in a dedicated microservice with limited privileges.
Products
AWSThis post is the second article in the series "How to get rid of AWS access keys". Read the first article at Part 1: The easy wins.CloudTrailit is worth noting that the Access Analyzer’s accuracy is based on the information AWS records in CloudTrail logs which has some special cases that can cause suggestions to miss things at times. IAM Access AdvisorAdministratorAccess policy may be restricted to just s3:* permissions instead. You can use AWS’s IAM Access Advisor information to identify the service level adjustments. IAM Access Analyzerwould be to identify the specific action level privileges required, which can be done with Access Analyzer policy generator. However, it is worth noting that the Access Analyzer’s accuracy is based on theS3 Object LambdasAlthough there are a number of ways to implement this type of risk mitigation, with AWS’s S3 Object Lambdas, it may be possible to implement with minimal changes to the external application.
