Update to the Cryptographic Message Syntax (CMS) for Algorithm Identifier ProtectionVigil Security, LLC516 Dranesville RoadHerndonVA20170United States of America[email protected]
Security
LAMPSdigitally signauthenticatealgorithm identifier integrityThis document updates the Cryptographic Message Syntax (CMS) specified in RFC 5652 to ensure that algorithm identifiers in signed-data and authenticated-data content types are adequately protected.Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
.
Copyright Notice
Copyright (c) 2020 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
() 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.
Table of Contents
. Introduction
. Terminology
. Required Use of the Same Hash Algorithm
. RFC 5652, Section 5.3
. RFC 5652, Section 5.4
. RFC 5652, Section 5.6
. Backward Compatibility Considerations
. Timestamp Compatibility Considerations
. Recommended Inclusion of the CMSAlgorithmProtection Attribute
. RFC 5652, Section 14
. IANA Considerations
. Security Considerations
. References
. Normative References
. Informative References
Acknowledgements
Author's Address
IntroductionThis document updates the Cryptographic Message Syntax (CMS) to ensure that algorithm identifiers in signed-data and authenticated-data content types are adequately protected.The CMS signed-data content type , unlike X.509 certificates , can be vulnerable to algorithm substitution attacks. In an algorithm substitution attack, the attacker changes either the algorithm identifier or the parameters associated with the algorithm identifier to change the verification process used by the recipient. The X.509 certificate structure protects the algorithm identifier and the associated parameters by signing them.In an algorithm substitution attack, the attacker looks for a different algorithm that produces the same result as the algorithm used by the originator. As an example, if the signer of a message used SHA-256 as the digest algorithm to hash the message content, then the attacker looks for a weaker hash algorithm that produces a result that is of the same length. The attacker's goal is to find a different message that results in the same hash value, which is called a cross-algorithm collision. Today, there are many hash functions that produce 256-bit results. One of them may be found to be weak in the future.Further, when a digest algorithm produces a larger result than is
needed by a digital signature algorithm, the digest value is reduced to
the size needed by the signature algorithm. This can be done both by
truncation and modulo operations, with the simplest being
straightforward truncation. In this situation, the attacker needs to
find a collision with the reduced digest value. As an example, if the
message signer uses SHA-512 as the
digest algorithm and the Elliptic Curve Digital Signature Algorithm (ECDSA)
with the P-256 curve as the
signature algorithm, then the attacker needs to find a collision with
the first half of the digest.Similar attacks can be mounted against parameterized algorithm
identifiers.
When randomized hash functions are employed, such as the example in , the algorithm identifier parameter includes a random value that can be manipulated by an attacker looking for collisions. Some other algorithm identifiers include complex parameter structures, and each value provides another opportunity for manipulation by an attacker.This document makes two updates to CMS to provide protection for the
algorithm identifier. First, it mandates a convention followed by many
implementations by requiring the originator to use the same hash
algorithm to compute the digest of the message content and the digest of
signed attributes. Second, it recommends that the originator include
the CMSAlgorithmProtection attribute .Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
"MAY", and "OPTIONAL" in this document are to be interpreted as
described in BCP 14
when, and only when, they appear in all capitals, as shown here.
Required Use of the Same Hash AlgorithmThis section updates to require the originator to use the same hash algorithm to compute the digest of the message content and the digest of signed attributes.RFC 5652, Section 5.3Change the paragraph describing the digestAlgorithm as follows:OLD:
digestAlgorithm identifies the message digest algorithm, and any
associated parameters, used by the signer. The message digest is
computed on either the content being signed or the content
together with the signed attributes using the process described in Section . The message digest algorithm SHOULD be among those
listed in the digestAlgorithms field of the associated SignerData.
Implementations MAY fail to validate signatures that use a digest
algorithm that is not included in the SignedData digestAlgorithms
set.
NEW:
digestAlgorithm identifies the message digest algorithm, and any
associated parameters, used by the signer. The message digest is
computed on either the content being signed or the content
together with the signedAttrs using the process described in Section . The message digest algorithm SHOULD be among those
listed in the digestAlgorithms field of the associated SignerData.
If the signedAttrs field is present in the SignerInfo, then the same
digest algorithm MUST be used to compute both the digest of the
SignedData encapContentInfo eContent, which is carried in the
message-digest attribute, and the digest of the DER-encoded
signedAttrs, which is passed to the signature algorithm.
Implementations MAY fail to validate signatures that use a
digest algorithm that is not included in the SignedData
digestAlgorithms set.
RFC 5652, Section 5.4Add the following paragraph as the second paragraph in Section .ADD:
When the signedAttrs field is present, the same digest algorithm
MUST be used to compute the digest of the encapContentInfo
eContent OCTET STRING, which is carried in the message-digest
attribute and the digest of the collection of attributes that
are signed.
RFC 5652, Section 5.6Change the paragraph discussing the signed attributes as follows:OLD:
The recipient MUST NOT rely on any message digest values computed
by the originator. If the SignedData signerInfo includes
signedAttributes, then the content message digest MUST be
calculated as described in Section . For the signature to be
valid, the message digest value calculated by the recipient MUST
be the same as the value of the messageDigest attribute included
in the signedAttributes of the SignedData signerInfo.
NEW:
The recipient MUST NOT rely on any message digest values computed
by the originator. If the SignedData signerInfo includes the
signedAttrs field, then the content message digest MUST be
calculated as described in Section using the same digest
algorithm to compute the digest of the encapContentInfo eContent
OCTET STRING and the message-digest attribute. For the signature
to be valid, the message digest value calculated by the recipient
MUST be the same as the value of the messageDigest attribute
included in the signedAttrs field of the SignedData signerInfo.
Backward Compatibility ConsiderationsThe new requirement introduced above might lead to incompatibility with an implementation that allowed different digest algorithms to be used to compute the digest of the message content and the digest of signed attributes. The signatures produced by such an implementation when two different digest algorithms are used will be considered invalid by an implementation that follows this specification. However, most, if not all, implementations already require the originator to use the same digest algorithm for both operations.Timestamp Compatibility ConsiderationsThe new requirement introduced above might lead to compatibility
issues for timestamping systems when the originator does not wish to
share the message content with the Time Stamping Authority (TSA) . In this situation, the
originator sends a TimeStampReq to the TSA that includes a
MessageImprint, which consists of a digest algorithm identifier and a
digest value. The TSA then uses the originator-provided digest in the MessageImprint.When producing the TimeStampToken, the TSA MUST use the same digest algorithm to compute the digest of the encapContentInfo eContent, which is an OCTET STRING that contains the TSTInfo, and the message-digest attribute within the SignerInfo.To ensure that TimeStampToken values that were generated before this update remain valid, no requirement is placed on a TSA to ensure that the digest algorithm for the TimeStampToken matches the digest algorithm for the MessageImprint embedded within the TSTInfo.Recommended Inclusion of the CMSAlgorithmProtection AttributeThis section updates to recommend that the originator include the CMSAlgorithmProtection attribute whenever signed attributes or authenticated attributes are present.RFC 5652, Section 14Add the following paragraph as the eighth paragraph in Section :ADD:
While there are no known algorithm substitution attacks today,
the inclusion of the algorithm identifiers used by the originator
as a signed attribute or an authenticated attribute makes such an
attack significantly more difficult. Therefore, the originator
of a signed-data content type that includes signed attributes
SHOULD include the CMSAlgorithmProtection attribute as
one of the signed attributes. Likewise, the originator of an
authenticated-data content type that includes authenticated
attributes SHOULD include the CMSAlgorithmProtection attribute
as one of the authenticated attributes.
IANA ConsiderationsThis document has no IANA actions.Security ConsiderationsThe security properties of the CMS signed-data and
authenticated-data content types are updated to offer protection for
algorithm identifiers, which makes algorithm substitution attacks
significantly more difficult.For the signed-data content type, the improvements specified in this
document force an attacker to mount a hash algorithm substitution attack
on the overall signature, not just on the message digest of the
encapContentInfo eContent.Some digital signature algorithms have prevented hash function
substitutions by including a digest algorithm identifier as an input to
the signature algorithm. As discussed in , such a "firewall" may not be effective or even
possible with newer signature algorithms. For example,
RSASSA-PKCS1-v1_5 protects the
digest algorithm identifier, but RSASSA-PSS does not. Therefore, it remains important that a
signer have a way to signal to a recipient which digest algorithms are
allowed to be used in conjunction with the verification of an overall
signature. This signaling can be done as part of the specification of
the signature algorithm in an X.509v3 certificate extension or some other means. The Digital
Signature Standard (DSS) takes the
first approach by requiring the use of an "approved" one-way hash
algorithm.For the authenticated-data content type, the improvements specified in
this document force an attacker to mount a MAC algorithm substitution
attack, which is difficult because the attacker does not know the
authentication key.The CMSAlgorithmProtection attribute offers protection for the algorithm identifiers used in the signed-data and authenticated-data content types. However, no protection is provided for the algorithm identifiers in the enveloped-data, digested-data, or encrypted-data content types. Likewise, the CMSAlgorithmProtection attribute provides no protection for the algorithm identifiers used in the authenticated-enveloped-data content type defined in . A mechanism for algorithm identifier protection for these content types is work for the future.ReferencesNormative ReferencesKey words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Internet X.509 Public Key Infrastructure Time-Stamp Protocol (TSP)This document describes the format of a request sent to a Time Stamping Authority (TSA) and of the response that is returned. It also establishes several security-relevant requirements for TSA operation, with regards to processing requests to generate responses. [STANDARDS-TRACK]Cryptographic Message Syntax (CMS)This document describes the Cryptographic Message Syntax (CMS). This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. [STANDARDS-TRACK]Cryptographic Message Syntax (CMS) Algorithm Identifier Protection AttributeThe Cryptographic Message Syntax (CMS), unlike X.509/PKIX certificates, is vulnerable to algorithm substitution attacks. In an algorithm substitution attack, the attacker changes either the algorithm being used or the parameters of the algorithm in order to change the result of a signature verification process. In X.509 certificates, the signature algorithm is protected because it is duplicated in the TBSCertificate.signature field with the proviso that the validator is to compare both fields as part of the signature validation process. This document defines a new attribute that contains a copy of the relevant algorithm identifiers so that they are protected by the signature or authentication process. [STANDARDS-TRACK]Ambiguity of Uppercase vs Lowercase in RFC 2119 Key WordsRFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.Informative ReferencesDigital Signature Standard (DSS)National Institute of Standards and Technology (NIST)On Hash Function Firewalls in Signature SchemesCryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content TypeThis document describes an additional content type for the Cryptographic Message Syntax (CMS). The authenticated-enveloped-data content type is intended for use with authenticated encryption modes. All of the various key management techniques that are supported in the CMS enveloped-data content type are also supported by the CMS authenticated-enveloped-data content type. [STANDARDS-TRACK]Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) ProfileThis memo profiles the X.509 v3 certificate and X.509 v2 certificate revocation list (CRL) for use in the Internet. An overview of this approach and model is provided as an introduction. The X.509 v3 certificate format is described in detail, with additional information regarding the format and semantics of Internet name forms. Standard certificate extensions are described and two Internet-specific extensions are defined. A set of required certificate extensions is specified. The X.509 v2 CRL format is described in detail along with standard and Internet-specific extensions. An algorithm for X.509 certification path validation is described. An ASN.1 module and examples are provided in the appendices. [STANDARDS-TRACK]Experiment: Hash Functions with Parameters in the Cryptographic Message Syntax (CMS) and S/MIMENew hash algorithms are being developed that may include parameters. Cryptographic Message Syntax (CMS) has not currently defined any hash algorithms with parameters, but anecdotal evidence suggests that defining one could cause major problems. This document defines just such an algorithm and describes how to use it so that experiments can be run to find out how bad including hash parameters will be. This document defines an Experimental Protocol for the Internet community.PKCS #1: RSA Cryptography Specifications Version 2.2This document provides recommendations for the implementation of public-key cryptography based on the RSA algorithm, covering cryptographic primitives, encryption schemes, signature schemes with appendix, and ASN.1 syntax for representing keys and for identifying the schemes.This document represents a republication of PKCS #1 v2.2 from RSA Laboratories' Public-Key Cryptography Standards (PKCS) series. By publishing this RFC, change control is transferred to the IETF.This document also obsoletes RFC 3447.Secure Hash Standard (SHS)National Institute of Standards and Technology (NIST)AcknowledgementsMany thanks to and ; without knowing it, they motivated me to
write this document. Thanks to ,
, and for
their careful review and editorial suggestions.Author's AddressVigil Security, LLC516 Dranesville RoadHerndonVA20170United States of America[email protected]