• Home
  • »
  • AWS Documentation
  • »
  • IAM
  • »
  • Ensure IAM policies do not allow permissions management / resource exposure without constraint

Resource exposure allows modification of policies and exposes resources

Description

This policy grants permissions that enable the modification of resource-based policies or actions that can inadvertently expose AWS resources to public access, thereby increasing the risk of unauthorized resource exposure.

Examples of such actions include:

  1. s3:PutBucketPolicy, s3:PutBucketAcl, and s3:PutObjectAcl: These actions allow modification of access control settings on S3 buckets and objects, potentially exposing sensitive data to unauthorized actors or making it publicly accessible on the internet.

  2. ecr:SetRepositoryPolicy: This permission allows an attacker to alter the repository policy in Amazon Elastic Container Registry (ECR), potentially enabling the exfiltration of container images (which may unintentionally contain sensitive data, such as secrets or private information), tampering with container images, or modifying repository settings.

  3. iam:UpdateAssumeRolePolicy: This action could allow an attacker to manipulate the AssumeRole policy, potentially creating a backdoor by enabling access to a privileged role from an external AWS account, thereby escalating privileges.

  4. Resource Access Manager modifications: The ability to modify settings in AWS Resource Access Manager (RAM) could enable an attacker to share a VPC containing sensitive or internal services with unauthorized AWS accounts, potentially exposing critical infrastructure to malicious actors.

Attackers can exploit Resource Exposure permissions to easily expose AWS resources to unauthorized users or to the public internet. This is a common tactic demonstrated by Endgame, a penetration testing tool for AWS, released by Salesforce, which highlights how these permissions can be weaponized.

For more detailed information, please refer to the https://cloudsplaining.readthedocs.io/en/latest/glossary/resource-exposure/

Fix - Buildtime

Terraform

  • Resource: aws_iam_policy_document
  • Argument: effect + actions
data "aws_iam_policy_document" "example" {
  statement {
    sid = "1"
    effect = "Allow"
    actions = [
      "s3:*"
    ]     
    resources = [
      "foo",
    ]
  }
}

CloudFormation

  • Resource: aws_iam_policy_document
  • Argument: effect + actions
Type: 'AWS::IAM::ManagedPolicy'
    Properties:
      ...
      PolicyDocument:
        ...
        Statement:
          - Effect: Allow
            Action: 
            - 's3:*'
            Resource: 'foo'
ReLambda