TLS Working Group | M.M. Marlinspike |
Internet-Draft | T.P. Perrin, Ed. |
Intended status: Standards Track | January 07, 2013 |
Expires: July 11, 2013 |
Trust Assertions for Certificate Keys
draft-perrin-tls-tack-02.txt
This document defines a TLS Extension that enables a TLS server to support "pinning" to a self-chosen signing key. A client contacting a pinned host will require the server to present a signature from the signing key over the TLS server's public key.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http:/⁠/⁠datatracker.ietf.org/⁠drafts/⁠current/⁠.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 11, 2013.
Copyright (c) 2013 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http:/⁠/⁠trustee.ietf.org/⁠license-⁠info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Traditionally, a TLS client verifies a TLS server's public key using a certificate chain issued by some public CA. "Pinning" is a way for clients to obtain increased certainty in server public keys. Clients that employ pinning check for some constant "pinned" element of the TLS connection when contacting a particular TLS host.
TACK allows clients to pin to a server-chosen signing key, known as a "TACK signing key" or "TSK", which signs the server's TLS keys. This enables pinning without limiting a site's flexibility to deploy different certificates and TLS keys on different servers or at different times. Since pins are based on TSKs instead of CA keys, trust in CAs is not required. Additionally, a TSK may be used to revoke compromised TLS private keys, and a pair of "overlapping" TSKs may be used to quickly introduce a new TSK if an older one has become compromised or suspect.
If requested, a compliant server will send a TLS Extension containing its "tack". Inside the tack is a TSK public key and signature. Once a client has seen the same (hostname, TSK) pair multiple times, the client will "activate" a pin between the hostname and TSK for a period equal to the length of time the pair has been observed for. This "pin activation" algorithm limits the impact of bad pins resulting from transient network attacks or operator error.
TACK pins are easily shared between clients. For example, a TACK client may scan the internet to discover TACK pins, then publish these pins through some 3rd-party trust infrastructure for other clients to rely upon.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
A server operator using TACK may perform several processes:
A TACK pin associates a hostname and a TSK. Pins are grouped into "pin stores". A client may populate its pin stores by either performing "pin activation" directly, or by querying some other party. For example, a client application may have a store for pin activation as well as a store whose contents are periodically fetched from a server.
Whenever a client performing "pin activation" sees a hostname and TSK combination not represented in the "pin activation" pin store, an inactive pin is created. Every subsequent time the client sees the same pin, the pin is "activated" for a period equal to the timespan between the first time the pin was seen and the most recent time, up to a maximum period of 30 days.
A pin store may contain up to two pins per hostname. This allows for overlapping pins when a server is securely transitioning from one pin to another. If both pins are simultaneously active, then the server must satisfy both of them by presenting a pair of tacks.
In addition to creating and activating pins, a TLS connection can alter client pin stores by publishing new "min_generation" values in a tack. Each pin stores the highest "min_generation" value it has seen from the pinned TSK, and rejects tacks from earlier generations.
A new TLS ExtensionType ("tack") is defined and MAY be included by a TLS client in the ClientHello message defined in [RFC5246].
enum {tack(TBD), (65535)} ExtensionType;
The "extension_data" field of this ClientHello extension SHALL be empty. A TLS server which is not resuming a TLS session MAY respond with an extension of type "tack" in the ServerHello. The "extension_data" field of this ServerHello extension SHALL contain a "TackExtension", as defined below using the TLS presentation language from [RFC5246].
struct { opaque public_key[64]; uint8 min_generation; uint8 generation; uint32 expiration; opaque target_hash[32]; opaque signature[64]; } Tack; /* 166 bytes */ struct { Tack tacks<166...332> /* 1 or 2 tacks */ uint8 activation_flags; } TackExtension; /* 169 or 335 bytes */
A client SHALL have a local store of pins, and MAY have multiple stores. Each pin store consists of a map associating fully qualified DNS hostnames with either one or two sets of the following values:
A hostname along with the above values comprises a "TACK pin". Thus, each store can hold up to two pins for a hostname (however, those two pins MUST reference different public keys). A pin "matches" a tack if they reference the same public key. A pin is "relevant" if its hostname equals the TLS server's hostname.
A TACK client SHALL send the "tack" extension defined previously, and SHALL send the "server_name" extension from [RFC6066]. If not resuming a session, the server MAY respond with a TackExtension. Regardless of whether a TackExtension is returned, the client SHALL perform the following steps prior to using the connection: Section 4.3 for details).
These steps SHALL be performed in order. If there is any error, the client SHALL send a fatal error alert and close the connection, skipping the remaining steps (see
Based on step 2B, each store will report one of three statuses for the connection: "confirmed", "contradicted", or "unpinned". A contradicted connection might indicate a network attack. How the client responds to confirmed or contradicted connections is left to other specifications and client policy (see Section 5.3 for an example). If a client closes a connection due to a contradicting pin, the client SHALL send an "access_denied" alert.
A TLS handshake is "valid" if the following are true. Unless otherwise specified, if any of the following are false a "bad_certificate" fatal error alert SHALL be sent.
A tack is "valid" if:
If a tack has matching pins in the pin store and a generation less than the stored min_generation, then that tack is revoked and the client SHALL send a fatal "certificate_revoked" error alert. If a tack has matching pins and a min_generation greater than the stored min_generation, the stored value SHALL be set to the tack's value.
If there is a relevant active pin without a matching tack, then the connection is "contradicted". If the connection is not contradicted and there is a relevant active pin with a matching tack, then the connection is "confirmed". Otherwise, the connection is "unpinned".
The TLS connection MAY be used to create, delete, and activate pins. This "pin activation algorithm" is optional; a client MAY rely on an external source of pins. If the connection was "contradicted" by the previous processing step, then pin activation is skipped.
end = current + MIN(30 days, current - initial)
The first step is to evaluate each of the (0, 1, or 2) relevant pins:
In sum: (1) deletes unmatched inactive pins, and (2) activates matched pins with active tacks.
The remaining step is to add new inactive pins for any unmatched active tacks. Each new pin uses the server's hostname, the tack's public key and min_generation (unless the store has a higher min_generation for the public key), an "initial time" set to the current time, and an "end time" of zero. (Note that there are always sufficient empty "slots" in the pin store for adding new pins without exceeding two pins per hostname.)
The following tables summarize this behavior from the perspective of a pin. You can follow the lifecycle of a single pin from "New inactive pin" to "Delete pin".
Relevant pin is active:
Pin matches a tack | Tack is active | Result |
---|---|---|
Yes | Yes | Extend activation period |
Yes | No | - |
No | - | (Connection contradicted) |
Relevant pin is inactive:
Pin matches a tack | Tack is active | Result |
---|---|---|
Yes | Yes | Activate pin |
Yes | No | - |
No | - | Delete pin |
Tack doesn't match any relevant pin:
Unmatched tack is active | Result |
---|---|
Yes | New inactive pin |
No | - |
TACK pins are specific to a particular application protocol. In other words, a pin for HTTPS at "example.com" implies nothing about POP3 or SMTP at "example.com".
Some application protocols negotiate TLS as an optional feature (e.g. SMTP using STARTTLS [RFC3207]). If such a server does not negotiate TLS and there are relevant active pins, then the connection is contradicted by the pin. If a client is performing pin activation for a pin store and the server does not negotiate TLS, then any relevant, inactive pins SHALL be deleted. Note that these steps are taken despite the absence of a TLS connection.
A TACK client MAY choose to perform some form of certificate verification in addition to TACK processing. When combining certificate verification and TACK processing, the TACK processing described in Section 4 SHALL be followed, with the exception that TACK processing MAY be terminated early (or skipped) if some fatal certificate error is discovered.
If TACK processing and certificate verification both complete without a fatal error, then client behavior is left to other specifications and client policy. An example client policy would be to allow the connection to proceed only if it passes certificate verification and is not contradicted by a pin.
A "key fingerprint" may be used to represent a TSK public key to users in a form that is easy to compare and transcribe. A key fingerprint consists of the first 25 characters from the base32 encoding of SHA256(public_key), split into 5 groups of 5 characters separated by periods. Base32 encoding is as specified in [RFC4648], except lowercase is used. Examples:
All servers pinned to the same TSK can impersonate each other (see Section 7.1). Think carefully about this risk if using the same TSK for multiple hostnames.
Make backup copies of the TSK private key and keep all copies in secure locations where they can't be compromised.
A TSK private key MUST NOT be used to perform any non-TACK cryptographic operations. For example, using a TSK for email encryption, code-signing, or any other purpose MUST NOT be done.
HTTP cookies [RFC6265] set by a pinned host can be stolen by a network attacker who can forge web and DNS responses so as to cause a client to send the cookies to a phony subdomain of the pinned host. To prevent this, TACK HTTPS servers SHOULD set the "secure" attribute and omit the "domain" attribute on all security-sensitive cookies, such as session cookies. These settings tell the browser that the cookie should only be presented back to the originating host (not its subdomains), and should only be sent over HTTPS (not HTTP) [RFC6265].
A TACK pin store may contain private details of the client's connection history. An attacker may be able to access this information by hacking or stealing the client. Some information about the client's connection history could also be gleaned by observing whether the client accepts or rejects connections to phony TLS servers without correct tacks. To mitigate these risks, a TACK client SHOULD allow the user to edit or clear the pin store.
Aside from possibly rejecting TLS connections, clients SHOULD NOT take any actions which would reveal to a network observer the state of the client's pin store, as this would allow an attacker to know in advance whether a "man-in-the-middle" attack on a particular TLS connection will succeed or be detected.
An attacker may attempt to flood a client with spurious tacks for different hostnames, causing the client to delete old pins to make space for new ones. To defend against this, clients SHOULD NOT delete active pins to make space for new pins. Clients instead SHOULD delete inactive pins. If there are no inactive pins to delete, then the pin store is full and there is no space for new pins. To select an inactive pin for deletion, the client SHOULD delete the pin with the oldest "end time".
If the need arises for tacks using different cryptographic algorithms (e.g., if SHA256 or ECDSA are shown to be weak), a "v2" version of tacks could be defined, requiring assignment of a new TLS Extension number. Tacks as defined in this document would then be known as "v1" tacks.
IANA is requested to add an entry to the existing TLS ExtensionType registry, defined in [RFC5246], for "tack"(TBD) as defined in this document.
Valuable feedback has been provided by Adam Langley, Chris Palmer, Nate Lawson, and Joseph Bonneau.