Policies that grant all permissions violate the principle of least privilege.

Why is this an issue?

Policies that grant all permissions — for example by using a wildcard (*) in the action field or by assigning an overly permissive role such as roles/owner — give an identity unrestricted access to all operations on a resource. Following the principle of least privilege, policies should grant only the minimum set of permissions required for the identity to perform its intended function. Overly permissive policies increase the risk of unintentional data modification, data exposure, or full cloud environment compromise if an identity is misused or stolen.

What is the potential impact?

Privilege escalation and data exposure

An attacker who gains control of an identity with full permissions can perform any operation on any resource, including reading, modifying, or deleting sensitive data. They can also escalate privileges by creating new identities or modifying other policies, potentially leading to a full compromise of the cloud environment.

How to fix it

Code examples

The following code grants full permissions to identities instead of limiting them to only those required.

Noncompliant code example

AWSTemplateFormatVersion: 2010-09-09
Resources:
  ExamplePolicy:
    Type: AWS::IAM::ManagedPolicy
    Properties:
        PolicyDocument:
            Version: "2012-10-17"
            Statement:
                - Effect: Allow
                  Action:
                    - "*" # Noncompliant
                  Resource:
                    - !Ref MyResource
        Roles:
            - !Ref MyRole

Compliant solution

AWSTemplateFormatVersion: 2010-09-09
Resources:
  ExamplePolicy:
    Type: AWS::IAM::ManagedPolicy
    Properties:
        PolicyDocument:
            Version: "2012-10-17"
            Statement:
                - Effect: Allow
                  Action:
                    - "s3:GetObject"
                  Resource:
                    - !Ref MyResource
        Roles:
            - !Ref MyRole

Resources

Documentation

Standards