64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
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
|
|
metadata:
|
|
max-request: 2
|
|
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: 4a0a0047304502210090f1a4c3cf579052839a7c17926792dc80956b0a3ef6716f594d5dd3539e0e3f02205c9073431d5ad40af0eeb8a4ee457808e7ecac97f253ab129e5f27b78e4e9377:922c64590222798bb761d5b6d8e72950 |