# Ensure No IAM Inline Policies Allow Actions That May Lead to Privilege Escalation

- Source: https://support.icompaas.com/support/solutions/articles/62000233811-ensure-no-iam-inline-policies-allow-actions-that-may-lead-to-privilege-escalation
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [AWS Checks New Version](https://support.icompaas.com/support/solutions/62000112673) › [AWS New Checks](https://support.icompaas.com/support/solutions/folders/62000169206)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

### **Profile Applicability:**

-   ### **Level 2**
    

### **Description:**

IAM (Identity and Access Management) allows the creation of both customer-managed policies and inline policies. Inline policies are directly embedded within IAM roles, groups, or users. Privilege escalation occurs when a user or entity gains higher levels of access than they were initially assigned, typically through actions that modify permissions. This SOP ensures that inline policies are regularly reviewed to prevent actions that could lead to privilege escalation, maintaining security and control over access management.

### **Rationale:**

Privilege escalation can occur if inline policies are overly permissive or allow actions like attaching policies, modifying user permissions, or assuming roles with elevated privileges. Such actions can inadvertently grant higher-level permissions to unauthorized users. Ensuring no inline policies allow privilege escalation reduces the risk of unauthorized access and maintains a secure and compliant AWS environment.

### **Impact:**

If an inline policy allows privilege escalation:

-   It may allow users or roles to perform unauthorized actions, such as modifying IAM roles or policies.
    
-   It can lead to unintended administrative access, potentially allowing malicious or accidental security breaches.
    
-   Violates the principle of least privilege and can lead to non-compliance with security standards such as SOC 2, ISO 27001, and others.
    

### **Default Value:**

By default, IAM inline policies are not set to grant actions that could result in privilege escalation unless explicitly configured. However, incorrect policy assignments or insufficient reviews can lead to dangerous configurations.

### **Pre-requisites:**

-   Access to AWS Management Console or AWS CLI with sufficient IAM permissions.
    
-   Familiarity with IAM inline policies and the risks of privilege escalation.
    
-   Understanding the principle of least privilege and AWS security best practices.
    

## **Remediation:**

## **Test Plan:**

#### **Using AWS Console:**

1.  Login to the AWS Management Console.
    
2.  Navigate to Users/Roles in the [AWS IAM console.](https://us-east-1.console.aws.amazon.com/iam/home?region=ap-south-1#/policies)
    
3.  For each IAM user, group, and role, go to the Permissions tab.
    
4.  Under Inline Policies, review the policies attached to each user, group, or role.
    
5.  Check the policy JSON for any actions that allow modifying IAM resources (e.g., iam:AttachUserPolicy, iam:PutRolePolicy, iam:PassRole, iam:CreatePolicy, etc.) or granting excessive privileges.
    
6.  Remove or modify policies that allow actions potentially leading to privilege escalation.
    

#### **Using AWS CLI:**

1.  List all IAM users, groups, and roles with the following command:  
    
    aws iam list-users
    aws iam list-roles
    aws iam list-groups
    

2.  For each user, group, or role, list the inline policies attached:  
    
    aws iam list-user-policies --user-name <USER\_NAME>
    aws iam list-group-policies --group-name <GROUP\_NAME>
    aws iam list-role-policies --role-name <ROLE\_NAME>
    

3.  Retrieve and review the inline policy for each user, group, or role:  
    
    aws iam get-user-policy --user-name <USER\_NAME> --policy-name <POLICY\_NAME>
    aws iam get-group-policy --group-name <GROUP\_NAME> --policy-name <POLICY\_NAME>
    aws iam get-role-policy --role-name <ROLE\_NAME> --policy-name <POLICY\_NAME>
    

4.  Examine the JSON policy to check for actions that could allow privilege escalation (e.g., iam:AttachUserPolicy, iam:PassRole, iam:CreatePolicy).
    
5.  Remove or modify any policies that allow privilege escalation:  
    
    aws iam delete-user-policy --user-name <USER\_NAME> --policy-name <POLICY\_NAME>
    aws iam delete-group-policy --group-name <GROUP\_NAME> --policy-name <POLICY\_NAME>
    aws iam delete-role-policy --role-name <ROLE\_NAME> --policy-name <POLICY\_NAME>
    

### **Implementation Plan:**

#### **Using AWS Console:**

1.  Login to the AWS Management Console.
    
2.  Navigate to Users/Groups/roles in the [AWS IAM console.](https://us-east-1.console.aws.amazon.com/iam/home?region=ap-south-1#/policies)
    

    ![](https://support.icompaas.com/assets/kb/7385dd3a1c19933e.png)

3.  Go to each user, group, or role, and check the attached inline policies.
    

![](https://support.icompaas.com/assets/kb/8d49e21f18728579.png)

4.  Click on the Inline policy and check the actions that modify IAM resources or allow users to assume higher-privilege roles.
    

![](https://support.icompaas.com/assets/kb/b640f7838bddf236.png)

5.  If a policy contains such permissions, remove it, ensuring that it is restricted to only the necessary actions for the user's role.
    

![](https://support.icompaas.com/assets/kb/6b018943120e2e38.png)

6.  Apply the principle of least privilege to restrict the scope of inline policies.
    

#### **Using AWS CLI:**

1.  Useto identify all IAM entities.  
    
    aws iam list-roles, aws iam list-users, or aws iam list-groups
    
2.  List the inline policies attached to each entity using the corresponding commands.  
    
    aws iam list-\*
    
3.  For each inline policy, retrieve its details using aws iam get-\* commands.
    
4.  Review the policy for any actions related to IAM resource modifications (e.g., iam:CreatePolicy, iam:PutRolePolicy, etc.).
    
5.  Remove any inline policies that allow these actions using aws iam delete-\* commands.
    
6.  Reapply principle of least privilege to ensure only necessary permissions are granted.
    

### **Backout Plan:**

**Using AWS Console:**

1.  If disabling or modifying inline policies causes issues for legitimate users, sign in to the AWS Management Console.
    
2.  Re-attach or modify the inline policy as necessary, but ensure that the modified policy does not grant privilege escalation actions.
    
3.  Review and verify that no user or role has excessive IAM permissions.
    

**Using AWS CLI:**

1.  If you need to re-attach an inline policy that was removed, run:  
    
    aws iam put-user-policy --user-name <USER\_NAME> --policy-name <POLICY\_NAME> --policy-document <POLICY\_DOCUMENT\_JSON>
    
2.  Verify that the inline policy has been successfully reattached:  
    
    aws iam list-inline-policies --user-name <USER\_NAME>
    

**Reference:**

-   [AWS IAM: Managing Inline Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_inline.html)
    
-   [AWS CLI: list-inline-policies](https://docs.aws.amazon.com/cli/latest/reference/iam/list-inline-policies.html)
    
-   [AWS CLI: delete-user-policy](https://docs.aws.amazon.com/cli/latest/reference/iam/delete-user-policy.html)
    
-   [AWS CLI: get-user-policy](https://docs.aws.amazon.com/cli/latest/reference/iam/get-user-policy.html)
    

**CIS Controls:**

<table style="border:none;border-collapse:collapse;font-family:&quot;Helvetica Neue&quot;"><colgroup style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"><col style="font-family:&quot;Helvetica Neue&quot;"></colgroup><tbody style="font-family:&quot;Helvetica Neue&quot;"><tr style="height:38.5pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">Version</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">Control ID</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;text-align:justify;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">Control Description</span></span></span></p></td></tr><tr style="height:38.5pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px;text-align:justify"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">7.1</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px;text-align:justify"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">3.1</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px;text-align:justify"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">Ensure&nbsp;IAM inline policies&nbsp;do not include actions that could lead to&nbsp;privilege escalation, such as modifying IAM policies or roles.</span></span></span></p></td></tr><tr style="height:38.5pt;font-family:&quot;Helvetica Neue&quot;"><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px;text-align:justify"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">7.1</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;;font-size:14px"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;font-size:14px;text-align:justify"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">8.1</span></span></span></p></td><td style="padding:5pt;overflow:hidden;overflow-wrap:break-word;font-family:&quot;Helvetica Neue&quot;"><p dir="ltr" style="line-height:1.38;margin-bottom:0pt;font-family:&quot;Helvetica Neue&quot;;text-align:justify"><span style="font-size:14px"><span style="font-family:Helvetica Neue"><span style="color:rgb(0, 0, 0);font-family:&quot;Helvetica Neue&quot;">Apply the&nbsp;principle of least privilege</span><span style="color:rgb(0, 0, 0);font-weight:400;font-family:&quot;Helvetica Neue&quot;">&nbsp;and restrict IAM policies to only the actions required by users, roles, and services.</span></span></span></p></td></tr></tbody></table>

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
