id: nacl-open-inbound info: name: Open Inbound NACL Traffic author: princechaddha severity: medium description: | Checks for Amazon VPC Network ACLs with inbound rules allowing traffic from all IPs across all ports, increasing the risk of unauthorized access. impact: | Allows unrestricted access to resources within the subnet, potentially exposing sensitive data or services to unauthorized users. remediation: | Restrict Network ACL inbound rules to only allow necessary IP ranges and ports as per the Principle of Least Privilege. reference: - https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html tags: cloud,devops,aws,amazon,vpc,aws-cloud-config variables: region: "us-east-1" flow: | code(1) for(let NACLIDs of iterate(template.nacls)){ set("naclid", NACLIDs) code(2) } self-contained: true code: - engine: - sh - bash source: | aws ec2 describe-network-acls --region $region --query 'NetworkAcls[*].NetworkAclId' --output json extractors: - type: json name: nacls internal: true json: - '.[]' - engine: - sh - bash source: | aws ec2 describe-network-acls --region $region --network-acl-ids $naclid --query 'NetworkAcls[*].Entries[?(RuleAction==`allow`) && (Egress==`false`)] | []' matchers-condition: and matchers: - type: word words: - "allow" condition: and - type: word words: - "PortRange" negative: true extractors: - type: dsl dsl: - '"Access to the VPC subnets associated with your NACL " + naclid + " is not restricted."' # digest: 4a0a0047304502200de3239f933f1b468292a1ac4504bc398cad18ac3aa6f2de12357bd0e8a65759022100ee901336ec076eb9058f105f779e66be7bac556e1751713419df333cca4eaddf:922c64590222798bb761d5b6d8e72950