Link to this headingAWS
List of open source tools for AWS security: defensive, offensive, auditing, DFIR, etc.
Amazon Web Services — a practical guide
Tools:
Cloud Security Suite for auditing AWS
The AWS exploitation framework, designed for testing the security of Amazon Web Services environments.
Enumerate AWS S3 buckets and grep for files as well as download interesting files if you’re not afraid to quickly fill up your hard drive.
Amazon Web Services — a practical guide
Link to this headingAWS Testing Scripts
pacu AWS testing
https://tracebit.com/blog/2024/02/finding-aws-account-id-of-any-s3-bucket/
Link to this headingScoutSuite
Test AWS (when aws has been configured):
GCP:
Test GCP (when GCP has been configured):
Link to this headingScout2
Link to this headingCloudMapper
CloudMapper helps you analyze your Amazon Web Services (AWS) environments
Link to this headingConfiguring Access Keys
Example Key IDs:
AKIAJWTKNE6KHHJSERSA - IAM Access Key
ASIAJ6JADUC2OKZH32VQ - Role Session Key
A3T36DS33RDBS9ESBQOU - Root Access Key
Example Secret Key:
WjH53wpBrKV83vSoyWmnYOJ8KTJvVkz/kv3dZkPS
Example Session Token:
FQoDYXdzEBoaDNDNnH55fGtOR1ssXCL9AbjgQBu3KOTuDkzoSw
uOmyk3yipMlwT9j2cmvCE2nJ0UTTQn3QKW7FE1BsAs+ZUEYQNB
DUpqD64CbmXueScpMhaL1HIkaww7VRzDvKYRoAtn2a88BlUECZ
FTaDJgM0uNCJEFSI4SgoiL8f89zzgNpQqj4YE9AiPVv4ObBfAH
m6YGOQ8m31fjlU3iukqzI0sXKUaAn/m4zLseIx4HuiB5DX9wI/
tLvnriCP4HtPYqkR0DMFODV0MF3aGCkm13LeXz/=
Configure AWS creds:
Configure AWS creds for different profile:
whoami for AWS:
Secrets via Config Files on Disk
AWS Credentials:
- ~/.aws/credentials
- ~/.s3cfg
- ~/.aws/config
- s3cmd.ini
- ~/.elasticbeanstalk/aws_credential_file
Boto configuration:
- ~/.boto
- /etc/boto.cfg
- *.boto (likely contains AWS creds)
Fog configuration:
- .fog
Private keys and certificates:
- *.pem,
- *.key,
- *.cert
- ~/.ssh/id_rsa
- id_dsa
- id_ed25519
- id_ecdsa
- *.pkcs12
- *.pfx
- *.p12
- *.asc
macOS:
- *.keychain
Link to this headingSecrets via Control Plane Interface
AWS EC2 instances can query the metadata service to obtain some additional information from the control plane, which is mostly used to create and maintain the EC2 instances operational status.
The metadata service is accessible via the “169.254.169.254” IP address from an EC2 instance.
- http://169.254.169.254/latest/meta-data/
- http://169.254.169.254/latest/meta-data/instance-id/
- http://169.254.169.254/latest/meta-data/iam/
- http://169.254.169.254/latest/meta-data/iam/info/
- http://169.254.169.254/latest/meta-data/iam/securitycredentials/
- http://169.254.169.254/latest/meta-data/iam/securitycredentials/<ROLE_NAME>/
- http://169.254.169.254/latest/meta-data/public-ipv4
- http://169.254.169.254/latest/user-data
Other Endpoints:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html
Link to this headingBoto3
We can write our own Boto3 scripts in Python to directly interface with AWS’s control plane APIs.
When creating our own python scripts leveraging Boto to interact with the AWS APIs, the first things we do is import the boto library we wish to use.
We can then break the result up into a list within python with each element containing a name of a region.
For example, we can query the Simple Systems Manager (SSM) service in each region by first creating an SSM client.
Then describing the SSM parameters via the SSM client.
Finally we can loop through each parameter extracting the parameter name and values.
For further information:
- https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html
- https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html#SSM.Client.describe_parameters
Link to this headingExploitation Tools
https://github.com/Lifka/hacking-resources/blob/main/cloud-hacking-cheat-sheets.md