Was discussing this with a coworker: is it a potential security vulnerability if we opened the route tables for our private subnet, to allow 0.0.0.0/0 access, even if the SG and instances within the private subnet don’t allow 0.0.0.0/0 access and dont have a public IP address?
Depends where the inbound traffic is coming from. I have multiple accounts allowing 0.0.0.0/0 in but these are accounts without internet gateways. They are attached to a transit gateway account with a 3rd party firewall, so the traffic is controlled there.
Not sure I follow. The thing that distinguishes a private subnet from a public one is its route table. Public subnets will route 0/0 to a IGW, private subnets route 0/0 to a NAT Gateway (Or nothing at all): https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html
You can assign a 0/0 route for a private subnet and point it to your NAT gateway, but that doesn’t mean things on the internet will be able to reach resources directly; resources in private subnets that need to be reached directly from the internet are typically done so via something like a load balancer that exists in your public subnet instead.
Can you elaborate a little more on what you’re trying to achieve here?
Route tables are not access control mechanisms (unless you’re doing something really sketchy like allowing incoming connections but relying on a lack of default route to stop return traffic reaching the external host). So I’m pretty confused here.
Private subnets should probably have an outbound default route so that your stuff can reach other stuff. This should go via a NAT Gateway which does not allow incoming connections. This has very little to do with “allow[ing] 0.0.0.0/0 access”.
Generally, your private subnet would have 0.0.0.0/0 point to the NAT gateway. This would allow outbound internet access to your resources while preventing anyone from outside to reach back to them.
If you connect Internet Gateway instead of NAT gateway, you effectively convert your private subnet to a public subnet. Hence, it is actually better to assign 0.0.0.0/0 to either a NAT gateway or send it to a black hole so that no one accidentally adds an IG to it and make the whole subnet public.
Well, this can be a necessary thing if you have a private subnet but want to allow protected internet access out for resources in that subnet. For instance, you might have a VPN or direct connection between the cloud and an on-premises environment. You could add a route to the subnet for 0.0.0.0/0 that sends all of that traffic across that private line. The on-premises firewall\routers would then be able to inspect the traffic, monitor it, and send it out to the internet. Any of the companies existing rules and IDS\IPS protection would still be respected (making it no different from an on-premises server or machine accessing the internet).
The subnet is still considered “private” in that only on-premises traffic is allowed, but the machines can still pull updates or other content from the internet as needed. It would even be allowed for the on-premises servers to expose some service through their public firewall to allow incoming traffic to those resources, although the added latencies in both directions would need to be accounted for.
Depends if 0.0.0.0/0 eventually ends up going out an IGW or some other route that heads to the Internet. In practical terms the default route usually means “send to the Internet” in most networks but really it just means “Send packets to this destination if I don’t know what to do with them”. If everything is private now and there’s no path “outside” then there’s no security issue. But if down the road you added a route to public subnets that then had a default route sending out to an IGW it would be an issue then.
Can it have a 0.0.0.0/0 route? Yes. From what I’m inferring from what you’ve said, there are no NAT Gateways or IGWs so said route won’t go anywhere, thus showing as “black hole” in AWS Console.
Should it have a 0.0.0.0/0 route? I don’t see why. If it’s private, all it needs is its local route and any peering or gateway endpoint routes if you are using those.
Even if you have a 0.0.0.0/0 route, it will remain as “black hole” until you specify the device for said route to use in the 0.0.0.0/0 table entry, so it would be cruft waiting to be fixed.
If you don’t require a 0/0 route to exit your network (your network is proxy based, etc.), one benefit of routing 0/0 is so you can setup a sinkhole. You can then instrument the sinkhole with monitoring for strange behavior.
This.. comparing a route table to a security group is like comparing a router to a firewall – yes, they are both network devices, but they do different things.