ietf-corpus

rfc-4217

Securing FTP with TLS

P. Ford-Hutchinson
date2005-10 streamIETF wgnon working group statusPROPOSED STANDARD pages29 canonicalhttps://www.rfc-editor.org/rfc/rfc4217 doi10.17487/RFC4217 errataview
This document describes a mechanism that can be used by FTP clients and servers to implement security and authentication using the TLS protocol defined by RFC 2246, "The TLS Protocol Version 1.0.", and the extensions to the FTP protocol defined by RFC 2228, "FTP Security Extensions". It describes the subset of the extensions that are required and the parameters to be used, discusses some of the policy issues that clients and servers will need to take, considers some of the implications of those policies, and discusses some expected behaviours of implementations to allow interoperation. This document is intended to provide TLS support for FTP in a similar way to that provided for SMTP in RFC 2487, "SMTP Service Extension for Secure SMTP over Transport Layer Security", and HTTP in RFC 2817, "Upgrading to TLS Within HTTP/1.1.". This specification is in accordance with RFC 959, "File Transfer Protocol". It relies on RFC 2246, "The TLS Protocol Version 1.0.", and RFC 2228, "FTP Security Extensions". [STANDARDS-TRACK]

updated by

Extracted elements (30)

design-rationale §1

FTP-TLS upgrades an existing plaintext FTP session in place on the standard port 21, rather than using a separate dedicated port. This is analogous to STARTTLS in SMTP (RFC 3207) and HTTP upgrade in RFC 2817, and avoids requiring firewall policy changes for a new port.

tls

design-rationale §9

Only two PROT levels—'C' (Clear) and 'P' (Private)—are defined for FTP-TLS because TLS negotiation inherently encompasses and exceeds the distinctions between the 'S' (Safe/integrity-only) and 'E' (Confidential/privacy-only) levels; a single TLS session provides both integrity and confidentiality simultaneously.

tls, security

design-rationale §5

The CCC command exists to accommodate NAT and firewall devices that must inspect the FTP control connection to adjust their behavior (e.g., for PORT/PASV address rewriting). Authentication and PROT negotiation happen under TLS protection, after which CCC drops TLS from the control channel while maintaining data connection protection.

tls, nat

interoperability-note §9

PBSZ 0 is not strictly valid per the grammar in RFC 2228 Section 8.1, which specifies decimal integers from 1 to (2^32)-1. However, using '0' to mean a streaming (unbuffered) protocol is unambiguous in context and is required by this specification for FTP-TLS.

tls

interoperability-note §7

Server-to-server (proxy or third-party) data transfers are explicitly excluded from TLS protection under this specification, because neither server can simultaneously act as the TLS client while also acting as an FTP server in the firewall-friendly model.

tls

interoperability-note §4.2

The '334' response defined in RFC 2228 implies an ADAT exchange will follow, which does not occur with TLS. The correct server response to an accepted 'AUTH TLS' command is '234', not '334'.

tls

interoperability-note §14

TLS does not support the notion of TCP Urgent data, which FTP historically used to signal ABOR and STAT commands during data transfers via the Telnet IP/DM mechanism and SIGURG. Implementations MUST route these commands through the TLS session instead.

tls, tcp

normative-requirement §10.3 MUST

A client MUST allow a user to override the timing of the AUTH, PBSZ, and PROT commands to suit a specific server. Clients SHOULD NOT insist on sending AUTH as the first command, nor insist on issuing PBSZ/PROT directly after AUTH.

tls

normative-requirement §4.1 SHOULD

A client that wishes to secure an FTP session SHOULD send the AUTH command with the parameter 'TLS'. The client then behaves according to its policies based on the server response and the result of TLS negotiation; a client that receives an AUTH rejection MAY continue the session unprotected.

tls, security

normative-requirement §4.2 MUST

Even though TLS negotiation may provide authentication information, the USER command MUST still be issued by the client. It is a server implementation decision which credentials to accept and what consistency checks to make between the client certificate and the USER parameter.

tls, security

normative-requirement §4.2 MUST

Following an AUTH command, all transfer parameters MUST be reset, including (but not limited to) user identity, default data ports, TYPE, STRU, MODE, and current working directory—almost as if a REIN command was issued.

tls

normative-requirement §7 MUST

For data connections in the standard and firewall-friendly modes, the FTP client MUST be the TLS client and the FTP server MUST be the TLS server, regardless of which side initiates the TCP connection via connect() or accept().

tls, security

normative-requirement §6 MUST

If a server supports the FEAT command, it MUST advertise the AUTH, PBSZ, and PROT commands in the FEAT reply, and the AUTH reply should identify 'TLS' as a valid parameter.

tls

normative-requirement §9 MUST

The initial state of the data connection MUST be 'Clear' (no TLS protection), consistent with the behavior indicated by RFC 2228.

tls, security

normative-requirement §9 MUST

The PBSZ command MUST still be issued before PROT, but MUST have a parameter of '0' to indicate that no buffering is taking place and the data connection should not be encapsulated, as FTP-TLS operates as a streaming protection mechanism.

tls

normative-requirement §9 MUST

The PROT command MUST be preceded by a PBSZ command, and a PBSZ command MUST be preceded by a successful TLS negotiation. Once accepted, data connections MUST use the negotiated PROT security level until another PROT command is accepted, a REIN is issued, or AUTH is re-negotiated.

tls, security

normative-requirement §17 MUST

To request TLS protection in accordance with this document, the client MUST use the AUTH parameter 'TLS'. To maintain backward compatibility, the server SHOULD accept 'TLS-C' as a synonym; these parameters are case-insensitive.

tls

normative-requirement §13 MUST

When the REIN command is processed, the TLS session(s) MUST be cleared and the control and data connections revert to unprotected communications. The reply to REIN MUST be sent in a protected session prior to the session(s) being cleared. A server MUST NOT mandate the use of cached TLS sessions after REIN.

tls

normative-requirement §14 MUST

When TLS is in use, the server SHOULD NOT rely on SIGURG to process input on the control channel during data transfers. The client MUST send all data, including Telnet commands (used for ABOR and STAT), across the TLS session.

tls, tcp

protocol-element §10.2

Reply code '521' ('data connection cannot be opened with this PROT setting') is used when a data transfer command (STOR, RETR, NLST, LIST, STOU, APPE) is rejected due to an incorrect PROT level. Reply code '522' indicates that TLS negotiation on the data connection failed or was unacceptable after the '150' was already issued.

tls

protocol-element §4.2

The AUTH TLS command (parameter 'TLS') initiates TLS negotiation on the FTP control connection. The server responds with '234' to indicate it will honor the request; '334' is incorrect for this exchange as no ADAT command follows.

tls

protocol-element §5

The CCC (Clear Command Channel) command reverts the control connection from TLS back to plaintext. On receipt, the server sends '200', shuts down the TLS session, and continues in plaintext. After CCC, the server MUST NOT accept further PBSZ or PROT commands; all subsequent data transfers use the previously negotiated PROT setting.

tls

protocol-element §9

The PROT command sets the data connection security level. For FTP-TLS only 'C' (Clear: no TLS) and 'P' (Private: TLS with integrity and confidentiality) are used; 'S' (Safe) and 'E' (Confidential) are not applicable because TLS encompasses both.

tls, security

protocol-element §10.2

The server SHOULD check the PROT status only at the data-transfer command (STOR, RETR, NLST, LIST, STOU, APPE) that initiates the connection, not at PORT or PASV time. The server may also insist that the data connection use a previously cached TLS session.

tls

security-consideration §15.2.6

Port stealing remains a problem when client certificates are not used; strong client authentication on the data connection is required to prevent unauthorized connections from retrieving or submitting files. Without any strong authentication (e.g., anonymous DH), port stealing is unmitigated.

tls, security

security-consideration §15.3

The CCC command introduces significant security risks described in RFC 2228. Servers SHOULD refuse to process CCC on sessions without client authentication (TLS client cert or USER/PASS), to prevent anonymous clients from issuing repeated AUTH TLS followed by CCC to exhaust server resources.

tls, security

security-consideration §15.1

The certificate used for server (or client) authentication of data connections SHOULD be the same certificate used for the corresponding control connection. If different certificates are used, an alternative cross-checking mechanism must be provided to bind the identities of the two connections.

tls, security, pkix

security-consideration §15.2.1

TLS bounce attacks are mitigated because the FTP server acts as TLS server in data connections, so only services configured as TLS clients could be targeted—a counter-intuitive configuration. Additionally, mismatched authentication credentials between data and control connections allow servers to detect and drop illegitimate connections.

tls, security

security-consideration §15.1.1

Using anonymous Diffie-Hellman (no server certificate) eliminates server identity authentication and provides little protection against man-in-the-middle attacks. Without client certificates, a malicious client can still hijack a data connection (port stealing).

tls, security, crypto

state-machine §10.1

TLS negotiation failure on the control connection has three possible states: (1) complete failure—connection reverts to unprotected, server issues unprotected '421' or client issues unprotected QUIT; (2) successful negotiation but unacceptable parameters—connection stays protected, issue protected '421' or protected QUIT; (3) failure during handshake—connection is in unknown state, both sides SHOULD simply drop the connection.

tls, security