2024-04-11 14:23:07 +00:00
|
|
|
id: nacl-outbound-restrict
|
|
|
|
info:
|
|
|
|
name: Unrestricted NACL Outbound Traffic
|
|
|
|
author: princechaddha
|
|
|
|
severity: medium
|
|
|
|
description: |
|
|
|
|
Checks for Amazon VPC NACLs allowing outbound traffic to all ports, recommending restriction to necessary ports only.
|
|
|
|
impact: |
|
|
|
|
Potential for data exfiltration or unauthorized access if outbound traffic is not properly restricted.
|
|
|
|
remediation: |
|
|
|
|
Modify NACL outbound rules to limit traffic to only the ports required for legitimate business needs.
|
|
|
|
reference:
|
|
|
|
- https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html
|
2024-06-07 10:04:29 +00:00
|
|
|
metadata:
|
|
|
|
max-request: 2
|
2024-04-11 14:23:07 +00:00
|
|
|
tags: cloud,devops,aws,amazon,vpc,aws-cloud-config
|
|
|
|
variables:
|
|
|
|
region: "us-east-1"
|
|
|
|
|
|
|
|
flow: |
|
|
|
|
code(1)
|
2024-04-29 09:35:31 +00:00
|
|
|
for(let NACLIDs of iterate(template.nacls)){
|
2024-04-11 14:23:07 +00:00
|
|
|
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==`true`)] | []'
|
|
|
|
|
|
|
|
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."'
|
2024-06-08 16:02:17 +00:00
|
|
|
# digest: 4a0a00473045022024d4f02c513a648afb7661835f3744b1696e4866ac46f3be73f69d11264f6c69022100ce93ba9b7fb4b0e9f750ed04fbd68eb6df23e4979ecc05906bd8be9a19bd320e:922c64590222798bb761d5b6d8e72950
|