2024-04-11 14:23:07 +00:00
|
|
|
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
|
|
|
|
tags: cloud,devops,aws,amazon,vpc,aws-cloud-config
|
|
|
|
|
|
|
|
variables:
|
|
|
|
region: "us-east-1"
|
|
|
|
|
|
|
|
flow: |
|
|
|
|
code(1)
|
|
|
|
for(let VpcIds of 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."'
|
2024-04-11 14:25:25 +00:00
|
|
|
# digest: 4a0a0047304502206fa64b542b8c69a54cd76e83666f0b97b830db5028eb2b684f10388b858f03c7022100a060eff71326c75b63bd7b7caa82a62b376f352503548f36ae7875e06db2b0d1:922c64590222798bb761d5b6d8e72950
|