AWS (Amazon Web Services) is a cloud computing platform provided by Amazon that offers a broad set of services, including computing power, storage, databases, networking, machine learning, and analytics, among others. These services enable individuals and businesses to build, deploy, and manage applications and infrastructure in the cloud. AWS operates on a pay-as-you-go pricing model, allowing users to scale resources up or down based on their needs, providing flexibility, cost-efficiency, and global availability. It is widely used across industries for its reliability, security, and extensive range of tools.
Its has approx(200+) services
In this blog we will elarn about AWS basics like →
how to setup aws cli
learn about some basics aws commands
Resources
SO , Lets start =>
SETUP AWS CLI
AWS CLI (Command Line Interface) is a tool provided by AWS that allows users to manage and interact with AWS services through a command-line interface. It enables you to perform tasks such as configuring services, automating workflows, and managing resources by executing simple commands. The AWS CLI supports various AWS services and can be used on operating systems like Windows, macOS, and Linux, making it a powerful tool for developers and system administrators to manage cloud infrastructure efficiently.
Prerequisites :
AWS access key
AWS secret Key
AWS region
→ First we need to download aws cli from the official documentation : read this to install
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
I’m not going to tell you how to install it. Because it is very easy and if we cant install aws cli tool then we should’nt start learning AWS Pentesting on the first place.
check aws version
aws --version
aws-cli/1.36.33 Python/3.12.8 Linux/6.11.2-amd64 botocore/1.35.92
# this should display aws version and we are good to go.
configure AWS CLI:
we need an aws account for this : ( make a trial account )
like this we need ACCESS key + secret Key and region to configure AWS
more info : https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html
then it will create a hidden dir named .aws in your ~/home like this :
it contains two files
config (contains region info )
credentials (contains access key and secret key)
whoami for aws
there is command i use to check if aws profile is successully configured or not.
aws --profile profile-name sts get-caller-identity
it will display result like this :
it it display that means we are good to go ->
Basic AWS enumeration commands
these basic aws commands i always run to enumerate the target :
List all users
aws --profile test iam list-users
iam => stands for Identity and Access management
it display result like this:
here I created some users or practice:
get more info about a particular user
aws --profile profile-name iam get-user --user-name <username>
it will display more information about a particular user
(I use this command to enumerate all users)
Enumerate inline policies :
Inline policies in AWS are policies that are directly embedded within a specific IAM user, group, or role. Unlike managed policies, which are standalone and reusable, inline policies are tied to the entity they are attached to and cannot be shared across multiple entities.
They are primarily used when you want a policy to have a strict, one-to-one relationship with an IAM entity. If the associated entity (user, group, or role) is deleted, the inline policy is also deleted automatically. Inline policies are useful for granting highly specific or temporary permissions to an entity while keeping those permissions isolated from others.
aws --profile profile-name iam list-user-policies --user-name <username>
and it will display any inline polices (currently my user dont have any)
Enumerate Attached policies :
Attached policies in AWS are policies that are associated with an IAM user, group, or role. These policies can either be managed policies (AWS-created or customer-created) or inline policies.
Managed Policies: These are standalone policies that can be attached to multiple IAM entities (users, groups, or roles). They are reusable across different entities, making them ideal for common permission sets.
Inline Policies: As mentioned earlier, these are policies that are directly embedded into a single IAM entity, like a user or role. They can’t be reused across other entities.
aws --profile profile-name iam list-attached-user-policies --user-name <username>
as we can see i have administrator access attached policy :
if we have any attached policies we can enumerate about permissions that policy will grant to our user
aws --profile profile-name iam get-policy --policy-arn <place-here>
arn : amazon resource name
we will get this result
note the defaultVersionId = v1
enumerate this policy version-id
aws --profile profile-name iam get-policy-version --policy-arn <placehere> --version-id <placehere>
and it will display the permissions like this :
\=> i know this is not a basic start for aws in next blog we will learn about specific services of AWS. This was just an overview of AWSCLI because we will use AWSCLI a lot in this series.
/