sigh
NAT provides a false sense of security as a side-effect.
There is nothing in NAT what couldn't be done with DENY rule in the firewall.
sigh
NAT provides a false sense of security as a side-effect.
There is nothing in NAT what couldn't be done with DENY rule in the firewall.
Misconfigured firewall is a gaping hole into the local network.
NAT security is a dangerous illusion that people just can't seem to stop falling for.
If you mean to imply that what I'm saying here is ridiculous because a "firewall misconfiguration that exposes any one (non-router) host to the public Internet" is only possible with a IPv6 or a NAT-less IPv4 network then you would be wrong (unless you were just being pedantic that I excluded such an example). A misconfigured firewall that exposes an internal host to the Internet would just look slightly different with NAT, since hosts are usually exposed via the firewall's port forwarding rules instead of the full featured allow/deny rules. There are technically going to be more firewall configuration options in NAT-less networks, but the risk of a misconfiguration accidentally exposing a host is not going to be any greater here.
If anything port forwarding actually encourages "accidental" exposure. They are usually kept in a separate interface from the other firewall rules, which indirectly encourages configurations that do blanket exposure to the Internet. Ideally internal networks should be configured to only allow inbound connections to specific host:ports from trusted external IPs/IP-ranges, but NAT makes this more complicated to do, so people get complacent with just exposing all inbound connections to specific host:ports because that is what port forwarding is usually going to default to absent of any other configuration.
Why are these objections always "What if I configure my IPv6 network in worst way possible?"
Your router's configuration interface should be hosted on either a ULA or a link-local address, neither of which are routable. Security isn't the only reason you want to do that.
If you host the config interface on a globally-routable address, that address will change every time your ISP delegates your network a new prefix (which happens about as often as you would get a new external IPv4 address via DHCP). A router is the one of the few things on your network you should be able to access even without working DNS, so why do you want the config interface to be on an address than can change unexpectedly?
ULA and link-local addresses can be static: The network prefix will be static.
In IPv4, this is like asking "But what if I host my router's interface on the public assigned-by-DHCP IP?" My response would be "Why the hell would you host the config interface on an address that can change at any time?"
My hope is that by walking through it with simplified examples, this fear is mitigated.
I still don't understand. Even if we assume that the configuration interface has no internal security (e.g., a strong password), how would a router with a NAT but with a totally busted firewall allow access to its configuration interface from arbitrary external hosts (short of having a forwarding rule for itself, which I suspect wouldn't even work on many routers)? What would such an inbound connection from an adversary look like?
> If anything port forwarding actually encourages "accidental" exposure. They are usually kept in a separate interface from the other firewall rules, which indirectly encourages configurations that do blanket exposure to the Internet.
It would seem to me like host-specific IPv6 firewall rules have their own challenges. Under IPv4 NATs, special internal hosts (that need their own rules) can be trivially assigned persistent labels through DHCP. With IPv6, if each host chooses its own address and rotates it regularly, then how are hosts persistently identified in the firewall rules? By MAC address? Or are there other systems for this?
The dangerous illusion is to think this is a coincidence.
False, the default behavior is the same as IPv4/NAT. While the address scheme is technically "global", the firewall will still by default be blocking inbound connections to those addresses.
It is not unlike a random uuid or even a mac address in that the address is simply globally unique in nature, but not necessarily accessible unless you deliberately configure it to be, not unlike how one deliberately configures port forwarding in a local NAT based network firewall.
With IPv6 your ISP is giving your router an address "prefix" instead of just a single address as they usually do. The process of generating these addresses is therefore entirely local and anonymous from everything else on the Internet, obviously excluding hosts that are deliberately connected to who can then see the source address, but even in these cases your global address changes constantly so remote hosts still can't figure out your internal network topology. The reason these addresses are globally unique despite this is thanks to the ISP provided "prefix", which is essentially just a unique namespace.
> With the firewall as the only one separation.
As is the case with a NAT based network.
The default behavior it is not the same as IPv4 with NAT, where the internet and local are different networks.
>It is not unlike a random uuid or even a mac address in that the address is simply globally unique in nature, but not necessarily accessible unless you deliberately configure it to be, not unlike how one deliberately configures port forwarding in a local NAT based network firewall.
The prefix the ISP gives to the router for to assign the IPv6 addresses to computers and devices it is the prefix of the unique uuid each one will get assigned. An unique IPv6 address is assigned to each one of these computers and devices, case contrary they would not be accessible from internet.
If the firewall fails or if it's shut down, all get exposed to internet, because IPv6 it is designed to make every computer and device part of the internet network by default & design.
I don't get the "false-security" issue with NAT.
I still need NAT if I can't allocate 1 IP per host, so if I create a NAT rule, why would I also need a firewall rule covering the same port (assuming default is DENY)?
Where does the false-security come into play?
"NAT is a security boundary" sits on using RFC1918 addresses and "nobody can enter my network because there is no DNAT rules for it!".
If you know how the routing actually works on Ethernet networks then it should be pretty obviously, but if not: there is no magic there.
If you know what the packet is addressed to some network not in your routing list, then you just throw it the default router with dstaddr of the recipient and MAC address of the default gateway. There is no security or anything.
And the same applies to the traffic you receive on the external interface. Anything what would be received on the external interface would be forwarded to your local networks if dstaddr of the packet is in your local network range.
And there is two ways to throw some packets with dstaddr in RFC1918 to your external interface:
a) be on the wire of your external interface - you can't forward those packets over Internet, obviously
b) have DNAT what would rewrite the IP of your external interface in dstaddr to some internal IP
So having internal addressing according to RFC1918 on the LAN and therefore using NAT to access anything else - doesn't make your network secure.
Usually this is not a problem, but if you are thinking what NAT do makes your network secure then you have two problems: possibly an unsecure network and feeling what your network is secure.
> why would I also need a firewall rule covering the same port (assuming default is DENY)?
Assuming. There are people out there who can't even configure their firewall properly: https://news.ycombinator.com/item?id=38879470
EDIT: Oh, how quaint, just downvoting without responding. Remember, downvotes are not for your opinion on the comment.
But while we are at it, two more options on having an external packet traverse to your local network:
c) have a host on the LAN initiate a connection to the Internet, which opens up a port on the external interface of the router. Sure, in 99.9999% you can't use that, because the statefull firewall would discard the incoming packets not from the host which a client communicates... Until the attacker is that host in the first place, ie malware or even a deliberate operation
d) UPnP. 'Nuff said.
I agree about (some to most) of your writing and it was very informative (and lengthy!) but I didn't find the time to write something back which would honor your response enough.
Thank you for providing a feedback, because it's way more valuable than some virtual updoots. But thanks for the virtual updoot too!
Why?
> There is nothing in NAT what couldn't be done with DENY rule in the firewall.
DENY doesn't provide you stateful tracking. I.e. you want to let traffic between two hosts flow, but only if an internal host on your network initiated it.
And once you do that, you basically have 80% of NAT.
Alternatively, if you mean local to external host connections, why would an inbound deny rule not work here?
Suppose that a host wants to open outbound connections to other hosts on the same network, as well as across the Internet, without regard to which kind of destination it is. By what mechanism does the host decide which source address to use? And how portable is this mechanism across different systems?
Host A
Address1 "Global:Address:A"
Address2 "Local:Address:A"
Host B Address1 "Global:Address:B"
Address2 "Local:Address:B"
If you are Host A and want to connect to Host B, while simultaneously ensuring that your connection to host B is done over your local network; Then you would initiate this connection using "Local:Address:B"; and since it's prefix ("Local") matches the prefix of one of your addresses:"Local:Address:A", then your OS would automatically use that as it's source address.Now if Host A connected to Host B via it's global address "Global:Address:B", then it would also work, but then Host A's connection would look like any other Internet address (and would still technically be routed over the internal network since it's the shortest path).
The router/firewall, which would sit in front of these two hosts, would still see this all as local traffic though, and in the vast majority of cases be configured by default to block all incoming traffic from outside the network. This means unless the firewall is configured to allow some kind of external connection into Host B, and Host B does not initiate the connection itself, then it would never actually see any global addresses from anything other than Host A.
> And how portable is this mechanism across different systems?
It's all about what address you use, so I could say portability would be limited to IPv6 support, but broadly speaking everything I've described here also applies to NAT-less IPv4 too, which is how most cloud VM networks are usually configured. Having both Local and Global addresses can be convenient in cases where you have multiple environments (ie: dev,stage,prod), since you can reuse most configurations referenceing internal system IP addresses.
This is the step that I'm particularly concerned about. Suppose that I have a Host B on my network, and I want to totally ensure that it has nothing to do with the global Internet, so I assign it only a local address and no global address. Then, I set up a local DNS service in my network, so that any host can ask for "Host.B" and get "Local:Address:B" back.
The problem is, will every kind of Host A, no matter what kind of embedded or IoT or corporate nonsense it's running, be able to properly manage both its local and global source addresses, and select its local address when it wants to connect to "Host.B"? This is a lot more to expect from a host than with IPv4 NAT, where Host A just uses its local address, and the router transparently handles the differences between local and global connections.
Fundamentally all NAT does is simulate this kind of traditional network. It's an attempt to replicate this behavior by having all hosts "share" a global IP address that the router would then dynamically redirect back and forth based on which local host initiated the connection.
However the packets must physically pass through your firewall to get into your network. The IP addresses are simply an identifier to put onto the envelope, a firewall does not give a fuck about what the envelope says if a remote host attempts to initiate an inbound connection and this is forbidden (which it always is by default). Before a packet from the Internet even gets an opportunity to even get to the NAT part it is trashed. The firewall is the security guard at the door checking your badge, after that you go to the reception who "routes" you to the correct host. If an address isn't routable, which may be the case in a NAT network, then it's no big deal since you can just threaten the receptionist to tell you where to go
All NAT routers with Internet access will have both a local address and a global address natively, that's how it is even capable of sharing it's Global addresses in the first place, the firewall is what protects it, not NAT. If something can magically get past your firewall then that implies they have full control of your router now and can route packets wherever they like, remember this is hypothetical because breaking past a firewall is already a complete system failure, the boat has already sunk. At the end of the day it's all the same firmware, why would you trust the NAT part more than the Firewall part? It's literally just semantics.
> This is a lot more to expect from a host than with IPv4 NAT, where Host A just uses its local address, and the router transparently handles the differences between local and global connections.
I'm reiterating here but everything I've described so far is in relation to IPv4, all IPv6 introduces to the equation is: more addresses so you don't need NAT, a clever way to do dhcp on a local host without router intervention: SLAAC (routers can still advertise what to use as prefixes to these addresses). It also fuses together some of IPv4's extensions into one cohesive protocol that's simpler to understand. It's not nearly as radical as you may believe, it simply brings things back to how they were when IPv4 addresses were abundant and simplifies your firewall since you can easily configure which traffic can go to which host without involving weird port forwarding shenanigans.
Attachment to NAT for security is fundamentally a misunderstanding of what role it is serving, an assumption that it has more responsibilities than it actually does. It is not DHCP, it is not a Firewall. If you want to expose a local host to the Internet with NAT you configure the firewall to "forward the port" so inbound connections get redirected to your designated local host. If you want to expose a NAT-less local host to the Internet, you go to the firewall configure it to allow inbound connections with destinations set to your local host's global IP address and it's port.
FYI if you want you can have a static global address only used for inbound connections in addition to randomized globals for outbound connections. Though generally if you are setting up a server anonymous outbound connections are kinda pointless imo.
Even if every NIC supports it, how do I know that every OS supports it? Every system I've ever used has only needed a single address, so the multiple-address cases would seem to be a small minority (and mostly in networks with homogeneous systems), and not something I'd expect to be thoroughly tested on every random IoT device.
> If an address isn't routable, which may be the case in a NAT network, then it's no big deal since you can just threaten the receptionist to tell you where to go
What do you mean? If a host doesn't have its incoming connections forwarded from the router's global address, then how can it be accessed from the outside?
> If something can magically get past your firewall then that implies they have full control of your router now and can route packets wherever they like
You still haven't explained why this is the case. How does a firewall that exposes the router's address necessarily allow arbitrary control over the router? After all, I can access the router on my WAN all I want through its local address, and yet I'm still unable to reconfigure it.
> I'm reiterating here but everything I've described so far is in relation to IPv4, all IPv6 introduces to the equation is: more addresses so you don't need NAT, a clever way to do dhcp on a local host without router intervention
My big concern here is that I don't necessarily want every local host to be responsible for managing this, since I trust the router to have correct behavior far more than I trust every arbitrary host to have correct behavior.
To make it more specific: if you advertise both 2001:db8:1::/64 and fd00::/64 as on-link on your network, a host can connect from 2001:db8:1::a to fd00::b, and fd00::b can reply to 2001:db8::a. Because both ranges are on-link, all communication is on-link and is never sent to the router. (This is just the normal behavior for on-link ranges.)
If you actually mean two separate networks, where traffic has to be routed via the router... obviously there's a lot of ways of setting up firewall rules, and it depends on exactly what you want to do, but the simplest approach is to say "deny new connections coming in via the WAN interface". This will allow new connections going out the WAN interface, and also allow all connections between the two local networks in both directions, with no need to specify any IP ranges in the firewall at all.
No. I want an address that can connect to the hosts on the Internet, but I don't want random hosts on the Internet to connect to it.
Basically, what NAT does is pretty much the perfect compromise for small-scale home/office security.
Gotcha glad we are on the same page now, so you do want the functionality of an inbound deny all rule, which is configured by default on all consumer routers, regardless of if they are IPv6 or even NAT/IPv4.
Why in the world, would you ever, want to expose all your local hosts to the Internet by default after all? That would be insanity.
It also has nothing to do with IPv6.
So your options are either to prohibit UDP (goodbye QUIC) or to have stateful tracking.
And if you want to do something like host a minecraft server on your computer that you can then let your friends access (and only your friends), you need a firewall config anyway.
> DENY doesn't provide you stateful tracking.
Yes, but I wrote that for the usual "but NAT doesn't let attackers get in my network!!1" in mind. Not the first time here: https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...
sigh I probably should just make a blog post on it or something and just point people there.
It's not an illusion, it's actual security. Is it completely foolproof? No. But it definitely makes it easier to use, e.g. esp8266-based devices without worrying that they'd be knocked offline by an automated script that sends a couple megabits of traffic their way.
And to do the same on IPv6 you need 80% of NAT, in particular you need stateful connection tracking.
(192.168.0.101)$ echo "Hello from inside" | nc -vlp5000
Connection from [203.0.113.1] port 5000 [tcp/*] accepted (family 2, sport 36596)
(203.0.113.1)$ nc 192.168.0.101 5000
Hello from inside
And here's the 3-way handshake captured on the router: wan0 In IP 203.0.113.1.36854 > 192.168.0.101.5000: Flags [S]
lan0 Out IP 203.0.113.1.36854 > 192.168.0.101.5000: Flags [S]
lan0 In IP 192.168.0.101.5000 > 203.0.113.1.36854: Flags [S.]
wan0 Out IP 192.168.0.101.5000 > 203.0.113.1.36854: Flags [S.]
wan0 In IP 203.0.113.1.36854 > 192.168.0.101.5000: Flags [.]
lan0 Out IP 203.0.113.1.36854 > 192.168.0.101.5000: Flags [.]
See? It works just fine. Here's the other direction, just in case you think I wasn't NATing: lan0 In IP 192.168.0.101.44682 > 203.0.113.1.5000: Flags [S]
wan0 Out IP 203.0.113.58.44682 > 203.0.113.1.5000: Flags [S]
(If you want to see any aspect of the config, just ask. Give me commands to run if you want.)This works ONLY if you control the ISP infrastructure, and the router is allowing inbound traffic to LAN. Mikrotik by default doesn't.
I didn't misconfigure the router here. Please ask for whatever config info would convince you of that. It's true that most router devices you buy (presumably including Mikrotik) do block inbound connections by default, but they do it with a firewall, not with NAT. The reason they need the firewall is because NAT doesn't do it.
This automatically makes it a non-issue for pretty much all home and small office networks. Meanwhile, the DEFAULT state for IPv6 is being open to the world.
> I didn't misconfigure the router here. Please ask for whatever config info would convince you of that.
OK. How can I ping your address? It should be easy, right? I'll even give you my IP: 208.52.76.162 , what do I need to set up to be able to ping all your internal hosts?
Let's make that experiment.
To ping your internal hosts, I'd need to gain access to your building or one sharing the same L2 segment ("dfsea"?), then configure a static route for 10/8 / 192.168/16 / etc pointing at you. I would not need any control over the ISP.
And most of Wave users (or any broadband users in the US, for that matter) use DOCSIS, which does not have a shared L2.
> OK. How can I ping your address? It should be easy, right? I'll even give you my IP: 208.52.76.162 , what do I need to set up to be able to ping all your internal hosts?
> Let's make that experiment.
Sure. Since I'm using RFC1918 on the inside you'll need to be on my immediate upstream segment to test this, so I set up a gre tunnel for you. If you're on Linux you can run something like this (otherwise I'll leave it up to you to map the tunnel setup to whatever you're using):
$ ip netns add temp
$ ip link add gretap type gretap local 208.52.76.162 remote 151.115.75.246
$ ip link set netns temp gretap
$ ip netns exec temp "$SHELL"
(inside netns)$ ip link set up dev gretap
(inside netns)$ ip addr add 203.0.113.150/24 dev gretap
That will put you on my upstream segment, outside of my NATed network, using 203.0.113.150. Then just do this: (inside netns)$ ip route add 192.168.0.0/24 via 203.0.113.58
(inside netns)$ ping 192.168.0.101NAT _will_ stop inbound connections in practice, unless you control the ISP. So in practice NAT provides more than enough security for typical SOHO users.
> Sure. Since I'm using RFC1918 on the inside you'll need to be on my immediate upstream segment to test this
Exactly. Which means that you need (in practice) to control the ISP for this attack to work.
I'm not seeing any gre packets from you. Are you having trouble getting the tunnel working?
To let things work, we added ALG (application level gateway), which are code used to remotely allow flows
Look at them, a whole universe of issue lies there
The current state of the art is to use hole punching and STUN.