Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
Socat relays data between two independent channels of almost any kind: sockets, files, pipes, serial ports, or programs. It is a general-purpose connector used in testing and operations alike.

What Is Socat?
Socat takes two addresses and connects them. An address might be a TCP socket, a UDP socket, a Unix domain socket, a file, a pipe, a serial port, a pseudo-terminal, or a program it launches. Whatever the pair, socat opens both and copies data between them in each direction until one end closes. That is the entire concept, and it is why the tool turns up in such different places.
The name is short for SOcket CAT, and its ancestry is netcat. Where netcat does simple TCP and UDP, socat adds TLS, process execution, terminal handling, forking servers, and a long list of address types, which makes it the version people reach for once the simple one stops being enough.
Every invocation is socat [options] address1 address2. The grammar is consistent: an address type in capitals, a colon, its parameters, and then comma-separated options.
| Address | Meaning |
|---|---|
TCP:host:port | Connect outbound to a TCP service |
TCP-LISTEN:port | Accept an inbound TCP connection |
OPENSSL and OPENSSL-LISTEN | The same, wrapped in TLS with certificate options |
EXEC and SYSTEM | Run a program and attach its input and output |
UNIX-CONNECT | Talk to a Unix domain socket |
FILE and PTY | A file or a pseudo-terminal, including serial devices |
Options modify behaviour: fork handles multiple clients, reuseaddr avoids bind errors on restart, and terminal options such as setsid and sane make a connected shell behave like a real session.
Plenty of socat use has nothing to do with security testing. Administrators bridge a TCP listener to a Unix socket so a legacy client can reach a modern service, expose a serial console on the network for remote access to switches and industrial equipment, add TLS in front of an application that does not speak it, or forward a port during a migration. Developers use it to simulate a server, to inspect a protocol by inserting a relay between client and server, and to connect containers to devices.
That ordinary usefulness is exactly why it is installed in places nobody audits.
In security testing, socat does three things that matter. First, it creates fully interactive shells: a basic reverse shell has no terminal, so there is no history, no tab completion, and an interrupt kills the session, whereas a socat pseudo-terminal connection behaves like a normal login. Second, it relays traffic during pivoting, forwarding a port on a compromised host to a service deeper in the network. Third, it wraps channels in TLS, so traffic that would otherwise be obvious in inspection looks like an encrypted session.
It also acts as a diagnostic instrument. Inserting a relay between a client and a server, with logging enabled, shows exactly what a protocol is sending, which is useful when testing an undocumented application or an embedded device.
Socat has had its own vulnerabilities, and one is instructive. In early 2016 the project announced that the hard-coded 1024-bit Diffie-Hellman parameter used by its OpenSSL addresses was not actually a prime number, which undermined the security of the key exchange. The fix replaced it with a 2048-bit prime. The lesson generalises: tools that implement cryptography need patching like anything else, and a relay that terminates TLS is a security boundary.
Socat on a server is a question worth asking. Few production application servers have a legitimate need for it, and its presence in a container image is usually accidental. Useful signals include:
socat by a web server, database, or application service account.EXEC, SYSTEM, or PTY, which indicate a shell rather than a port forward.Controls follow from that. Remove the package from images that do not need it, apply application control so unexpected binaries cannot run on servers, enforce default-deny egress so a relay has nowhere to call, and segment internally so a forward reaches nothing of value. None of these are specific to socat, which is the point: the same measures neutralise every tool in this category.
Our Infrastructure Security Testing Services test whether those controls hold when a tester has a foothold and a relay.
Netcat handles simple TCP and UDP connections and little else. Socat supports many more address types, including TLS, Unix sockets, serial devices, pseudo-terminals, and launched programs, and it can fork to serve multiple clients. The trade-off is syntax: netcat commands are short and memorable, while socat expects an explicit address pair with options.
No, it is a general-purpose relay used widely in system administration, development, and embedded engineering. Security testers use it because interactive shells and port forwarding are things it does well, in the same way they use SSH. Its presence on a system is not evidence of compromise, but on a production application server it is worth investigating.
Where nothing depends on it, yes. Reducing the set of installed tools removes capability an attacker would otherwise inherit, which is standard hardening practice. Check first whether any service, container entrypoint, or operational script relies on it, and pair removal with application control so an attacker cannot simply drop the binary back on the host.
Yes. Its OPENSSL address types establish TLS connections in either direction, with options for certificates, verification, and cipher selection. This is genuinely useful for putting transport security in front of a legacy application. It also means a relay set up by an attacker can be encrypted, so detection should rely on host telemetry and connection patterns rather than payload inspection.
You May Be Interested In These
Cybersecurity Terms
17 November 2026
What Is the Difference Between Internal and External Audit?
Read More
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.