> 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_access_key.md).

# AWS\_CAN\_CREATE\_ACCESS\_KEY

## Summary

|                                |                                           |
| ------------------------------ | ----------------------------------------- |
| **FSProtect ACL Alias**        | AWS\_CAN\_CREATE\_ACCESS\_KEY             |
| **Edge Type**                  | Attack Path                               |
| **Affected Object Types**      | IAM Users                                 |
| **Exploitation Certainty**     | Certain                                   |
| **AWS IAM Action / Condition** | `iam:CreateAccessKey` for target IAM user |

## Description

`AWS_CAN_CREATE_ACCESS_KEY` represents the ability to create long-term API credentials for an IAM user.

This edge is highly sensitive because an attacker can:

* Generate a new key pair for a privileged user.
* Authenticate via AWS CLI/SDK as that user.
* Maintain persistence through long-lived credentials if key governance is weak.

If a target user already has two keys (the IAM limit), this path is often chained with [`AWS_CAN_DELETE_ACCESS_KEY`](https://docs.forestall.io/fsprotect/edges/aws/aws_can_delete_access_key).

## Identification

### AWS CLI

Check permission simulation:

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

Review current keys on the target user:

```bash
aws iam list-access-keys --user-name TargetUser
```

### AWS Console

* Open **IAM** -> **Users** -> select the target user.
* Open **Security credentials** tab.
* Under **Access keys**, verify whether the user already has 0, 1, or 2 active keys.
* To determine who can create access keys for this user, check the **Permissions** tab of potential source users/roles for the `iam:CreateAccessKey` permission.

## Exploitation

### AWS CLI

Create a key for the target user:

```bash
aws iam create-access-key --user-name TargetUser
```

Use the returned `AccessKeyId` and `SecretAccessKey` with AWS CLI/SDK to act as that user.

## Mitigation

* Restrict `iam:CreateAccessKey` to dedicated break-glass workflows.
* Prefer role-based temporary credentials (STS) over long-term user keys.
* Enforce key rotation and immediate revocation for unused credentials.
* Apply SCP and IAM guardrails that block user key creation where not required.

## Detection

Monitor CloudTrail for access key creation:

* **Event source**: `iam.amazonaws.com`
* **Event name**: `CreateAccessKey`

Example lookup:

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

Investigate actor-target mismatches (caller creating key for a different user).

## References

* <https://docs.aws.amazon.com/IAM/latest/APIReference/API_CreateAccessKey.html>
* <https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListAccessKeys.html>
* <https://docs.aws.amazon.com/general/latest/gr/iam-service.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_access_key.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.
