aquasecurity / aquasecurity/cloudsploit

AWS Exposed VPC endpoints plugin doesn't properly detect private subnets

Open
#1,856 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.8k
Forks
751
Avg merge
11d 9h
Merged PRs (30d)
3

Description

On my environment VPC endpoints are placed in private subnets where transit gateway is used to route to VPCs and "Exposed VPC endpoints" plugin doesn't recognise the subnets as private subnets even though it doesn't have an internet gateway attached.

I believe the issue is in this utility function: https://github.com/aquasecurity/cloudsploit/blob/cab05b5fb7a6c0b4eae1912d02702c5588e35125/helpers/aws/functions.js#L947

It requires every route to have a "GatewayId" for it to a private subnet however, [the routes can point to a NatGateway or TransitGateway and still be private](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_Route.html).

The code should be something like this instead:

```
if (routeTable.RouteTableId && routeTable.Routes && !routeTable.Routes.some(route => route.GatewayId && route.GatewayId.startsWith('igw-')) privateRouteTables.push(routeTable.RouteTableId);
```

Contributor guide

Open the contributing guide

Research direction

Inspect helpers/aws/functions.js around line 947, then trace how the Exposed VPC endpoints plugin uses the private-subnet result. Reproduce the case with routes targeting a NAT gateway or transit gateway and verify that subnets without an internet gateway are recognized as private, while internet-gateway routes are not.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cloud, networking, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.