Summary

  • FTP runs two conversations at once: a long-lived control channel and a temporary data channel. The client dialled the control connection, but in the original design the server dialled back to open data—an ordinary callback that a firewall read as a stranger at the door.
  • In February 1994, Steven Bellovin's RFC 1579 recommended PASV: the server listens and reports a port, and the client originates the data connection through the boundary.
  • RFC 2428's EPSV dropped the embedded address entirely, reusing the control peer's address so NAT had less to rewrite. But direction was never identity: bounce attacks and passive-port theft still forced endpoints to bind the data peer to the control session.

One file transfer, two conversations

Watch a user download a file and you see one FTP session. Watch the wire and you see two. RFC 959 splits the work cleanly: a control connection carries the commands and replies, a data connection carries the directory listing, the file, or the stream of files. The data path can vanish mid-transfer while the control conversation stays perfectly alive.

The split was a good idea. Commands are small and long-lived; data is large and temporary. Representation, transfer mode and file-system operations get negotiated on the control path while a separate full-duplex pipe does the heavy lifting. But the split also meant logging in never finished the network work. Every transfer still had to answer a second question: who listens, and who calls?

The original answer was lopsided. The user side opened the control connection; for data, the user side normally listened and the server's data process dialled back. PORT let the client name a different host and port, which enabled a genuinely clever three-party trick: one client could command two servers and have one send straight to the other.

None of this was a bug buried in the spec. It was an explicit division of roles. The client described an endpoint; the server acted on the description. On a network where hosts could accept connections, the callback was unremarkable plumbing.

A filter saw a stranger at the door

By February 1994, Steven Bellovin's RFC 1579 described a different world. Clients picked a fresh data port for every transfer and announced it in PORT. A packet filter guarding the client then watched the FTP server open a brand-new inbound TCP connection to some unpredictable high-numbered port—and had to decide, with almost no context, whether to let it in.

The filter could allow known public services. It could maybe infer that a packet carrying an acknowledgement belonged to an established flow. What it could not safely do was leave every transient client port open just because an authenticated control connection existed somewhere else. The second connection meant everything to FTP and looked unsolicited to a box applying transport rules.

The failure wasn't that the firewall misunderstood the Internet. The two systems had divided authority differently. FTP let the client nominate an inbound endpoint; the firewall's policy assumed protected clients should originate new conversations. Each rule was locally sane. Stack them and the whole thing fell over.

PASV moved the active open

The escape hatch was already in the protocol. PASV tells the server's data process to listen on a non-default port and wait, instead of dialling out after the transfer command. The server reports the address and port it's listening on; the client then makes the active open.

That reversal changed what crossed the boundary. Now both the long-lived control connection and the temporary data connection began on the client side. RFC 1579 recommended vendors make clients use PASV instead of PORT—even outside firewalls.

The economy of the change is the point. FTP didn't have to merge its two planes. The firewall didn't have to become a universal interpreter of application dialogue. And a passive transfer didn't necessarily add a round trip, because clients were already sending PORT before every transfer. A small decision about who dialled made the existing architecture fit a common local policy.

Publication, of course, is not deployment. Some servers didn't understand PASV; clients could get an error and fall back to active mode. That kept old interoperability alive where the network allowed it—but the fallback still couldn't squeeze past a firewall that rejected the callback. Adoption lived in server support, client defaults and deployed rules, not in the document.

RFC 1579 even floated an APSV command that might have made every transfer passive without a separate request. It reported no known implementation. That unimplemented idea is quietly telling: a document can name a future, but only running participants can turn it into an operating convention.

EPSV stopped advertising the address

Classic PORT and PASV encoded an IPv4 address and a TCP port. That became a liability when IPv6 arrived and when NAT started rewriting addresses between the two ends. A translator might have to peer inside the FTP control payload, recognise the command, and rewrite a network address embedded in application data.

RFC 2428 supplied the extended pair. EPRT carries an address-family number, a network address and a port, preserving the active arrangement for IPv4, IPv6 and whatever came next. EPSV pushed the passive idea further: its reply contains only the listening TCP port. The data connection uses the same network protocol and peer address as the control connection.

Dropping the address was more than syntax. The control connection had already established which server the client reached. For an ordinary two-machine transfer, repeating a network address just created another claim a NAT might have to repair and a client might have to interpret. EPSV narrowed the message to the one new fact the client actually needed: the temporary port.

EPSV ALL made the session boundary explicit. Once the server accepts it, it must reject EPRT, PORT, PASV and every other data-setup alternative for that control session. A client that later discovers it needs a three-way transfer has to open a new FTP session. Strong, but local and reversible at a clear boundary—it doesn't rewrite every other session on the network.

A coordinate was never a credential

Changing direction solved reachability. It did not answer who was entitled to occupy either endpoint.

RFC 2577 documents the active side's most striking abuse. Because PORT could name a third party, a client could ask an FTP server to connect to a different machine and service and send attacker-chosen bytes. This "bounce" hid the initiator and could slip past address-based restrictions. Suggested defences: refuse active data targets below TCP port 1024, disable PORT where server-to-server transfer isn't needed, and check both control and data addresses whenever access policy leans on location.

Passive mode moved the exposed listener rather than abolishing it. The server now opened a transient port. If an attacker could predict the next port and connect first, it might deny the legitimate transfer, receive a file meant for someone else, or inject a forged file into a stream the client expected from an authenticated server. RFC 2577 recommended random local data ports. More fundamentally, endpoints had to decide whether the data peer actually belonged to the control session.

That distinction keeps the history honest. PASV made the connection direction friendlier to a client firewall. EPSV made the coordinates friendlier to IPv6 and NAT. Neither made FTP confidential, authenticated the file stream, or proved that the first process to reach a listening port was the logged-in party.

A small extension redistributed the work

The story usually collapses to "passive FTP works through firewalls." What endured was the allocation underneath it.

The shared protocol defined only enough for one side to announce a listener and the other to open the path. The client chose whether to request passive operation. The server chose a port and decided which setup commands and destinations it would permit. The firewall kept its local rule about new inbound flows. Implementations kept the duty to tie two transport connections to one security context.

This is minimum common machinery producing local future choice—the same principle that keeps any coordination layer honest. An old active implementation could keep running where both ends and the network accepted it. A client and server could adopt passive mode without a central cutover. EPSV could become the cleaner two-party profile while EPRT retained the exceptional three-party capability. Incompatibility showed up as a failed command or connection, not as an institution declaring one participant invalid.

The limits were equally local. A server could disable PORT; a client could insist on EPSV; a NAT could avoid payload rewriting; a security policy could reject a data peer that didn't match the control peer. Each decision changed that participant's compatibility surface. None of them needed to turn a port number into universal authority.

Sources and limits

The two-connection model, the normal server-initiated data connection, PORT and PASV come from RFC 959. The firewall analysis and the recommendation to make client-side passive operation the default come from RFC 1579. EPRT, EPSV, address-family support, address omission and EPSV ALL are specified in RFC 2428. Bounce attacks, address checks and passive-port theft are described in RFC 2577.

These documents don't measure current FTP deployment or prove that every firewall, NAT, proxy, client or server behaves as recommended. They don't make passive FTP a secure transport. They support a narrower history: when a server callback collided with a new boundary, FTP survived by letting the client initiate the second connection—and by keeping the remaining trust decisions in running systems.