Port Scanning
Probing a machine's network ports to find which services are listening, the first step of both attacks and audits, now done to the entire internet in minutes, so anything exposed gets found.
Port scanning is probing a computer's network ports to discover which ones have a service listening. Every network service waits on a numbered port, through a socket: web servers on 80 and 443, remote login on 22, databases on their own. A scan knocks on many of them and records which answer. It is the standard first step of an attack and of a security audit alike.
The techniques exploit how TCP and UDP set up connections:
- Connect scan. Open a full connection to each port. Simple and reliable, but logged by the target.
- SYN scan. Send only the first packet of the connection handshake. A listening port replies with an acknowledgment, a closed one with a reset, and the scanner never completes the connection, which makes it faster and quieter. It is often called a half-open scan.
- UDP scan. Harder, because UDP has no handshake: silence might mean open or might mean filtered. A closed port usually triggers an error message, which itself can be rate-limited.
- No answer at all usually means a Firewall is dropping the probes.
Beyond open or closed, scanners identify what is running. Services announce themselves in greetings, and operating systems answer odd probes in characteristically different ways, letting a tool guess the software and version behind each port.
The best-known tool is Nmap, released by Gordon Lyon in 1997 in the hacker magazine Phrack, and free ever since. It even appears on screen in The Matrix Reloaded (2003), used accurately to break into a power grid.
Scanning grew from single hosts to the whole internet. ZMap, from the University of Michigan in 2013, could probe every IPv4 address on a single port in under an hour from one machine. Search engines such as Shodan, launched in 2009, scan continuously and index what they find, so anyone can look up exposed webcams, industrial control systems, or databases with no password.
The practical lesson is that nothing exposed stays hidden. A new server on a public address is typically probed within minutes, and botnets sweep constantly for devices with default passwords; see Internet of Things. IPv6 changes the arithmetic, since its address space is far too large to sweep, so scanners instead gather addresses from DNS records and logs. Home devices behind address translation are shielded from unsolicited connections, not by design but as a side effect; see Network Address Translation.
Defenses include closing unused services, denying inbound traffic by default, and limiting how fast one source can probe; see Rate Limiting. Decoys that alert on any contact catch scanners in the act. The legality of scanning others' systems varies by country.
See also2
Packet Capture
Recording the raw packets crossing a network interface for inspection, the debugger of networking, done with tools like tcpdump and Wireshark and limited mainly by encryption and switched networks.
Networks & Distribution7 connections
Remote Desktop
Controlling a computer from somewhere else by streaming its screen to a distant machine and sending keyboard and mouse input back, used for IT support, remote work and cloud gaming, and a favorite entry point for attackers when left exposed.
Networks & Distribution9 connections
Linked from6
- Internet of ThingsNetworks & Distribution
Everyday objects with network connections, from thermostats and light bulbs to industrial sensors, notorious for weak security, dependence on vendor clouds, and devices that outlive the companies supporting them.
- IPv6Networks & Distribution
IPv6 exists mainly to end address scarcity, with a large enough space that per-device NAT becomes optional.
- Network Address TranslationNetworks & Distribution
Rewriting the addresses in packets as they cross a router so that many devices can share one public IPv4 address, a stopgap that became permanent and broke the internet's end-to-end design.
- Packet CaptureNetworks & Distribution
Recording the raw packets crossing a network interface for inspection, the debugger of networking, done with tools like tcpdump and Wireshark and limited mainly by encryption and switched networks.
- Remote DesktopNetworks & Distribution
Controlling a computer from somewhere else by streaming its screen to a distant machine and sending keyboard and mouse input back, used for IT support, remote work and cloud gaming, and a favorite entry point for attackers when left exposed.
- TCP and UDPNetworks & Distribution
TCP guarantees ordered, reliable delivery at the cost of latency; UDP delivers packets fast with no such promise.