# AWS

### AWS account information enumeration

**AWS CLI access**

The `AWS Command Line Interface (AWS CLI)` can be used to access AWS resources through a command line utility. To setup the `AWS CLI` environment, notably the configuration of credentials, the `aws configure` command may be used.

The `aws configure` will ask for the following information, that will be stored (in clear-text) in the `config` and `credentials` files (by default in a `.aws` folder in the current's user home directory):

* `Access key ID`
* `Secret access key`
* AWS default region
* Output format

To create a `Access key ID` and `secret access key`, refer to the [AWS official documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html).

**Manual enumeration with AWS CLI**

The following commands can be used to retrieve basic information about the AWS account:

```bash
# Retrieves information about the IAM entity usage (number of users, groups, roles, etc.).
aws iam get-credential-report

# Lists the IAM users, with their creation date and password last used timestamp.
aws iam list-users

# Lists the users'access keys, with their status and creation date.
aws iam list-access-keys

# Lists the IAM groups (collection of IAM users that can be associated with specific permissions).
aws iam list-groups

# Retrieves the groups associated with a given user.
aws iam list-groups-for-user --user-name "<USERNAME>"

# Lists the IAM roles (an IAM identity that can be associated with specific permissions. An IAM role can be assumed can users allowed to do so).
aws iam list-roles

# Lists all the IAM policies (an IAM policy grants IAM identities - users, groups, or roles - to resources. Permissions in the policies determine whether an IAM principal (user or role) request is allowed or denied.)
aws iam list-policies

# Lists all the IAM policy names and ARN.
aws iam list-policies --query 'Policies[*].[PolicyName, Arn]' --output text

# Lists the metadata of the specified IAM policy.
aws iam list-policies --query 'Policies[?PolicyName==`<POLICY_NAME>`]'

# Retrieves the IAM policies associated with the specified user / group / role.
# Inline IAM policies embedded in the specified IAM user.
aws iam list-user-policies --user-name "<USERNAME>"
# IAM policies attached to the specified IAM user.
aws iam list-group-policies --group-name "<GROUPNAME>"
aws iam list-role-policies --role-name "<ROLENAME>"

# Lists all the IAM users, groups, and roles that the specified policy is attached to.
# Example policy ARN: arn:aws:iam::aws:policy/service-role/AWSApplicationMigrationReplicationServerPolicy
aws iam list-entities-for-policy --policy-arn "<POLICY_ARN>"

# Lists the version associated with an IAM policy.
aws iam list-policy-versions --policy-arn "<POLICY_ARN>"

# Retrieves the permissions associated with an IAM policy (and policy version).
aws iam get-policy-version --policy-arn "<POLICY_ARN>" --version-id "<v1 | POLICY_VERSION_ID>"

# Lists the S3 buckets in the account.
aws s3 ls

# Retrieves more detailed (compared to s3 ls) information on a bucket (and bucket files).
aws s3api list-objects --bucket <BUCKET_NAME>

# Download / upload files from / to a S3 bucket.
# Source / destination for s3://<BUCKET> or local path.
aws s3 cp [--recursive] <SOURCE> <DEST>
```

**Automated enumeration with ScoutSuite**

[`Scout Suite`](https://github.com/nccgroup/ScoutSuite) leverage the API provided by AWS (as well as other possible Cloud providers) to automatically enumerate the configuration of the account. It can be used to quickly gather information on the attack surface of the AWS account across all regions.

```bash
python3 scout.py aws [--access-key-id <ACCESS_KEY_ID>] [--secret-access-key <ACCESS_KEY_SECRET>]
```

### AWS logs overview

A number of log sources are available in `AWS` that can be useful for incident response purposes:

| Name             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `CloudTrail`     | <p>Logs of every operation conducted in the AWS account. Essentially logs all API calls made in the account.<br><br>For each action / operation, the following information are logged:<br>- Unique Event ID.<br>- Event name (such as <code>ListPolicies</code>, <code>AssumeRole</code>, etc.).<br>- The timestamp of the operation.<br>- The region the operation was conducted in.<br>- Information on who realized the action (IAM identity, source IP address, user agent).<br>- The eventual impacted resource.<br>- The eventual request parameters.<br>- ...</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `CloudWatch`     | <p>System performance metrics, such as CPU usage, filesystem or network inputs/outputs, etc.<br><br>An additional <code>CloudWatch</code> agent can be installed on EC2 hosts to forward OS-level logs to <code>CloudWatch</code>.<br><br>Additionally, <code>CloudTrail</code> logs can be forwarded to <code>CloudWatch</code>, for instance to configure automated alerting.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `Config`         | Logs periodically the configuration state of a number of resources (`EC2`, `VPC`, security groups, etc.). Can be used to detect change in configuration and retrieve historical data on configuration changes (who and when was a given resource created / modified).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `S3 Access Logs` | <p>Logs bucket-level activities, i.e access, upload, modification, and deletion of data stored in a <code>S3 bucket</code> (versus operation on the bucket object itself as logged by <code>CloudTrail</code>).<br><br><code>S3 Access Logs</code> i disabled by default and must be enabled on a per bucket basis.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `VPC Flow Logs`  | <p>Logs <code>VPC</code>-level <code>IP</code> network traffic to <code>CloudWatch</code>.<br><br>Different version of <code>VPC Flow Logs</code>, 2 to 5 to date, can be enabled. Higher versions record an increased number of fields per record. The <code>version 2</code>, enabled by default, records the following fields (in order):<br>- version number.<br>- account id (AWS account ID of the owner of the source network interface for which traffic is recorded).<br>- interface id (ID of the network interface for which the traffic is recorded).<br>- source address.<br>- destination address.<br>- source port.<br>- destination port.<br>- network protocol.<br>- number of packets transferred during the "flow" log.<br>- number of bytes transferred during the "flow" log.<br>- start of the "flow" log.<br>- end of the flow log.<br>- whether the traffic was accepted (<code>ACCEPT</code>) or rejected (<code>REJECT</code>).<br>- status of the flow log.<br><br>For more information on <code>VPC Flow Logs</code>, refer to the official <a href="https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html">AWS documentation</a>.</p> |
| `WAF Logs`       | <p>Logs requests processed by the <code>AWS WAF</code> service. <code>WAF Logs</code> can notably be forwarded to <code>CloudWatch</code> or stored in a <code>S3</code> bucket.<br><br>Information about the request (source IP, eventual requests headers, eventual parameters, etc.) as well as the rule matched are logged.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

### AWS logs collection

**Multi-regions CloudTrail logs export**

The [`awsCloudTrailDownload.py`](https://github.com/dlcowen/sansfor509/blob/main/AWS/awsCloudTrailDownload.py) Python script can be used to download the `CloudTrail` logs across all regions.

```bash
python awsCloudTrailDownload.py
```

**Automated logs export with Invictus-AWS**

The [`Invictus-AWS`](https://github.com/invictus-ir/Invictus-AWS) Python script can be used to retrieve information about the environment (service usage and configuration) and export logs from a number of sources (`CloudTrail`, `CloudWatch`, `S3 Access Logs`, ...) to an `S3` bucket. `Invictus-AWS` is region bound.

```
# Configures the required API access.
aws configure

# Exports the configuration and logs from the specified region (such as "us-east-1").
python3 invictus-aws.py --region=<REGION>

# Downlaods locally the exported / collected elements from invictus-aws.py.
aws s3 cp --recursive s3://<INVICTUS_BUCKET> <EXPORT_FOLDER>
```

**CloudWatch logs export with awslogs**

The [`awslogs`](https://github.com/jorgebastida/awslogs) utility can be used to access and filter the AWS `CloudWatch` logs. `awslogs` requires the permissions associated with the [`CloudWatchLogsReadOnlylAccess` policy](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-identity-based-access-control-cwl.html).

```bash
awslogs <get | groups | streams> [--aws-region "<AWS_REGION>"] [--aws-access-key-id "<ACCESS_KEY_ID>"] [--aws-secret-access-key "<ACCESS_KEY_SECRET>"]

# Lists the existing logs groups.
awslogs groups

# Lists the streams in the specified log group.
awslogs streams <LOG_GROUP>

# Retrieves the logs in all or the specified log group / stream.
# The start / end filtering support multiple filtering options: DD/MM/YYYY HH:mm, <INT><m | h | d | w>.
awslogs get <ALL | LOG_GROUP> <ALL | LOG_GROUP_STREAM> -s <START> -e <END>
```

### CloudTrail logs analysis

**CloudTrail key fields**

| Field name                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `eventTime`                       | Event timestamp in `UTC`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `awsRegion`                       | The region the request was made to, such as `us-east-1`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `eventSource`                     | <p>The service the request was made to.<br><br>Such as <code>s3.amazonaws.com</code> for <code>S3</code> buckets, <code>sts.amazonaws.com</code> for the <code>Security Token Service (STS)</code> for temporary credentials request, etc.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `eventName`                       | <p>The request action, matching one of the API for that service.<br><br>For example, <code>AssumeRole</code>, <code>ListBuckets</code>, <code>SendCommand</code>, etc.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <p><code>errorCode</code><br></p> | The error code and human-readable error message associated with an event if (and only if) the operation failed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `readOnly`                        | Whether the operation is a read-only operation (`true` or `false`).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `userIdentity`                    | <p>Information about the user that made the request.<br><br>\* <code>userIdentity.type</code>: the type of the identity.<br>Possible types:<br>- <code>Root</code>: account root user.<br>- <code>IAMUser</code>: IAM user.<br>- <code>AssumedRole</code>: temporary security credentials obtained with a role by making a call to the <code>AWS STS</code>'s <code>AssumeRole</code> API.<br>- <code>Role</code>:<br>- <code>FederatedUser</code>: temporary security credentials for a federated user (<code>Active Directory</code>, <code>AWS Directory Service</code>, etc.), obtained via a call to the <code>AWS STS</code>'s <code>GetFederationToken</code> API. - <code>AWSAccount</code>: An account from another tenant / AWS account.<br>- <code>AWSService</code>: AWS account that belongs to an AWS service.<br><br>\* \[Optional] <code>userIdentity.userName</code>: Human readable name of the identity that made the call.<br>Generally only available for <code>IAMUser</code> or <code>Root</code> identity.<br><br>\* \[Optional] <code>userIdentity.arn</code>: <code>ARN</code> of the entity (user or role) that made the call.<br><br>\* \[Optional] <code>userIdentity.principalId</code>: Unique identifier for the entity that made the call.<br>For temporary security credentials, this value includes the session name. For instance, for <code>AssumedRole</code> events, the <code>principalId</code> is the unique identifier that contains the role ID and the role session name returned in the <code>AssumeRole</code> event's <code>responseElements.assumedRoleUser.assumedRoleId</code>.<br><br>\* \[Optional] <code>userIdentity.accountId</code>: The account that owns the entity that granted permissions for the request<br><br>\* \[Optional] <code>userIdentity.accessKeyId</code>: The eventual <code>access key ID</code> that was used to make the request.<br><code>Access key IDs</code> beginning with <code>AKIA</code> are long-term credentials (for an <code>IAM user</code> or the AWS account root user) while <code>access key IDs</code> beginning with <code>ASIA</code> are temporary credentials (created using <code>AWS STS</code> operations).<br><br>\* \[Optional] <code>userIdentity.sessionContext</code>: Populated for requests made with temporary security credentials to contain information about the session that was created.<br><code>userIdentity.sessionContext.creationDate</code>: when the session was created.<br><code>userIdentity.sessionContext.mfaAuthenticated</code>: whether the initial credentials were authenticated MFA.<br><code>userIdentity.sessionContext.</code>:<br><code>userIdentity.sessionContext.sourceIdentity</code>: the original identity (user or role) making the request (with <code>type</code>, <code>arn</code>, <code>userName</code> sub-fields).</p> |
| `sourceIPAddress`                 | <p>The IP address that the request was made from.<br><br>For requests from services within AWS, only the <code>DNS</code> name of the service (for example <code>ec2.amazonaws.com</code>) is displayed.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `userAgent`                       | The `User-Agent` through which the request was made.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `sessionCredentialFromConsole`    | Whether the operation was conducted through the web console (`true` or `false`).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `resources`                       | <p>A list of resource(s) accessed in the event.<br><br>For each resource, the following fields may be available:<br>- <code>type</code>: resource type identifier (in the format: <code>AWS::\<AWS\_SERVICE\_NAME>::\<AWS\_DATA\_TYPE\_NAME></code>).<br>- <code>ARN</code>: <code>ARN</code> of the resource.<br>- <code>accountId</code>: account that owns the resource.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `requestParameters`               | <p>The parameters, if any, that were sent with the request.<br><br>For example, <code>requestParameters.bucketName</code>, <code>requestParameters.userName</code>, etc.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `responseElements`                | <p>The response element(s) for actions that make changes (create, update, or delete actions).<br><br>For example, <code>responseElements.user.createDate</code>, <code>responseElements.accessKey.accessKeyId</code>, etc.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

**CloudTrail notable API / events**

| `eventSource`          | `eventName`                                                                                                                                                       | Type                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sts.amazonaws.com`    | `GetCallerIdentity`                                                                                                                                               | Reconnaissance                                 | Return details about the IAM user or role whose credentials are used to call the operation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `iam.amazonaws.com`    | `ListUsers`                                                                                                                                                       | Reconnaissance                                 | Enumerate the IAM users in the AWS account, that match the optional specified path prefix `requestParameters.pathPrefix`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `iam.amazonaws.com`    | `ListRoles`                                                                                                                                                       | Reconnaissance                                 | Enumerate the IAM roles in the AWS account, that match the optional specified path prefix `requestParameters.pathPrefix`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `iam.amazonaws.com`    | `ListGroups`                                                                                                                                                      | Reconnaissance                                 | Enumerate the IAM groups in the AWS account, that match the optional specified path prefix `requestParameters.pathPrefix`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `iam.amazonaws.com`    | `ListGroupsForUser`                                                                                                                                               | Reconnaissance                                 | List the `IAM` groups that the specified `IAM` user (by `requestParameters.userName`) belongs to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `iam.amazonaws.com`    | `ListPolicies`                                                                                                                                                    | Reconnaissance                                 | Enumerate the IAM policies in the AWS account, that match the optional specified path prefix `requestParameters.pathPrefix`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `iam.amazonaws.com`    | <p><code>ListAttachedUserPolicies</code><br><br><code>ListAttachedGroupPolicies</code><br><br><code>ListAttachedRolePolicies</code></p>                           | Reconnaissance                                 | <p>List the managed policies that are attached to the specified <code>IAM</code> user / group / role.<br><br>Notable fields:<br><em><code>ListAttachedUserPolicies</code></em>: <code>requestParameters.userName</code><br><em><code>ListAttachedGroupPolicies</code></em>: <code>requestParameters.groupName</code><br><em><code>ListAttachedRolePolicies</code></em>: <code>requestParameters.roleName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `iam.amazonaws.com`    | <p><code>ListUserPolicies</code><br><br><code>ListGroupPolicies</code><br><br><code>ListRolePolicies</code></p>                                                   | Reconnaissance                                 | <p>List the names of the inline policies embedded in the specified <code>IAM</code> user / group / role.<br><br>Notable fields:<br><em><code>ListUserPolicies</code></em>: <code>requestParameters.userName</code><br><em><code>ListGroupPolicies</code></em>: <code>requestParameters.groupName</code><br><em><code>ListRolePolicies</code></em>: <code>requestParameters.roleName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `iam.amazonaws.com`    | `GetPolicy`                                                                                                                                                       | Reconnaissance                                 | Get information about the specified managed policy (by `requestParameters.policyArn`), including the policy's default version and the total number of `IAM` users, groups, and roles to the policy is attached to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `iam.amazonaws.com`    | `GetPolicyVersion`                                                                                                                                                | Reconnaissance                                 | <p>Get information about the specified version of the specified managed policy, including the policy document.<br><br>Notable fields:<br><code>requestParameters.policyArn</code><br><code>requestParameters.versionId</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `s3.amazonaws.com`     | `ListBuckets`                                                                                                                                                     | Reconnaissance                                 | List the buckets owned by the authenticated sender of the request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `ec2.amazonaws.com`    | `GetConsoleScreenshot`                                                                                                                                            | Reconnaissance                                 | <p>Take a screenshot of a running instance.<br><br>Notable fields:<br><code>requestParameters.instanceId</code><br><code>requestParameters.wakeUp</code>: whether a keystroke input should be simulated to wake up an instance in standby.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `ec2.amazonaws.com`    | `DescribeInstances`                                                                                                                                               | Reconnaissance                                 | <p>Enumerate and retrieve information on all or the specified instances.<br><br>Notable fields:<br><code>requestParameters.instanceId</code>: optional list of instance id(s) to enumerate.<br><code>requestParameters.filter</code>: optional filter(s).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `sts.amazonaws.com`    | `AssumeRole`                                                                                                                                                      | Privilege escalation                           | <p>Return a set of temporary security credentials that can be used to access AWS resources under the privileges granted by the role. A role is a set of policies.<br><br>Can be called by <code>IAM</code> principal (user or role).<br><br>Notable fields:<br><code>requestParameters.roleArn</code>: The <code>ARN</code> of the role to assume.<br><code>requestParameters.roleSessionName</code>: a unique identifier (in the form of <code>i-089eb6ce74072ae1f</code>) to identify the session.<br><code>requestParameters.durationSeconds</code>: the validity period of the temporary credentials. Minimum value of 900 seconds up to the maximum session duration set for the role (maximum 43200 seconds).<br><br><code>responseElements.assumedRoleUser.arn</code>: the <code>ARN</code> of the temporary security credentials, that will be logged under <code>userIdentity.arn</code> (for API calls made during the session).<br><code>responseElements.assumedRoleUser.assumedRoleId</code>: a unique identifier containing the role ID and the role session name, that will be logged under <code>userIdentity.principalId</code> (for API calls made during the session).<br><code>responseElements.credentials.accessKeyId</code>: the access key ID that identifies the temporary security credentials, that will be logged under <code>userIdentity.accessKeyId</code> (for API calls made during the session).<br><code>responseElements.credentials.expiration</code>: the date on which the current credentials expire.</p> |
| `sso.amazonaws.com`    | `GetRoleCredentials`                                                                                                                                              | Privilege escalation                           | <p>Return a set of temporary security credentials.<br><br>Similar to <code>AssumeRole</code>, but can (and must) be called by <code>AWS SSO users</code>, which are not directly <code>IAM</code> principals. <code>AWS SSO users</code> can have permission to assume <code>IAM</code> roles and must do so through <code>GetRoleCredentials</code>.<br><br>Notable fields: <code>requestParameters.roleName</code><br><code>responseElements.credentials.roleCredentials.accessKeyId</code><br><code>responseElements.credentials.roleCredentials.expiration</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `iam.amazonaws.com`    | <p><code>AttachUserPolicy</code><br><br><code>AttachGroupPolicy</code><br><br><code>AttachRolePolicy</code></p>                                                   | Privilege escalation                           | <p>Attach the specified managed policy to the specified <code>IAM</code> user / group / role. A policy is the most atomic level of privileges that can be granted.<br><br>As a privilege escalation path, the compromised user may be a member of the impacted group or may be able to assume the impacted role.<br><br>Notable fields:<br><code>requestParameters.policyArn</code><br><br><em><code>AttachUserPolicy</code></em>: <code>requestParameters.userName</code><br><em><code>AttachGroupPolicy</code></em> <code>requestParameters.groupName</code>:<br><em><code>AttachRolePolicy</code></em>: <code>requestParameters.roleName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `iam.amazonaws.com`    | <p><code>PutUserPolicy</code><br><br><code>PutGroupPolicy</code><br><br><code>PutRolePolicy</code></p>                                                            | Privilege escalation                           | <p>Add (or update) an inline policy embedded in the specified <code>IAM</code> user / group / role. A policy is the most atomic level of privileges that can be granted.<br><br>Notable fields:<br><code>requestParameters.policyName</code><br><code>requestParameters.policyDocument</code>: policy in JSON format.<br><br><em><code>PutUserPolicy</code></em>: <code>requestParameters.userName</code><br><em><code>PutGroupPolicy</code></em>: <code>requestParameters.groupName</code><br><em><code>PutRolePolicy</code></em>: <code>requestParameters.roleName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `iam.amazonaws.com`    | `CreatePolicyVersion`                                                                                                                                             | Privilege escalation                           | <p>Create a new version of the specified managed <code>IAM</code> policy, allowing the definition of new permissions (ultimately granted to <code>IAM</code> users, groups, or Roles the policy is linked to).<br><br>Notable fields:<br><code>requestParameters.policyArn</code><br><code>requestParameters.policyDocument</code>: policy in JSON format.<br><code>requestParameters.setAsDefault</code>: whether the new policy version should be set as default, i.e should become the operative version (<code>true</code> of <code>false</code>).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `iam.amazonaws.com`    | `SetDefaultPolicyVersion`                                                                                                                                         | Privilege escalation                           | <p>Set the specified preexisting version of the specified policy as the policy's default (operative) version.<br><br>The policy version set will impact the <code>IAM</code> users, groups, or Roles the policy is linked to, potentially opening privilege escalation vectors.<br><br>Notable fields:<br><code>requestParameters.policyArn</code><br><code>requestParameters.versionId</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `iam.amazonaws.com`    | `AddUserToGroup`                                                                                                                                                  | <p>Privilege escalation<br><br>Persistence</p> | <p>Add the specified user to the specified group.<br><br>Notable fields:<br><code>requestParameters.userName</code><br><code>requestParameters.groupName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `iam.amazonaws.com`    | `CreateAccessKey`                                                                                                                                                 | <p>Privilege escalation<br><br>Persistence</p> | <p>Create a new AWS secret access key for the user specified by <code>requestParameters.userName</code>.<br><br>Notable fields:<br><code>responseElements.accessKey.accessKeyId</code><br><code>responseElements.accessKey.createDate</code><br><code>responseElements.accessKey.status</code><br><code>responseElements.accessKey.userName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `iam.amazonaws.com`    | `CreateLoginProfile`                                                                                                                                              | <p>Privilege escalation<br><br>Persistence</p> | <p>Create a password for the user specified by <code>requestParameters.userName</code> (to allow the user to access the AWS Management Console).<br><br>As a privilege escalation vector, a user (<code>userIdentity.userName</code>) can create a password for a (more privileged) user (<code>requestParameters.userName</code>) to connect as the user through the management console and elevate privileges.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `iam.amazonaws.com`    | `UpdateLoginProfile`                                                                                                                                              | <p>Privilege escalation<br><br>Persistence</p> | <p>Create a password for the user specified by <code>requestParameters.userName</code> (to allow the user to access the AWS Management Console).<br><br>As a privilege escalation vector, a user (<code>userIdentity.userName</code>) can reset the password of a (more privileged) user (<code>requestParameters.userName</code>) to compromise that user and elevate privileges.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `ec2.amazonaws.com`    | `RunInstances`                                                                                                                                                    | <p>Execution<br><br>Persistence</p>            | <p>Create and run new EC2 instance(s).<br><br>Notable fields:<br><code>requestParameters.instanceType</code><br><br>The <code>requestParameters.instancesSet.items{}</code> list contains (for each request instance):<br><code>imageId</code><br><code>tags{}</code> list with a <code>Key</code>=<code>Name</code> with <code>Value</code>=<code>\<INSTANCE\_NAME></code><br><code>keyName</code> for the key credentials associated with the instance.<br><br>The <code>responseElements.instancesSet.items{}</code> list contains (for each created instance):<br><code>instanceId</code><br><code>keyName</code><br><code>subnetId</code><br><code>privateIpAddress</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `ssm.amazonaws.com`    | `SendCommand`                                                                                                                                                     | Execution                                      | <p>Run command(s) on one or more instances.<br><br>Notable fields:<br><code>requestParameters.instanceIds</code> / <code>responseElements.command.instanceIds</code>: list of instance ids for the command execution.<br><code>requestParameters.documentName</code> / <code>responseElements.documentName</code>: name of the SSM document to run (such as <code>AWS-RunShellScript</code> or <code>AWS-RunPowerShellScript</code>).<br><code>requestParameters.parameters</code>: required and optional parameters specified in the document being run (can be <code>HIDDEN\_DUE\_TO\_SECURITY\_REASONS</code> for shell / powershell execution).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `ssm.amazonaws.com`    | `StartSession`                                                                                                                                                    | Execution                                      | <p>Initiate a connection to the target instance.<br><br>Notable fields:<br><code>requestParameters.target</code>: target instance id.<br><code>responseElements.sessionId</code>: identifier of the session.<br><code>responseElements.streamUrl</code>: an URL on the target instance <code>SSM Agent</code> used by the <code>Session Manager client</code> to send commands and receive output.<br><code>responseElements.tokenValue</code>: a token used to authenticate the connection (hidden in <code>CloudTrail</code>).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `ssm.amazonaws.com`    | `ResumeSession`                                                                                                                                                   | Execution                                      | <p>Reconnect a connection after it has been disconnected (but not terminated).<br><br>Notable fields:<br><code>requestParameters.sessionId</code>: identifier of the disconnected session.<br><code>responseElements.sessionId</code>: identifier of the session.<br><code>responseElements.streamUrl</code>: an URL on the target instance <code>SSM Agent</code> used by the <code>Session Manager client</code> to send commands and receive output.<br><code>responseElements.tokenValue</code>: a token used to authenticate the connection (hidden in <code>CloudTrail</code>).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `ec2.amazonaws.com`    | `GetPasswordData`                                                                                                                                                 | <p>Execution<br><br>Persistence</p>            | <p>Retrieves the <strong>encrypted</strong> administrator password for a running Windows instance. The password is encrypted with the key pair specified when the instance was launched.<br><br>Notable fields:<br><code>requestParameters.instanceId</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `ec2.amazonaws.com`    | `ModifyInstanceAttribute`                                                                                                                                         | <p>Execution<br><br>Persistence</p>            | <p>Modify the specified attribute of the specified instance.<br><br>A modification of the <code>userData</code> attribute can be used to execute code at boot time, requiring a restart of a running instance (<code>StopInstances</code> then <code>StartInstances</code>).<br><br><em>Does not allow the modification of the long-terme key pair(s) associated with an instance. There is no AWS API to conduct such operation.</em><br><br>Notable fields:<br><code>requestParameters.instanceId</code><br><code>requestParameters.attribute</code> (<code>userData</code> for the user data).<br><code>requestParameters.userData</code> (specified user data).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `ec2.amazonaws.com`    | `SendSSHPublicKey`                                                                                                                                                | Execution                                      | <p>Push a temporary SSH public key to the specified EC2 instance for use by the specified user. The key remains for 60 seconds. Used by the <code>EC2 Instance Connect</code> service for <code>SSH</code> access (directly or through the service web-based interface).<br><br>Notable fields:<br><code>requestParameters.instanceId</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `lambda.amazonaws.com` | `CreateFunction`                                                                                                                                                  | <p>Execution<br><br>Persistence</p>            | <p>Create a new Lambda function.<br><br>Notable fields:<br><code>requestParameters.functionName</code><br><code>requestParameters.code</code> but doesn't include the <code>ZipFile</code> parameter (that contains the base64-encoded contents of the deployment package).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `lambda.amazonaws.com` | `UpdateFunctionCode`                                                                                                                                              | <p>Execution<br><br>Persistence</p>            | <p>Update an existing Lambda function's code.<br><br>Notable fields:<br><code>requestParameters.functionName</code><br><code>requestParameters.code</code> but doesn't include the <code>ZipFile</code> parameter (that contains the base64-encoded contents of the deployment package).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `s3.amazonaws.com`     | `PutBucketAcl`                                                                                                                                                    | Exfiltration                                   | <p>Set the <code>ACL</code> of the specified bucket. Note that the use of <code>ACL</code> for <code>S3</code> is generally deprecated (in favor of using policy).<br><br>Notable fields:<br><code>requestParameters.bucket</code><br><code>requestParameters.AccessControlPolicy.AccessControlList.Grant.Grantee.URI</code> array : URIs for the container for the entity being granted permissions.<br>If the array contains the string <code><http://acs.amazonaws.com/groups/global/AuthenticatedUsers></code> or <code><http://acs.amazonaws.com/groups/global/AllUsers></code>, the specified bucket is made public.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `s3.amazonaws.com`     | `GetObject`                                                                                                                                                       | Data access                                    | <p>AWS CloudTrail supports <code>Amazon S3 Data Events</code>, but is not enabled by default.<br><br>Retrieve objects from <code>Amazon S3</code>, via the associated API.<br><br>Access through the web interface (or a static website leveraging a <code>S3 bucket</code>) will not be logged under <code>CloudTrail</code> (but can be logged in <code>S3 server access logs</code>).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `ses.amazonaws.com`    | <p><code>GetAccount</code><br><br><code>ListIdentities</code><br><br><code>VerifyEmailIdentity</code><br><br><code>UpdateAccountSendingEnabled</code><br><br></p> | Impact (phishing)                              | <p>Obtain information about the email-sending status and capabilities of the <code>Amazon SES</code> account (in the current region).<br><br>Return a list containing all of the identities (email addresses and domains) of the <code>Amazon SES</code> account (in the current region).<br><br>Add an email address to the list of identities <code>Amazon SES</code> account (in the current region) and attempt to verify it.<br><br>Enable (or disables email) sending across the entire <code>Amazon SES account</code> in the current AWS Region.<br><br>Usage of these APIs by threat actors <a href="https://unit42.paloaltonetworks.com/compromised-cloud-compute-credentials/">have been identified in the wild</a> to conduct phishing campaigns following an identity compromise.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `iam.amazonaws.com`    | `CreateUser`                                                                                                                                                      | Persistence                                    | <p>Create a new AWS user in the account.<br><br>Notable fields:<br><code>responseElements.user.arn</code><br><code>responseElements.user.createDate</code><br><code>responseElements.user.userId</code><br><code>responseElements.user.userName</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `ec2.amazonaws.com`    | `CreateKeyPair`                                                                                                                                                   | Persistence                                    | <p>Create a key pair with the specified name in the AWS Region.<br><br>Notable fields:<br><code>requestParameters.keyName</code> / <code>responseElements.keyName</code><br><code>responseElements.keyFingerprint</code><br><code>responseElements.keyPairId</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `ec2.amazonaws.com`    | `ImportKeyPair`                                                                                                                                                   | Persistence                                    | <p>Import the public key (previously created), only providing the public key to AWS.<br><br>Notable fields:<br><code>requestParameters.keyName</code> / <code>responseElements.keyName</code><br><code>responseElements.keyFingerprint</code><br><code>responseElements.keyPairId</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `sts.amazonaws.com`    | `GetSessionToken`                                                                                                                                                 | <p>Credentials access<br><br>Persistence</p>   | <p>Return a set of temporary credentials for an <code>AWS account</code> or <code>IAM user</code>.<br><br>The temporary security credentials created by <code>GetSessionToken</code> can be used to make API calls to any AWS service with the following exceptions:<br>- Calls to <code>IAM</code> API operations are prohibited unless MFA authentication information is included in the request.<br>- Calls to <code>STS</code> API are prohibited (except <code>AssumeRole</code> and <code>GetCallerIdentity</code>).<br><br>Notable fields:<br><code>responseElements.accessKeyId</code><br><code>responseElements.expiration</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

**CloudTrail logs manual analysis with jq**

The `jq` utility supports querying JSON formatted data and can be used to select and filter events from `CloudTrail` exported logs.

The following queries illustrate how `jq` can be used to select, order, and filter events from `CloudTrail` JSON logs:

```bash
# The following queries assume that the exported events are placed in a top-level "Records" field.

# Select the specified fields (eventTime, eventName, awsRegion, sourceIPAddress, and userIdentity).
jq '.Records[] | {eventTime, eventName, awsRegion, sourceIPAddress, userIdentity}' <JSON_FILE | *>

# Sorts events by their timestamp.
jq '.Records | sort_by(.eventTime)[]' <JSON_FILE | *>

# Select events between two timestamps.
jq ".Records | sort_by(.eventTime)[] | select(.eventTime | . == null or (fromdateiso8601 > $(TZ=UTC date -d"YYYY-MM-DDTHH:MM" +%s) and fromdateiso8601 < $(TZ=UTC date -d"YYYY-MM-DDTHH:MM" +%s)))" <JSON_FILE | *>

# Select the event that modified the account state.
jq '.Records[] | select(.readOnly == false)' <JSON_FILE | *>

# Select the specified event linked to the specified source IP address.
jq '.Records[] | select(.sourceIPAddress == <IP>)' <JSON_FILE | *>

# Select the events that contains the "Get" or "List" keyword.
jq '.Records[] | select(.eventName | match("Get|List"))'

# Select the events conducted by a given principal.
jq '.Records | sort_by(.eventTime)[] | select(.userIdentity.principalId | match("<USERNAME>")?)' *

# Count the occurrence by source IP address in a collection of CloudTrail export files.
echo 'def counter(stream):
  reduce stream as $s ({}; .[$s|tostring] += 1);

counter(.Records[].sourceIPAddress)
| to_entries[]
| {sourceIPAddress: (.key), Count: .value, file: input_filename}' > ip_count.jq
jq -f ip_count.jq *
```

***

### References

<https://www.youtube.com/watch?v=VLIFasM8VbY>

<https://docs.aws.amazon.com/whitepapers/latest/aws-security-incident-response-guide/logging-and-events.html>

<https://www.chrisfarris.com/post/aws-ir/>

<https://www.datadoghq.com/blog/monitoring-cloudtrail-logs/>

<https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-record-contents.html>

<https://www.wiz.io/blog/hunting-for-signs-of-persistence-in-the-cloud-an-ir-guide>

<https://docs.datadoghq.com/fr/security/default\\_rules/#cat-cloud-siem-log-detection>

<https://docs.sekoia.io/xdr/features/collect/integrations/cloud\\_and\\_saas/aws/aws\\_cloudtrail/>

<https://docs.aws.amazon.com/fr\\_fr/lambda/latest/dg/logging-using-cloudtrail.html>

<https://easttimor.github.io/aws-incident-response/>

<https://stackoverflow.com/questions/61257189/ec2-instance-connect-and-iam-public-keys>

<https://docs.datadoghq.com/fr/security/default\\_rules/aws-bucket-acl-made-public/>

<https://cloud.hacktricks.xyz/pentesting-cloud/aws-pentesting/aws-privilege-escalation/aws-iam-privesc>

<https://unit42.paloaltonetworks.com/compromised-cloud-compute-credentials/>

<https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a>
