# Initial Access

## Initial Access

For initial access to AWS you should find access keys and tokens of an account. That can be done with some different ways phishing, vulnerable an application, leaked tokens/credentials etc.

There are some steps can be done during that phase.

## IAM Initial Access

Console sign in URL for root User :

<https://signin.aws.amazon.com/console>

Console sign in URL for IAM User :

<https://account-ID-or-alias.signin.aws.amazon.com/console>

Configure AWS CLI  :

```
aws configure --profile profile-name
```

### EC2 Privilege Escalation

Get Information about user identity / role identity   :

```
aws sts get-caller-identity
```

Lists all managed policies that are attached to the specified IAM user:

```
aws iam list-attached-user-policies --user-name user-name
```

Retrieves information about the specified version of the specified managed policy :

```
aws iam get-policy-version --policy-arnpolicy-arn--version-id version-id
```

Get-Information about instance id  :

```
curl http://169.254.169.254/latest/meta-data/instance-id
```

Lists the instance profiles :

```
aws iam list-instance-profiles
```

Attach an instance profile with a role to a EC2 instance: :&#x20;

```
aws ec2 associate-iam-instance-profile --instance-id InstanceID --iam-instance-profile Name=ProfileName
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

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

```
GET https://turme.gitbook.io/blog/aws-penetration-test/initial-access.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
