nacl-outbound-restrict: Unrestricted NACL Outbound Traffic

2025-08-01 nacl outbound restrict PoC Public

Description

Checks for Amazon VPC NACLs allowing outbound traffic to all ports, recommending restriction to necessary ports only.

Details

Severity
中危
Affected
nacl outbound restrict
Published
PoC
Public

PoC

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
  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==`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."'
# digest: 4b0a00483046022100ce482b003459f45bc6149998a48727c1dd29cf9783b3f357d98d64f04feb0440022100fe8cced5276dcc12d9a34f7b07db1adcd9a17398b40c7eba359ea07905738165:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

Related Vulnerabilities

微信搜一搜 biu.life