by pdkl95 · 7y ago · 0 comments
Far worse than the maintenance costs, NAT has has prevented (modulo a few niche environments) the development of any network software that isn't client-server. NAT is a party line[1]. Anyone that thinks NAT is useful for anything other than an address space hack (or a few other less common uses[2]): why aren't you replacing all of your household (or small business) phone numbers with a single party line? Surely you could implement a local PBX if you needed to support more than one kind of incoming call. Or what if the phone company offered a new type of line: 10% cheaper, no way to receive incoming calls. Well, sometimes you can get some incoming calls if you convince whomever actually controls the inbound phone number for your phone line to forward calls that come from certain numbers or some other criteria, like they did with the old party lines: just get people calling you at the shared number to pause after connecting and dial you per-arranged ring code[4]. (warning the phone calls might still be answered by whomever picked up first)
NAT keeps us on the client/increasingly-centralized-server model. NAT removed one of the most important benefits IP-based internetworking: no discrimination between different types of network host. Each addressable host has the power to publish - using any protocol, including new protocols - without needing an imprimatur[5]: the permission to publish from granted by some other party.
If we are very lucky, we might regain some of the lost capability with IPv6.
[preemptive response: no, NAT does NOT provide any security benefits. NAT just rewrites packet address/ports. Dropping packets is the job of the (probably stateful) firewall. Nobody wants to change that part, firewalls are important. And if you think NAT hides your internal addresses... really? Is it 192.168.x.y? Can I send GET requests to your router with a webpage full of hidden/obscured img tags with src="http{,s}://192.168.1.{1..254}/whatever?i=want"?]
[1] https://en.wikipedia.org/wiki/Party_line_%28telephony%29
[2] Most of the time, when people say "NAT", they are only referring to the many-to-one ip masquerading similar to what is implemented in most home routers, or perhaps the "carrier grade" extensions of the same basic idea. They are probably not referring to the other flavors of NAT[3].
[3] https://tools.ietf.org/html/rfc2663#section-4.0
[4] https://en.wikipedia.org/wiki/Party_line_%28telephony%29#Sel...
NAT automatically prevents attackers from scanning for and attacking listening ports on the hosts behind it. Given that those who want a service to listen to the Internet should also know enough to forward the ports, I'd say it's a pretty important security benefit and one that has greatly slowed the spread of worms.
Can I send GET requests to your router with a webpage full of hidden/obscured img tags
That requires extra action on the part of the "attackee", whereas without NAT the attacker would be able to directly connect to a port, to any machine anywhere on the Internet.
So does a few lines of iptables (which work just as well with IPv4), which even most ISP routers that support IPv6 have managed to get right. On the other hand the workarounds for when you actually do want to accept connections through a NAT (cough UPnP) have been consistently misconfigured or had implementations which are simply vulnerable.
Here's NAT, as implemented on a Linux machine: `iptables -t nat -A POSTROUTING -o wan0 -j MASQUERADE`. You see that "-o wan0" there? That means the rule only applies to outbound connections, and it does nothing whatsoever to inbound connections. How can a rule that doesn't apply to inbound connections possibly do anything about the behavior of inbound connections?
On the other hand, v6 does do something about the spread of worms: networks use 64 bits of address space, so it's difficult to even find an active network host by scanning. On v4, you can find all active vulnerable hosts by just trivially scanning the entire 32-bit address space. An exhaustive search of a /64, which is just one single network, requires 0.9 ZB of traffic.
(Of course there are other ways of finding active hosts, and being obscure doesn't make the hosts in question secure -- but it _does_ render network scanning as a tool for spreading worms more or less obsolete.)
Outside of exotic situations, part of setting up a NAT is putting your internal hosts on a private IP range. This makes inbound packets impossible (if your ISP didn't screw up).
Even if you didn't do that, all you have to clarify is that you're replacing the existing routing rules with NAT. Mystery solved.
And in fact, putting your internal hosts on a private IP range doesn't prevent inbound connections either. It'll limit the set of people that can do them, but anybody on your immediate upstream connection can do it just by sending packets to your router. That probably means at least your ISP and anybody who can order them to cooperate.
NAT isn't a security boundary.
(And if you replace your routing rules with NAT then everything will break, because the only thing NAT does is rewrite addresses in packets. They still need to go through the routing table to be routed.)
That the firewall, not NAT. NAT on it's own - without a firewall, a very unusual configuration - will route packets to your "private" addresses if that address is in the packet's DST address field (maybe; it depends on the rules the router uses when deciding how to rout a packet, which is also not NAT). NAT is only about changing the address field. RFC 2663 even recommends that NAT should usually be "used in conjunction with firewalls to filter unwanted traffic". Unless you're referring specifically to changing the address/port fields in the packet header, you are probably referring to a stateful firewall. That's the feature that is usually responsible for dropping packets, preventing scanning of your LAN.
TL;DR - address translation (NAT), and choosing what to do with a packet (firewall, routing rules) are separate, independent features. NAT - by itself - isn't really involved in routing/firewall step. That's why it's extremely unusual to see NAT in isolation. The thing you see on e.g. most home routers is basic use of NAT combined with a simple router and (hopefully) a powerful stateful firewall.
> should also know enough to forward the ports
That's nice iff you get to decide which ports are forwarded. Good luck getting a carrier to forward ports. It isn't going to happen if you're in some parts of China behind 7 layers of NAT. Port forward in that situation would be a nightmare, assuming it was even theoretically possible to convince the 7 upstream authorities that they should forward a port to you.
However, minutia about port forwarding doesn't address my main point: that NAT limits the type of software that is developed. Are you really going to write a network app that only works if people setup port forwarding? Would business use telephone for as many purposes if phone numbers were all shared party lines?
> That requires extra action on the part of the "attackee"
That "extra action" is probably the most common vector of infection for modern malware. Ignore it at your own peril.
And how does such a packet make it to your router, exactly?
I disagree that it's "the firewall" doing the real work here. If things are configured properly, a firewall should be 99% irrelevant.
It. Does. Not.
At all
Most routers won't forward those packets. But that's got nothing to do with whether those routers are running NAT or not.
More like cgNAT makes you share the external address between many people. It gives you plausible deniability: "dear $forum admin, it's not me creating multiple accounts for trolling from the same IP address, it's the guy from the next building, I swear!" / "it's my neighbor's porn visible on https://iknowwhatyoudownload.com/en/peer/ not mine!"
Of course that's Not Security, that's just obscurity, but damn, it kinda does feel good :D
OK, you remove NAT but if firewall remains with default DROP ALL policy, what's the difference? Even worse, the firewall now isn't in your home, it's in ISP network and out of your control. So you need imprimatur as before.
In an IPv6 network without home routers the problem of malware spreading between peers remains. Chances are high that ISPs will be forced to restrict peer communications just like they did in NATed IPv4 networks.
CGNAT breaks all this, of course, since the public IP address is on the ISP's side and they're unlikely to implement port forwarding on demand. For that matter, there probably aren't enough ports available to support all the subscribers sharing a given public address, and there could be security/trust issues as well with incoming connections to the same IP being dynamically routed to different subscribers according to the port number. (All the problems associated with dynamic IP address reuse, but with much quicker turnover.)
With IPv6 you can either let the destination deal with incoming connections directly—which has about the same security as a NATed IPv4 network with UPnP—or manually configure the firewall to only allow specific connections through according to the destination IPv6 address and/or port. Either way you won't have any issues with multiple hosts wanting to accept traffic on the same port numbers. There is no technical reason why there couldn't be a protocol like UPnP(v6) just for opening ports in the router on demand, but in a NAT-free network it wouldn't really serve any purpose.