Introduction
Best practices for securing an AWS environment have been well-documented and generally accepted, such as in AWS’s guidance. However, organizations may still find it challenging on how to begin applying this guidance to their specific environments.
- Which controls should be applied out-of-the-box vs. customized?
- What pitfalls exist in implementing the various controls or checks?
- How do you prioritize remediation of the “sea of red” violations?
In this blog series, we’ll analyze anonymized data from Netskope customers that include security settings of 650,000 entities from 1,143 AWS accounts across several hundred organizations. We’ll look at the configuration from the perspective of the best practices, see what’s commonly occurring in the real world and:
- Discuss specific risk areas that should be prioritized
- Identify underlying root causes and potential pitfalls
- Focus on practical guidance for applying the Benchmark to your specific environment
This blog post focuses on IAM security controls related to networking. Based on the analysis, we will highlight two opportunities to improve security by making these networking changes:
- Use More Secure Remote Access: Replace security groups that allow inbound Internet access to remote admin ports with more secure methods to remotely administer EC2 instances. 4% of the security groups in use allow inbound Internet access for SSH or RDP.
- Do Not Use Default Security Groups: Ensure that default security groups do not allow any traffic and are not used. 609 default security groups (1% of all security groups) are being used and allow traffic of some kind.
Networking
These three technical controls relating to network security were analyzed against 16,059 network ACLs and 59,361 security groups in 1,143 accounts:
# | Best Practice | # Violations | % |
---|---|---|---|
1 | No NACLs allow ingress from 0.0.0.0/0 to remote admin ports | 15,778 | 98.3 |
2 | No SGs allow ingress from 0.0.0.0/0 to remote admin ports | 2,380 | 4.0 |
3 | Default SGs should restrict all traffic | 609 | 1.0 |
1. NACLs
Background: NACLs apply to a particular subnet of a VPC and can be used in combination with security groups to control access to resources within the VPC. They allow all traffic in and out of the VPC by default, are stateless, and specify both allow and deny rules. One can implement defense-in-depth by using both NACLs and security groups.
Data: 15,778 (98%) out of the 16,059 NACLs across 92% of the accounts in this dataset allow Internet access from the Internet to either SSH or RDP.
Analysis: In this dataset, NACLs are not commonly used for filtering inbound internet traffic since almost all NACLs (15,778 or 98%) are configured to allow inbound traffic to SSH or RDP, while a much smaller number of security groups actually allow that same traffic through (2,380 or 4%). If organizations in this dataset are using NACLs for layered defense, then almost all of the NACLs NACLs should implement deny ACLs for inbound Internet traffic to ports 22 and 3389. On the other hand, if NACLs are not being used, then the next two controls regarding Security Groups should be the focus.
Controls:
- Detection/Audit
If NACLs are used, then regular and automated checks on NACL rules should be done in order to prevent misconfigured NACLs that allow too much traffic in or out of VPCs.NACLs can be inspected manually in the AWS Console or via the CLI:aws ec2 describe-network-acls
- Prevention/Mitigation
Network ACLs can be set in the Console via CLI:aws ec2 create-network-acl
aws ec2 create-network-acl-entry
- Detection/Audit
2. Security Groups
Background: Security groups are used to control granular access to instances within a VPC. Best practices are to not allow inbound access to remote administration ports like SSH or RDP.
Data: 2,380 security groups in use allow inbound traffic to port 22 (SSH) or 3389 (RDP).Analysis: When looking at all security groups, 6,527 (11%) allow inbound Internet traffic to SSH or RDP ports. This occurs in about half (48%) of the accounts. The breakdown of the 6,527 security groups into attached vs. unattached is:
Analysis: When looking at all security groups, 6,527 (11%) allow inbound Internet traffic to SSH or RDP ports. This occurs in about half (48%) of the accounts. The breakdown of the 6,527 security groups into attached vs. unattached is:
Description | Notes | # SGs | % |
---|---|---|---|
Security Groups allowing ingress from 0.0.0.0/0 to remote admin ports | ports 22 or 3389 | 6,527 | 100 |
Attached | in use | 2,380 | 36 |
Not attached | not in use | 4,147 | 64 |
From a remediation perspective, unattached security groups may not be as critical as attached ones as they are unused. However, unused objects of any kind should be reviewed and removed, as they can accidentally be used in the future or may waste time with maintenance and upkeep.
Allowing direct SSH or RDP access to a VPC via a security group is not the most secure way to do remote administration. The drawbacks of this approach include protocol attacks such as SSH multiplexing attacks, exposure of additional ports to the internet, lack of centralized logging, and lack of IAM authentication/access control. This is discussed in detail in: Leaving Bastion Hosts Behind Part 2: AWS.