<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="std" consensus="true" docName="draft-ietf-lamps-cms-update-alg-id-protect-05" indexInclude="true" ipr="trust200902" number="8933" prepTime="2020-10-09T15:16:46" scripts="Common,Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocInclude="true" updates="5652" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-lamps-cms-update-alg-id-protect-05" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc8933" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="CMS Algorithm Identifier Protection">Update to the Cryptographic Message Syntax (CMS) for Algorithm Identifier Protection</title>
    <seriesInfo name="RFC" value="8933" stream="IETF"/>
    <author initials="R." surname="Housley" fullname="Russ Housley">
      <organization abbrev="Vigil Security" showOnFrontPage="true">Vigil Security, LLC</organization>
      <address>
        <postal>
          <street>516 Dranesville Road</street>
          <city>Herndon</city>
          <region>VA</region>
          <code>20170</code>
          <country>United States of America</country>
        </postal>
        <email>housley@vigilsec.com</email>
      </address>
    </author>
    <date month="10" year="2020"/>
    <area>Security</area>
    <workgroup>LAMPS</workgroup>
    <keyword>digitally sign</keyword>
    <keyword>authenticate</keyword>
    <keyword>algorithm identifier integrity</keyword>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">This 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.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t indent="0" pn="section-boilerplate.1-1">
            This is an Internet Standards Track document.
        </t>
        <t indent="0" pn="section-boilerplate.1-2">
            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.
        </t>
        <t indent="0" pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc8933" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t indent="0" pn="section-boilerplate.2-1">
            Copyright (c) 2020 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t indent="0" pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) 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.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
          </li>
          <li pn="section-toc.1-1.2">
            <t indent="0" keepWithNext="true" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-terminology">Terminology</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-required-use-of-the-same-ha">Required Use of the Same Hash Algorithm</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2">
              <li pn="section-toc.1-1.3.2.1">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.3.2.1.1"><xref derivedContent="3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-rfc-5652-section-53">RFC 5652, Section 5.3</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.2">
                <t indent="0" pn="section-toc.1-1.3.2.2.1"><xref derivedContent="3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-rfc-5652-section-54">RFC 5652, Section 5.4</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.3">
                <t indent="0" pn="section-toc.1-1.3.2.3.1"><xref derivedContent="3.3" format="counter" sectionFormat="of" target="section-3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-rfc-5652-section-56">RFC 5652, Section 5.6</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.4">
                <t indent="0" pn="section-toc.1-1.3.2.4.1"><xref derivedContent="3.4" format="counter" sectionFormat="of" target="section-3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-backward-compatibility-cons">Backward Compatibility Considerations</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.5">
                <t indent="0" pn="section-toc.1-1.3.2.5.1"><xref derivedContent="3.5" format="counter" sectionFormat="of" target="section-3.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-timestamp-compatibility-con">Timestamp Compatibility Considerations</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.4">
            <t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-recommended-inclusion-of-th">Recommended Inclusion of the CMSAlgorithmProtection Attribute</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.4.2">
              <li pn="section-toc.1-1.4.2.1">
                <t indent="0" pn="section-toc.1-1.4.2.1.1"><xref derivedContent="4.1" format="counter" sectionFormat="of" target="section-4.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-rfc-5652-section-14">RFC 5652, Section 14</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.5">
            <t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.6">
            <t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.7">
            <t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="7" format="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.7.2">
              <li pn="section-toc.1-1.7.2.1">
                <t indent="0" pn="section-toc.1-1.7.2.1.1"><xref derivedContent="7.1" format="counter" sectionFormat="of" target="section-7.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.7.2.2">
                <t indent="0" pn="section-toc.1-1.7.2.2.1"><xref derivedContent="7.2" format="counter" sectionFormat="of" target="section-7.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.a"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgements">Acknowledgements</xref></t>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-address">Author's Address</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="intro" numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t indent="0" pn="section-1-1">This document updates the Cryptographic Message Syntax (CMS) <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/> to ensure that algorithm identifiers in signed-data and authenticated-data content types are adequately protected.</t>
      <t indent="0" pn="section-1-2">The CMS signed-data content type <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/>, unlike X.509 certificates <xref target="RFC5280" format="default" sectionFormat="of" derivedContent="RFC5280"/>, 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.</t>
      <t indent="0" pn="section-1-3">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 <xref target="SHS" format="default" sectionFormat="of" derivedContent="SHS"/> 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.</t>
      <t indent="0" pn="section-1-4">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 <xref target="SHS" format="default" sectionFormat="of" derivedContent="SHS"/> as the
      digest algorithm and the Elliptic Curve Digital Signature Algorithm (ECDSA)
      with the P-256 curve <xref target="DSS" format="default" sectionFormat="of" derivedContent="DSS"/> as the
      signature algorithm, then the attacker needs to find a collision with
      the first half of the digest.</t>
      <t indent="0" pn="section-1-5">Similar attacks can be mounted against parameterized algorithm
      identifiers.  

When randomized hash functions are employed, such as the example in <xref target="RFC6210" format="default" sectionFormat="of" derivedContent="RFC6210"/>, 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.</t>
      <t indent="0" pn="section-1-6">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 <xref target="RFC6211" format="default" sectionFormat="of" derivedContent="RFC6211"/>.</t>
    </section>
    <section anchor="terms" numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-terminology">Terminology</name>
      <t indent="0" pn="section-2-1">
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP 14 <xref target="RFC2119" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
      </t>
    </section>
    <section anchor="required-use-the-same-hash-algorithm" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-required-use-of-the-same-ha">Required Use of the Same Hash Algorithm</name>
      <t indent="0" pn="section-3-1">This section updates <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/> to require the originator to use the same hash algorithm to compute the digest of the message content and the digest of signed attributes.</t>
      <section anchor="rfc-5652-section-53" numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-rfc-5652-section-53">RFC 5652, Section 5.3</name>
        <t indent="0" pn="section-3.1-1">Change the paragraph describing the digestAlgorithm as follows:</t>
        <t indent="0" pn="section-3.1-2">OLD:</t>
        <blockquote pn="section-3.1-3">
          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 <xref target="RFC5652" sectionFormat="bare" section="5.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-5.4" derivedContent="RFC5652"/>.  The message digest algorithm <bcp14>SHOULD</bcp14> be among those
   listed in the digestAlgorithms field of the associated SignerData.
   Implementations <bcp14>MAY</bcp14> fail to validate signatures that use a digest
   algorithm that is not included in the SignedData digestAlgorithms
   set.</blockquote>
        <t indent="0" pn="section-3.1-4">NEW:</t>
        <blockquote pn="section-3.1-5">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 <xref target="RFC5652" sectionFormat="bare" section="5.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-5.4" derivedContent="RFC5652"/>.  The message digest algorithm <bcp14>SHOULD</bcp14> 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 <bcp14>MUST</bcp14> 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 <bcp14>MAY</bcp14> fail to validate signatures that use a
   digest algorithm that is not included in the SignedData
   digestAlgorithms set.</blockquote>
      </section>
      <section anchor="rfc-5652-section-54" numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-rfc-5652-section-54">RFC 5652, Section 5.4</name>
        <t indent="0" pn="section-3.2-1">Add the following paragraph as the second paragraph in Section <xref target="RFC5652" sectionFormat="bare" section="5.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-5.4" derivedContent="RFC5652"/>.</t>
        <t indent="0" pn="section-3.2-2">ADD:</t>
        <blockquote pn="section-3.2-3">When the signedAttrs field is present, the same digest algorithm
   <bcp14>MUST</bcp14> 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.</blockquote>
      </section>
      <section anchor="rfc-5652-section-56" numbered="true" toc="include" removeInRFC="false" pn="section-3.3">
        <name slugifiedName="name-rfc-5652-section-56">RFC 5652, Section 5.6</name>
        <t indent="0" pn="section-3.3-1">Change the paragraph discussing the signed attributes as follows:</t>
        <t indent="0" pn="section-3.3-2">OLD:</t>
        <blockquote pn="section-3.3-3">The recipient <bcp14>MUST NOT</bcp14> rely on any message digest values computed
   by the originator.  If the SignedData signerInfo includes
   signedAttributes, then the content message digest <bcp14>MUST</bcp14> be
   calculated as described in Section <xref target="RFC5652" sectionFormat="bare" section="5.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-5.4" derivedContent="RFC5652"/>.  For the signature to be
   valid, the message digest value calculated by the recipient <bcp14>MUST</bcp14>
   be the same as the value of the messageDigest attribute included
   in the signedAttributes of the SignedData signerInfo.</blockquote>
        <t indent="0" pn="section-3.3-4">NEW:</t>
        <blockquote pn="section-3.3-5">The recipient <bcp14>MUST NOT</bcp14> rely on any message digest values computed
   by the originator.  If the SignedData signerInfo includes the
   signedAttrs field, then the content message digest <bcp14>MUST</bcp14> be
   calculated as described in Section <xref target="RFC5652" sectionFormat="bare" section="5.4" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-5.4" derivedContent="RFC5652"/> 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
   <bcp14>MUST</bcp14> be the same as the value of the messageDigest attribute
   included in the signedAttrs field of the SignedData signerInfo.</blockquote>
      </section>
      <section anchor="backward-compatibility-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-3.4">
        <name slugifiedName="name-backward-compatibility-cons">Backward Compatibility Considerations</name>
        <t indent="0" pn="section-3.4-1">The 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.</t>
      </section>
      <section anchor="timestamp-compatibility-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-3.5">
        <name slugifiedName="name-timestamp-compatibility-con">Timestamp Compatibility Considerations</name>
        <t indent="0" pn="section-3.5-1">The 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) <xref target="RFC3161" format="default" sectionFormat="of" derivedContent="RFC3161"/>.  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.</t>
        <t indent="0" pn="section-3.5-2">When producing the TimeStampToken, the TSA <bcp14>MUST</bcp14> 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.</t>
        <t indent="0" pn="section-3.5-3">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.</t>
      </section>
    </section>
    <section anchor="recommended-inclusion-of-the-cmsalgorithmprotection-attribute" numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-recommended-inclusion-of-th">Recommended Inclusion of the CMSAlgorithmProtection Attribute</name>
      <t indent="0" pn="section-4-1">This section updates <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/> to recommend that the originator include the CMSAlgorithmProtection attribute <xref target="RFC6211" format="default" sectionFormat="of" derivedContent="RFC6211"/> whenever signed attributes or authenticated attributes are present.</t>
      <section anchor="rfc-5652-section-14" numbered="true" toc="include" removeInRFC="false" pn="section-4.1">
        <name slugifiedName="name-rfc-5652-section-14">RFC 5652, Section 14</name>
        <t indent="0" pn="section-4.1-1">Add the following paragraph as the eighth paragraph in Section <xref target="RFC5652" sectionFormat="bare" section="14" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-14" derivedContent="RFC5652"/>:</t>
        <t indent="0" pn="section-4.1-2">ADD:</t>
        <blockquote pn="section-4.1-3">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
   <bcp14>SHOULD</bcp14> include the CMSAlgorithmProtection attribute <xref target="RFC6211" format="default" sectionFormat="of" derivedContent="RFC6211"/> as
   one of the signed attributes.  Likewise, the originator of an
   authenticated-data content type that includes authenticated
   attributes <bcp14>SHOULD</bcp14> include the CMSAlgorithmProtection attribute
   <xref target="RFC6211" format="default" sectionFormat="of" derivedContent="RFC6211"/> as one of the authenticated attributes.</blockquote>
      </section>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t indent="0" pn="section-5-1">This document has no IANA actions.</t>
    </section>
    <section anchor="security-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-6">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-6-1">The security properties of the CMS <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/> signed-data and
authenticated-data content types are updated to offer protection for
algorithm identifiers, which makes algorithm substitution attacks
significantly more difficult.</t>
      <t indent="0" pn="section-6-2">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.</t>
      <t indent="0" pn="section-6-3">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 <xref target="HASHID" format="default" sectionFormat="of" derivedContent="HASHID"/>, such a "firewall" may not be effective or even
      possible with newer signature algorithms.  For example,
      RSASSA-PKCS1-v1_5 <xref target="RFC8017" format="default" sectionFormat="of" derivedContent="RFC8017"/> protects the
      digest algorithm identifier, but RSASSA-PSS <xref target="RFC8017" format="default" sectionFormat="of" derivedContent="RFC8017"/> 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 <xref target="RFC5280" format="default" sectionFormat="of" derivedContent="RFC5280"/> or some other means.  The Digital
      Signature Standard (DSS) <xref target="DSS" format="default" sectionFormat="of" derivedContent="DSS"/> takes the
      first approach by requiring the use of an "approved" one-way hash
      algorithm.</t>
      <t indent="0" pn="section-6-4">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.</t>
      <t indent="0" pn="section-6-5">The CMSAlgorithmProtection attribute <xref target="RFC6211" format="default" sectionFormat="of" derivedContent="RFC6211"/> 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 <xref target="RFC5083" format="default" sectionFormat="of" derivedContent="RFC5083"/>.  A mechanism for algorithm identifier protection for these content types is work for the future.</t>
    </section>
  </middle>
  <back>
    <references pn="section-7">
      <name slugifiedName="name-references">References</name>
      <references pn="section-7.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="March"/>
            <abstract>
              <t indent="0">In 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.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC3161" target="https://www.rfc-editor.org/info/rfc3161" quoteTitle="true" derivedAnchor="RFC3161">
          <front>
            <title>Internet X.509 Public Key Infrastructure Time-Stamp Protocol (TSP)</title>
            <author initials="C." surname="Adams" fullname="C. Adams">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="P." surname="Cain" fullname="P. Cain">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="D." surname="Pinkas" fullname="D. Pinkas">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Zuccherato" fullname="R. Zuccherato">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2001" month="August"/>
            <abstract>
              <t indent="0">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]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3161"/>
          <seriesInfo name="DOI" value="10.17487/RFC3161"/>
        </reference>
        <reference anchor="RFC5652" target="https://www.rfc-editor.org/info/rfc5652" quoteTitle="true" derivedAnchor="RFC5652">
          <front>
            <title>Cryptographic Message Syntax (CMS)</title>
            <author initials="R." surname="Housley" fullname="R. Housley">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2009" month="September"/>
            <abstract>
              <t indent="0">This document describes the Cryptographic Message Syntax (CMS).  This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="70"/>
          <seriesInfo name="RFC" value="5652"/>
          <seriesInfo name="DOI" value="10.17487/RFC5652"/>
        </reference>
        <reference anchor="RFC6211" target="https://www.rfc-editor.org/info/rfc6211" quoteTitle="true" derivedAnchor="RFC6211">
          <front>
            <title>Cryptographic Message Syntax (CMS) Algorithm Identifier Protection Attribute</title>
            <author initials="J." surname="Schaad" fullname="J. Schaad">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2011" month="April"/>
            <abstract>
              <t indent="0">The 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]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6211"/>
          <seriesInfo name="DOI" value="10.17487/RFC6211"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="May"/>
            <abstract>
              <t indent="0">RFC 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.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
      </references>
      <references pn="section-7.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="DSS" quoteTitle="true" target="https://doi.org/10.6028/NIST.FIPS.186-4" derivedAnchor="DSS">
          <front>
            <title>Digital Signature Standard (DSS)</title>
            <author>
              <organization showOnFrontPage="true">National Institute of Standards and Technology (NIST)</organization>
            </author>
            <date year="2013" month="July"/>
          </front>
          <seriesInfo name="FIPS" value="186-4"/>
          <seriesInfo name="DOI" value="10.6028/NIST.FIPS.186-4"/>
        </reference>
        <reference anchor="HASHID" quoteTitle="true" target="https://doi.org/10.1007/3-540-45760-7_1" derivedAnchor="HASHID">
          <front>
            <title>On Hash Function Firewalls in Signature Schemes</title>
            <author initials="B." surname="Kaliski" fullname="Burton S. Kaliski, Jr.">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2002" month="February"/>
          </front>
          <seriesInfo name="DOI" value="10.1007/3-540-45760-7_1"/>
          <seriesInfo name="Lecture Notes in Computer Science," value="Volume 2271"/>
        </reference>
        <reference anchor="RFC5083" target="https://www.rfc-editor.org/info/rfc5083" quoteTitle="true" derivedAnchor="RFC5083">
          <front>
            <title>Cryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content Type</title>
            <author initials="R." surname="Housley" fullname="R. Housley">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2007" month="November"/>
            <abstract>
              <t indent="0">This 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]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5083"/>
          <seriesInfo name="DOI" value="10.17487/RFC5083"/>
        </reference>
        <reference anchor="RFC5280" target="https://www.rfc-editor.org/info/rfc5280" quoteTitle="true" derivedAnchor="RFC5280">
          <front>
            <title>Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</title>
            <author initials="D." surname="Cooper" fullname="D. Cooper">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Santesson" fullname="S. Santesson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Farrell" fullname="S. Farrell">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="S." surname="Boeyen" fullname="S. Boeyen">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Housley" fullname="R. Housley">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="W." surname="Polk" fullname="W. Polk">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2008" month="May"/>
            <abstract>
              <t indent="0">This 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]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5280"/>
          <seriesInfo name="DOI" value="10.17487/RFC5280"/>
        </reference>
        <reference anchor="RFC6210" target="https://www.rfc-editor.org/info/rfc6210" quoteTitle="true" derivedAnchor="RFC6210">
          <front>
            <title>Experiment: Hash Functions with Parameters in the Cryptographic Message Syntax (CMS) and S/MIME</title>
            <author initials="J." surname="Schaad" fullname="J. Schaad">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2011" month="April"/>
            <abstract>
              <t indent="0">New 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.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6210"/>
          <seriesInfo name="DOI" value="10.17487/RFC6210"/>
        </reference>
        <reference anchor="RFC8017" target="https://www.rfc-editor.org/info/rfc8017" quoteTitle="true" derivedAnchor="RFC8017">
          <front>
            <title>PKCS #1: RSA Cryptography Specifications Version 2.2</title>
            <author initials="K." surname="Moriarty" fullname="K. Moriarty" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="B." surname="Kaliski" fullname="B. Kaliski">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Jonsson" fullname="J. Jonsson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Rusch" fullname="A. Rusch">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2016" month="November"/>
            <abstract>
              <t indent="0">This 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.</t>
              <t indent="0">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.</t>
              <t indent="0">This document also obsoletes RFC 3447.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8017"/>
          <seriesInfo name="DOI" value="10.17487/RFC8017"/>
        </reference>
        <reference anchor="SHS" quoteTitle="true" target="https://doi.org/10.6028/NIST.FIPS.180-4" derivedAnchor="SHS">
          <front>
            <title>Secure Hash Standard (SHS)</title>
            <author>
              <organization showOnFrontPage="true">National Institute of Standards and Technology (NIST)</organization>
            </author>
            <date year="2015" month="August"/>
          </front>
          <seriesInfo name="FIPS" value="180-4"/>
          <seriesInfo name="DOI" value="10.6028/NIST.FIPS.180-4"/>
        </reference>
      </references>
    </references>
    <section anchor="acknowledgements" numbered="false" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-acknowledgements">Acknowledgements</name>
      <t indent="0" pn="section-appendix.a-1">Many thanks to <contact fullname="Jim Schaad"/> and <contact fullname="Peter Gutmann"/>; without knowing it, they motivated me to
      write this document.  Thanks to <contact fullname="Roman Danyliw"/>,
      <contact fullname="Ben Kaduk"/>, and <contact fullname="Peter Yee"/> for
      their careful review and editorial suggestions.</t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-authors-address">Author's Address</name>
      <author initials="R." surname="Housley" fullname="Russ Housley">
        <organization abbrev="Vigil Security" showOnFrontPage="true">Vigil Security, LLC</organization>
        <address>
          <postal>
            <street>516 Dranesville Road</street>
            <city>Herndon</city>
            <region>VA</region>
            <code>20170</code>
            <country>United States of America</country>
          </postal>
          <email>housley@vigilsec.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
