More Info:
This rule checks each AWS Identity and Access Management (IAM) resource to see if a policy with the specified Amazon Resource Name (ARN) in the input parameter is attached. The rule is NON_COMPLIANT if the specified policy ARN is attached to the IAM resource.Risk Level
MediumAddress
SecurityCompliance Standards
CBPTriage and Remediation
- Prevention
- Cause
- Remediation
How to Prevent
Using Console
Using Console
To prevent blacklisted IAM policies in AWS using the AWS Management Console, follow these steps:
-
Review IAM Policies Regularly:
- Navigate to the IAM Dashboard in the AWS Management Console.
- Click on “Policies” in the left-hand menu.
- Regularly review the list of policies to ensure none of them are blacklisted or overly permissive.
-
Use IAM Access Analyzer:
- In the IAM Dashboard, select “Access Analyzer” from the left-hand menu.
- Create an analyzer if you haven’t already.
- Use the analyzer to identify and review policies that grant access to resources outside your organization or that are overly permissive.
-
Enable AWS Config Rules:
- Go to the AWS Config service in the AWS Management Console.
- Create or use existing AWS Config rules to continuously monitor IAM policies.
- Enable rules such as
IAM_POLICY_NO_STATEMENTS_WITH_ADMIN_ACCESSto detect and alert on blacklisted policies.
-
Implement Policy Validation:
- When creating or updating IAM policies, use the policy validation feature.
- In the IAM policy editor, click on “Validate Policy” to check for any issues or overly permissive permissions.
- Address any warnings or errors before saving the policy.
Using CLI
Using CLI
To prevent blacklisted IAM policies in AWS using the AWS CLI, you can follow these steps:
-
List Existing IAM Policies:
- First, you need to list all the existing IAM policies to identify any that might be blacklisted.
-
Describe IAM Policies:
- For each policy, describe the policy to get its details and check if it matches any blacklisted criteria.
-
Create a Policy with Allowed Actions:
- Create IAM policies that only include allowed actions and avoid any blacklisted actions.
-
Attach Policies to Users, Groups, or Roles:
- Ensure that only the approved policies are attached to users, groups, or roles.
Using Python
Using Python
To prevent blacklisted IAM policies in AWS, Azure, and GCP using Python scripts, you can follow these steps:
AWS (Amazon Web Services)
-
Install Boto3 Library:
Ensure you have the Boto3 library installed to interact with AWS services.
-
Define Blacklisted Policies:
Create a list of blacklisted policies that you want to check against.
-
Check IAM Policies:
Write a script to list all IAM policies and check if any of them are blacklisted.
- Automate and Schedule: Automate the script to run at regular intervals using AWS Lambda or a cron job to ensure continuous compliance.
Azure (Microsoft Azure)
-
Install Azure SDK:
Ensure you have the Azure SDK installed to interact with Azure services.
-
Define Blacklisted Policies:
Create a list of blacklisted policies that you want to check against.
-
Check IAM Policies:
Write a script to list all IAM policies and check if any of them are blacklisted.
- Automate and Schedule: Automate the script to run at regular intervals using Azure Functions or a cron job to ensure continuous compliance.
GCP (Google Cloud Platform)
-
Install Google Cloud SDK:
Ensure you have the Google Cloud SDK installed to interact with GCP services.
-
Define Blacklisted Policies:
Create a list of blacklisted policies that you want to check against.
-
Check IAM Policies:
Write a script to list all IAM policies and check if any of them are blacklisted.
- Automate and Schedule: Automate the script to run at regular intervals using Google Cloud Functions or a cron job to ensure continuous compliance.

