> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/aws-iam-policy-allows-full-administrative-privileges.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# AWS IAM policy allows full administrative privileges

### Synopsis

| Field               | Value                                                |
| ------------------- | ---------------------------------------------------- |
| Rule Type           | Detection                                            |
| Finding Type        | AWS IAM policy allows full administrative privileges |
| Finding ID          | 60000042                                             |
| Generates a Finding | This detection rule also generates a finding         |
| Severity            | High                                                 |
| Category            | CONFIGURATION                                        |
| Cloud Providers     | AWS                                                  |
| Platform Module     | CSPM                                                 |
| Asset Types         | AWS\_IAM\_POLICY                                     |
| ATT\&CK Tactic      | TA0004 (TA0004)                                      |
| ATT\&CK Technique   | T1078.004 (T1078.004)                                |

### Description

AWS IAM policy granting full administrative privileges presents a significant security risk. This misconfiguration allows users or roles excessive access to AWS resources, potentially enabling unauthorized modifications, data breaches, and service disruptions.

The IAM service manages user and role permissions within AWS. Granting 'AdministratorAccess' or similar broad policies bypasses the principle of least privilege. Attackers gaining control of a user or role with such excessive permissions can easily compromise the entire AWS environment. They could modify configurations, delete resources, exfiltrate data, or launch malicious activities undetected.

The impact of this misconfiguration includes data loss, service outages, and significant financial costs. Maintaining least privilege ensures that even if a user account is compromised, the attacker's actions are limited to a specific scope. This minimizes the potential damage from a security incident.

Mitigation involves regularly reviewing and refining IAM policies. Grant only the necessary permissions for each user or role. Implement robust monitoring and alerting for unusual activity. Use AWS Identity Center to centrally manage identity and access. Employ multi-factor authentication (MFA) for all users.

### Remediation

**Manual steps:**

AWS IAM Policy - The identified IAM policy grants full administrative privileges, which is a significant security risk. This policy allows the associated users, groups, or roles to perform any action within the AWS account, potentially leading to unauthorized access and data breaches. It is crucial to adhere to the principle of least privilege and grant only the necessary permissions for each user, group, or role:

1. **Identify the Policy:** Log in to the AWS Console and navigate to the IAM dashboard. Search for the policy name reported in the finding.
2. **Detach the Policy:** Select the policy and click on 'Policy actions'. Choose 'Detach'.
3. **Select Entities:** Select all Users, Groups, and Roles that have this policy attached. Click on 'Detach policy'.

**Note:** Carefully review the attached entities and their associated permissions before detaching the policy. Ensure that the necessary permissions are granted through other policies or mechanisms to maintain the functionality of the affected users, groups, or roles. Thoroughly test the changes after detaching the policy to avoid any unintended consequences.

**CLI code:**

AWS IAM Policy - This command detaches the IAM policy with full administrative privileges from the specified user. This removes the user's access to all AWS resources and services, effectively mitigating the security risk:

```bash
aws iam detach-user-policy --user-name <userName> --policy-arn ${entity} --region ${entity}
```

AWS IAM Policy - This command detaches the IAM policy with full administrative privileges from the specified Group. This removes the group's access to all AWS resources and services, effectively mitigating the security risk:

```bash
aws iam detach-group-policy --group-name <groupName> --policy-arn ${entity} --region ${entity}
```

AWS IAM Policy - This command detaches the IAM policy with full administrative privileges from the specified role. This removes the role's access to all AWS resources and services, effectively mitigating the security risk:

```bash
aws iam detach-role-policy --role-name <roleName> --policy-arn ${entity} --region ${entity}
```

**Terraform code:**

AWS IAM Policy - This Terraform code snippet modifies an existing IAM policy by removing the wildcard actions and resources and replacing them with specific actions and resources. This ensures that the policy only grants the necessary permissions, adhering to the principle of least privilege:

```hcl
# This code snippet modifies the existing IAM policy to remove the full administrative privileges.
# It removes the wildcard actions and resources, and replaces them with specific actions and resources.
# This ensures that the policy only grants the necessary permissions, adhering to the principle of least privilege.
resource "aws_iam_policy" "policy_to_modify" {
 # Replace with the actual name of the policy to be modified
 name = "policy_to_modify"

 policy = jsonencode({
 Version = "2012-10-17"
 Statement = [
 {
 # Replace with the specific actions and resources required by the policy
 Action = ["ec2:DescribeInstances", "ec2:DescribeVpcs"]
 Effect  = "Allow"
 Resource = ["arn:aws:ec2:REGION:ACCOUNT_ID:instance/*", "arn:aws:ec2:REGION:ACCOUNT_ID:vpc/*"]
 },
 ]
 })
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/aws-iam-policy-allows-full-administrative-privileges.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
