RFC 959: FTP: File transfer with separate channels

Summary

In October 1985, Jon Postel and Joyce Reynolds published RFC 959, the still valid specification of the File Transfer Protocol. FTP separates a control channel for commands from separate data connections for files and directory listings and was designed for very different computers with different character sets and file formats. The protocol goes back to RFC 114 from 1971, making it one of the oldest internet services still in use.

Control channel and data channel

A client opens a control connection to the server and sends text commands such as USER, RETR or STOR; the server replies with three-digit codes. Each transfer gets its own data connection. In active mode the server sets it up towards the client after the client has named an address with PORT; in passive mode the server opens a port on PASV, to which the client connects.

RFC 959 even allows transfers between two servers, controlled by a third host. The types ASCII, EBCDIC and IMAGE show which world the protocol was made for: DEC TOPS-20, IBM mainframes and Multics each stored text differently.

Why FTP causes problems today

The separate channels do not get on well with firewalls and NAT, which have to rewrite addresses in PORT commands or guess data connections. In 1998 RFC 2428 added the commands EPRT and EPSV for IPv6 and NAT.

More serious is that RFC 959 transmits user name, password and data in plain text. RFC 2228 created a framework for security extensions in 1997, and RFC 4217 described FTP over TLS in 2005. In practice, SFTP over SSH and HTTPS have largely replaced classic FTP.

Ideas

  • Commands and data run over separate connections.
  • Three-digit reply codes report success, intermediate state and errors.
  • In passive mode the client also sets up the data connection.
  • Data types translate between different character sets and storage formats.
  • FTP allows transfers between two servers.
  • Credentials and content cross the network in plain text.

Insights

  • A protocol for heterogeneous mainframes of the 1970s survived because it was simple to implement and precisely because of that became a security problem.
  • Separate channels are elegant as long as the network is end to end; with NAT and firewalls they became a permanent construction site.

Facts

  • RFC 959 appeared in October 1985 and replaces RFC 765 from June 1980.
  • RFC 114 described the first FTP mechanisms in April 1971.
  • RFC 2428 from 1998 adds EPRT and EPSV for IPv6 and NAT.
  • RFC 4217 from November 2005 describes FTP over TLS.

References

Critique

  • RFC 959 provides no protection at all for passwords; user name and password travel in plain text over the control connection with USER and PASS.

Remarks

  • The major browsers have since removed FTP: Chrome with version 88 and Firefox with version 90, both in 2021.

Recommendations

  • Use classic FTP only for deliberately public downloads.
  • Use SFTP or explicit FTPS for access with login.
  • With FTPS, configure passive mode with a fixed port range and open this range in the firewall.

Read the RFC at the RFC Editor

Search the Web Archive

Found a mistake or have something to add? Get in touch.