AWS Security Assessment
What is a AWS?
Amazon Web Services (AWS) is a cloud service from Amazon, which provides services in the form of building blocks, these building blocks can be used to create and deploy any type of application in the cloud. These services or building blocks are designed to work with each other, and result in applications which are sophisticated and highly scalable.
Each type of service in AWS, is categorized under a domain, the few domains which are widely used are:
  1. Compute
  2. Storage
  3. Database
  4. Migration
  5. Network and Content Delivery
  6. Management Tools
  7. Security & Identity Compliance
  8. Messaging

AWS Security Assessment

What is a AWS?
Amazon Web Services (AWS) is a cloud service from Amazon, which provides services in the form of building blocks, these building blocks can be used to create and deploy any type of application in the cloud. These services or building blocks are designed to work with each other, and result in applications which are sophisticated and highly scalable.
Each type of service in AWS, is categorized under a domain, the few domains which are widely used are:
  1. Compute
  2. Storage
  3. Database
  4. Migration
  5. Network and Content Delivery
  6. Management Tools
  7. Security & Identity Compliance
  8. Messaging
Why AWS Security Assessment is different than VAPT Engagement?
The methodologies used to pentest traditional security infrastructure and the AWS Cloud differ in a multitude of ways. Most of these differences refer back to the ownership of the systems. Since Amazon owns the core infrastructure, the methodology used in traditional VAPT would violate the AWS acceptable use policies and potentially invoke incident response procedures by the AWS security team.
Amazon Cloud Penetration Testing Rules
Amazon Cloud Penetration Testing Rules
  1. AWS EC2 instance excluding tactics related to disruption of business continuity such as launching Denial of Service (DOS) attacks
  2. The implementation and configuration of Vendor Operated Services,
  3. AWS services such as Cloudfront and the API Gateway configuration may be pentested but the hosting infrastructure is off limits.
  4. Areas of the AWS Elastic Cloud Computing (EC2) service including:
Top 5 Vulnerabilities to Test for in AWS
While there are a number of common AWS-specific vulnerabilities we often see, some are more regular than others. Below are the top 5 vulnerabilities we see when testing against this architecture:
  1. Testing S3 bucket configuration and permissions flaws
  2. Targeting and compromising AWS IAM keys
  3. Cloudfront/WAF Misconfiguration Bypasses
  4. Establishing private-cloud access through Lambda backdoor functions
  5. Cover tracks by obfuscating CloudTrail logs

Why AWS Security Assessment is different than VAPT Engagement?

The methodologies used to pentest traditional security infrastructure and the AWS Cloud differ in a multitude of ways. Most of these differences refer back to the ownership of the systems. Since Amazon owns the core infrastructure, the methodology used in traditional VAPT would violate the AWS acceptable use policies and potentially invoke incident response procedures by the AWS security team.
Amazon Cloud Penetration Testing Rules
AWS permits security testing for User-Operated Services, which includes cloud offerings created and configured by the user. Here are a few examples:
  1. AWS EC2 instance excluding tactics related to disruption of business continuity such as launching Denial of Service (DOS) attacks
  2. The implementation and configuration of Vendor Operated Services,
  3. AWS services such as Cloudfront and the API Gateway configuration may be pentested but the hosting infrastructure is off limits.
  4. Areas of the AWS Elastic Cloud Computing (EC2) service including:
Top 5 Vulnerabilities to Test for in AWS
While there are a number of common AWS-specific vulnerabilities we often see, some are more regular than others. Below are the top 5 vulnerabilities we see when testing against this architecture:
  1. Testing S3 bucket configuration and permissions flaws
  2. Targeting and compromising AWS IAM keys
  3. Cloudfront/WAF Misconfiguration Bypasses
  4. Establishing private-cloud access through Lambda backdoor functions
  5. Cover tracks by obfuscating CloudTrail logs
WHAT STEPS SHOULD I TAKE BEFORE THE PENTEST?
Performing a pentest within the cloud requires adequate planning and expert knowledge. General steps and preparation that should be taken before the pentest begins include:
  1. Defining the scope, including the AWS environment and target systems
  2. Run your own preliminary
  3. Determine the type of pentest you would like conducted (e.g. black box, white box, gray box)
  4. Outline expectations for both internal stakeholders and the pentesting company
  5. Establishing a timeline for the technical assessment to occur, receive formal reports, and potential remediation and follow-up testing
  6. Developing the protocol and rules of engagement if the pentest reveals the client may already have been breached or is under an ongoing (live) attack
  7. Obtaining written approval to conduct the test by the client (and other third parties that may be involved)
DevSecOps Pipelines Considerations in AWS
Amazon clouds support multiple services which can be used in a DevOps environment like:
Hence AWS provides a lot of security tools in native cloud format, however, those tools generally focus more on monitoring and reporting, thus, requiring us to deploy and use and our own tools to address other areas.
Integrating security in an AWS environment will take similar steps as required in an On-prem environment like integrating a code analyzer tool in SAST (static application security testing) or a dependency checker in the SCA (software composition analysis) however The configuration of various tools in AWS environment for execution will be different.
In an on-prem model tools can be downloaded at will and executed in a script or a docker container. However in cloud, as billing is generally on usage, download incurs extra charges and hence the strategy with using these tools in AWS would be to create a tools repository using an S3 bucket and referencing this S3 bucket in each build configuration file. Each stage will have its own build configuration file wherein the tools would be fetched from the internal S3 bucket and executed.

These tools will be needed to be updated regularly for which we can employ a Lambda function which would periodically check for new versions. If the tool is compatible with the AWS Lambda specifications, then converting the tool as a Lambda service would be an exceptionally great task and for vulnerability management. Refer to “Tools” section for suitable tools.

DevSecOps Pipelines Considerations in AWS

Amazon clouds support multiple services which can be used in a DevOps environment like:
Hence AWS provides a lot of security tools in native cloud format, however, those tools generally focus more on monitoring and reporting, thus, requiring us to deploy and use and our own tools to address other areas.
Integrating security in an AWS environment will take similar steps as required in an On-prem environment like integrating a code analyzer tool in SAST (static application security testing) or a dependency checker in the SCA (software composition analysis) however The configuration of various tools in AWS environment for execution will be different.
In an on-prem model tools can be downloaded at will and executed in a script or a docker container. However in cloud, as billing is generally on usage, download incurs extra charges and hence the strategy with using these tools in AWS would be to create a tools repository using an S3 bucket and referencing this S3 bucket in each build configuration file. Each stage will have its own build configuration file wherein the tools would be fetched from the internal S3 bucket and executed.

These tools will be needed to be updated regularly for which we can employ a Lambda function which would periodically check for new versions. If the tool is compatible with the AWS Lambda specifications, then converting the tool as a Lambda service would be an exceptionally great task and for vulnerability management. Refer to “Tools” section for suitable tools.

Threat Landscape in AWS DevOps Environment
Here are the issues describing the complete AWS threat landscape
Access Control Security Misconfiguration
In AWS, access control is managed through the IAM Policies. A policy is an object in AWS that, when associated with an identity or resources, define their permissions. If an EC2 object needs to access an S3 bucket, specific permissions are needed. An oversight or granting of excessive privileges can lead to various scenarios where S3 buckets have public access leading to a possible leakage of sensitive information.
Network Security Misconfiguration

The diagram on the right shows a typical flow of network traffic and the different places where it can be tapped. Security Groups are like host-based firewalls for individual EC2 instances. Network Access Control Lists (NACL) can be configured for a group of EC2 instances. Route Tables are configured for routing traffic amongst different networks and finally we have VPC’s which are the final overarching network segmentation module connected to an Internet Gateway.

It is very much possible to have misconfiguration in such complex infrastructure.

Below section focuses on various tools offered by AWS as well as some other open source tools that can be utilized.
Tool Category Description
AWS CloudWatch Logging and Monitoring
  • Single point log aggregation utility
  • SDK for application logging
  • Define metrics and configure alerts
  • Example: monitoring CPU utilization across all systems for possible BITCOIN mining
AWS CloudTrail Logging and Auditing
  • Auditing for all API events
  • Users as well as system events are recorded
  • Can feed into CloudWatch for alerts
  • Example: admin user logging in from a different country
AWS Config Compliance and Configuration Management
  • Audit and review changes in AWS infrastructure
  • Assess changes against a set of rules by setting alerts for any deviation
  • Example: new security group added
AWS Inspector Security and Compliance
  • Vulnerability assessment tool for EC2 instances
  • Example: running a vulnerable service or server not setup as per a defined template
Prowler Security Hardening
  • Open source tool for hardening an AWS infrastructure
  • Runs checks against CIS benchmarks for AWS
Security Monkey Configuration Management
  • Checks for changes in configuration and policy changes
  • Assess changes against secure practices and sends alerts for any insecure changes
ScoutSuite Security and Compliance
  • Multi-cloud security auditing tools against the deployed configuration
  • Reads configurations and highlights security gaps
AWS Secrets Manager Secrets Management
  • Manages application credentials to avoid exposure
  • Tokenizes credentials which can be rotated
  • Policy enforcement
AWS WAF Firewall
  • Web application firewall for monitoring of application security issues
AWS IAM Keys Leakage
AWS if an EC2 instance needs to access an S3 bucket, proper IAM roles needs to be configured. IAM roles are permissions between AWS services which are different than user permissions. Hence if a service needs programmatic access to AWS resources then it needs a set of AWS access keys which can be obtained from a metadata URL.
There are two ways in which these keys can be leaked/exposed
AWS IAM keys leakage can be prevented by employing pre-commit hooks like Talisman which detect for such information before developers can commit changes into a repo.
Exploiting Billing Caps
If your AWS keys are compromised the very first thing that attackers would do is setup EC2 instances and start BITCOIN mining.
The key point to understand here is that it is not just storage costs, but also “Per Request” costs that need to be considered.
One of the best practices while using AWS is to create billing alerts for your AWS accounts so as to protect yourself from being overcharged.
Tools to help you secure your AWS clouds environment
Keep in mind the following tools are not the industry de facto and are subject to constant change.
AWS Security benchmark by AWSLabs, contains benchmark governance rules

Threat Landscape in AWS DevOps Environment

Here are the issues describing the complete AWS threat landscape
Access Control Security Misconfiguration
In AWS, access control is managed through the IAM Policies. A policy is an object in AWS that, when associated with an identity or resources, define their permissions. If an EC2 object needs to access an S3 bucket, specific permissions are needed. An oversight or granting of excessive privileges can lead to various scenarios where S3 buckets have public access leading to a possible leakage of sensitive information.
Network Security Misconfiguration

The diagram on the right shows a typical flow of network traffic and the different places where it can be tapped. Security Groups are like host-based firewalls for individual EC2 instances. Network Access Control Lists (NACL) can be configured for a group of EC2 instances. Route Tables are configured for routing traffic amongst different networks and finally we have VPC’s which are the final overarching network segmentation module connected to an Internet Gateway.

It is very much possible to have misconfiguration in such complex infrastructure.

Below section focuses on various tools offered by AWS as well as some other open source tools that can be utilized.

ToolCategoryDescription
AWS CloudWatchLogging and Monitoring
  • Single point log aggregation utility
  • SDK for application logging
  • Define metrics and configure alerts
  • Example: monitoring CPU utilization across all systems for possible BITCOIN mining
AWS CloudTrailLogging and Auditing
  • Auditing for all API events
  • Users as well as system events are recorded
  • Can feed into CloudWatch for alerts
  • Example: admin user logging in from a different country
AWS ConfigCompliance and Configuration Management
  • Audit and review changes in AWS infrastructure
  • Assess changes against a set of rules by setting alerts for any deviation
  • Example: new security group added
AWS InspectorSecurity and Compliance
  • Vulnerability assessment tool for EC2 instances
  • Example: running a vulnerable service or server not setup as per a defined template
ProwlerSecurity Hardening
  • Open source tool for hardening an AWS infrastructure
  • Runs checks against CIS benchmarks for AWS
Security MonkeyConfiguration Management
  • Checks for changes in configuration and policy changes
  • Assess changes against secure practices and sends alerts for any insecure changes
ScoutSuiteSecurity and Compliance
  • Multi-cloud security auditing tools against the deployed configuration
  • Reads configurations and highlights security gaps
AWS Secrets ManagerSecrets Management
  • Manages application credentials to avoid exposure
  • Tokenizes credentials which can be rotated
  • Policy enforcement
AWS WAFFirewall
  • Web application firewall for monitoring of application security issues
AWS IAM Keys Leakage
AWS if an EC2 instance needs to access an S3 bucket, proper IAM roles needs to be configured. IAM roles are permissions between AWS services which are different than user permissions. Hence if a service needs programmatic access to AWS resources then it needs a set of AWS access keys which can be obtained from a metadata URL.
There are two ways in which these keys can be leaked/exposed
AWS IAM keys leakage can be prevented by employing pre-commit hooks like Talisman which detect for such information before developers can commit changes into a repo.
Exploiting Billing Caps
If your AWS keys are compromised the very first thing that attackers would do is setup EC2 instances and start BITCOIN mining.
The key point to understand here is that it is not just storage costs, but also “Per Request” costs that need to be considered.
One of the best practices while using AWS is to create billing alerts for your AWS accounts so as to protect yourself from being overcharged.
Tools to help you secure your AWS clouds environment
Keep in mind the following tools are not the industry de facto and are subject to constant change.

See also: