Technology1 min read

Port 0: The Port That Does Not Exist

By · Published by Everything Blog

In short

While IANA officially designates the value as reserved, core protocol specifications contain no rules preventing packets from being addressed directly to it on the wire. Operating system APIs prevent programs from binding to it natively by assigning dynamic ports instead, but packet-filtering utilities can bypass this obstacle entirely. Demonstrating this method, researchers established an operational IRC network by redirecting incoming packets, while scans across the entire IPv4 address space confirmed active traffic already present on the network.

Key points

  • Network operators can successfully expose functional services on port zero by using raw s…: Network operators can successfully expose functional services on port zero by using raw sockets or packet-filtering redirect rules.
  • Researchers demonstrated live connectivity by routing incoming port zero traffic directly…: Researchers demonstrated live connectivity by routing incoming port zero traffic directly into a functional IRC network.
  • Scans across the global IPv4 address space proved that multiple active hosts already util…: Scans across the global IPv4 address space proved that multiple active hosts already utilize port zero across the public internet.

Sources checked by our analysis pipeline: 1

Port 0 is the port you are not supposed to use, so nobody looks there. So we put an IRC network on it. Then I got curious whether anyone else had, and scanned all of IPv4 for port 0. Turns out we weren't alone, and some of our neighbours really shouldn't be there.

Ask any program to listen on port 0 and it will hand you a socket on port 47193...or 58037...or whatever the kernel felt like that day. Port 0 is not a port you can have. It is the number you pass when you want the operating system to pick one for you.

But a TCP header is just bytes. The destination port field is 16 bits wide, and 0x0000

fits in 16 bits as well as anything else does. Nothing on the wire stops a packet from being addressed to port 0. Your tools will refuse it, your browser will block it, and your scanner's default port list skips it, because everyone agrees it isn't a real port.

Which makes it a pretty good place to hide…

Technology