id: vpc-endpoint-exposed info: name: Exposed VPC Endpoint author: princechaddha severity: medium description: | Identify and secure fully accessible Amazon VPC endpoints to prevent unauthorized access to AWS services. impact: | Allows unrestricted access to AWS services via the exposed VPC endpoint, potentially leading to data leakage or unauthorized operations. remediation: | Update the VPC endpoint's policy to restrict access only to authorized entities and ensure all requests are signed. reference: - https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-access.html metadata: max-request: 2 tags: cloud,devops,aws,amazon,vpc,aws-cloud-config variables: region: "us-east-1" flow: | code(1) for(let VpcIds of iterate(template.VpcId)){ set("vpc", VpcIds) code(2) } self-contained: true code: - engine: - sh - bash source: | aws ec2 describe-vpc-endpoints --region $region --output table --query 'VpcEndpoints[*].VpcEndpointId' --output json extractors: - type: json name: VpcId internal: true json: - '.[]' - engine: - sh - bash source: | aws ec2 describe-vpc-endpoints --region $region --vpc-endpoint-ids $vpc --query 'VpcEndpoints[*].PolicyDocument' --output json matchers-condition: and matchers: - type: word words: - '"AWS": "*"' - '"Principal": "*"' - type: word words: - "Condition" negative: true extractors: - type: dsl dsl: - '"VPC endpoints for " + vpc + "are exposed."' # digest: 490a0046304402200506111e97b28461eceb3c5334265051c3383b8a0eb553d5177f1c6344d933fb0220455e9ba374c56d762b53f3261e06eb79fca8809640330ecac13021f99a98aaed:922c64590222798bb761d5b6d8e72950