---
title: IAM policies should adhere to least-privilege
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > IAM policies should adhere to
  least-privilege
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# IAM policies should adhere to least-privilege
 
## Description{% #description %}

IAM policies grant privileges to users, groups, or roles. Following the principle of least privilege, grant only the permissions required to perform a task rather than full administrative privileges. Customer managed policies that are attached to an identity and contain a statement with `"Effect": "Allow"`, `"Action": "*"`, and `"Resource": "*"` grant full administrative access.

This rule evaluates the default version document of each attached customer managed IAM policy. The policy fails if any statement allows all actions (`*`) on all resources (`*`). A policy whose default version document is missing, empty, or not valid JSON also fails, as does a policy whose attachment count is missing. The `Effect` comparison is case-insensitive, and unattached policies are skipped. AWS managed policies collected in `aws_iam_policy` are also evaluated when attached. The companion rule "AWS managed IAM policies that allow full administrative privileges should not be attached" checks managed policy attachments on roles, users, and groups, including `AdministratorAccess` when its document is not collected.

## Remediation{% #remediation %}

1. In the IAM console, open the policy and identify the users, groups, and roles on its **Entities attached** tab.
1. Detach the policy from each of these entities, as described in [Adding and removing IAM identity permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html).
1. Replace the policy with one that grants only the specific actions and resources required. See [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).

## References{% #references %}

- [Adding and removing IAM identity permissions](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html)
- [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege)
- [CIS Amazon Web Services Benchmarks](https://www.cisecurity.org/benchmark/amazon_web_services)
