Check that granted permissions are as intended, as developers often create open security groups for testing and forget to close them before moving them to production.
Closing risky open ports in Security Groups is the first to do, but all security groups, especially for critical applications should be reviewed, in particular open ports other than web, and internal web applications allowing access from everywhere.
You can use the AWS Config restricted-common-ports rule by indicating different ports as parameters to detect open ports.
Another recommendation is the use of references in security groups, for example, in a web application:
Thus in this way, web instances only serve traffic that comes from the ALB, where you can configure AWS WAF , ensuring that all inbound traffic to web instances has been inspected. The database service only serves requests from web servers, and if a new instance is added by autoscaling, it will be added to the security group and will be able to access the database.
You can leverage AWS Firewall Manager to audit Security Groups and enforce rules centrally in multiple accounts, identifying overly permissive SGs, idetifying access to high risk applications, and cleaning up unused and redundant SGs. Depending on the size of the organization and how your resources are created (manually vs. using Infrastructure as code) the use of this service will be optional or strongly recommended. Learn more in the following presentation: User AWS Firewall Manager to audit overpermissive security groups
Security groups have no additional cost.
If you choose to use AWS Firewall Manager : https://aws.amazon.com/firewall-manager/pricing