rfc-6211

Cryptographic Message Syntax (CMS) Algorithm Identifier Protection Attribute

J. Schaad
date2011-04 streamIETF wgnon working group statusPROPOSED STANDARD pages11 canonicalhttps://www.rfc-editor.org/rfc/rfc6211 doi10.17487/RFC6211
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]

Extracted elements (19)

design-rationale §1

CMS SignerInfo is vulnerable to algorithm substitution attacks because the digestAlgorithm and signatureAlgorithm fields are only implicitly protected rather than explicitly covered by the signature. X.509 certificates avoid this by duplicating the signature algorithm in TBSCertificate.signature, requiring validators to compare both; CMS had no equivalent mechanism before this document.

crypto, security

design-rationale §1

Countersigning does not protect against algorithm substitution attacks because countersignatures sign only the signature value itself, while algorithm substitution attacks change the algorithm identifiers while leaving the signature bytes unchanged.

crypto, security

design-rationale §1

RSA PKCS #1 v1.5 signatures encode the hash algorithm internally, making them inherently resistant to algorithm substitution. DSA was historically tied to SHA-1 by design. However, RSA-PSS and new multi-algorithm environments break these implicit protections, motivating an explicit attribute.

crypto, security

design-rationale §1

The digestAlgorithm field in CMS SignerInfo was historically given implicit protection by the convention that only one digest algorithm existed per hash value length and that the same digest algorithm was used for both content and signature digest. The anticipated arrival of SHA-3 variants producing identical-length outputs would break this implicit protection, motivating an explicit attribute.

crypto, security

interoperability-note §3

For algorithms such as SHA-1, the NULL parameter may be included in the ASN.1 encoding by some implementations and omitted by others (see RFC 3370 Section 2.1 and RFC 4056 for conflicting conventions). Implementers must decide how to handle this corner case when comparing algorithm identifiers for equality.

crypto, security

normative-requirement §2 MUST

An algorithm protection attribute MUST have exactly one attribute value; zero or multiple instances of AttributeValue MUST NOT be present, even though the syntax is defined as SET OF AttributeValue.

crypto, security

normative-requirement §2 SHALL

Exactly one of signatureAlgorithm or macAlgorithm SHALL be present in the CMSAlgorithmProtection attribute; both being absent or both being present is not allowed.

crypto, security

normative-requirement §3.2 MUST

For Authenticated Data validation, a supporting CMS validator MUST compare AuthenticatedData.macAlgorithm to the macAlgorithm field in the attribute; if they differ (modulo encoding), authentication MUST fail.

crypto, security

normative-requirement §3.1 MUST

For Signed Data validation, a supporting CMS validator MUST compare SignerInfo.signatureAlgorithm to the signatureAlgorithm field in the attribute; if they differ (modulo encoding), signature validation MUST fail.

crypto, security

normative-requirement §3.1 MUST

For Signed Data validation, if a CMS validator supports this attribute, it MUST compare SignerInfo.digestAlgorithm to the digestAlgorithm field in the attribute; if they differ (modulo encoding), signature validation MUST fail.

crypto, security

normative-requirement §2 MUST

SignedAttributes in a SignerInfo MUST include only one instance of the algorithm protection attribute; similarly, AuthAttributes in AuthenticatedData MUST include only one instance.

crypto, security

normative-requirement §2 MUST

The algorithm protection attribute MUST be placed as a signed attribute or an authenticated attribute. It MUST NOT be placed as an unsigned attribute, unauthenticated attribute, or unprotected attribute, as it provides no security in those locations.

crypto, security

normative-requirement §3 MUST

When comparing algorithm identifiers during verification, a field with a default value MUST compare as identical regardless of whether the value is defaulted or explicitly provided; a binary byte comparison of encodings is insufficient for this purpose.

crypto, security

protocol-element §2

The CMSAlgorithmProtection attribute (OID id-aa-CMSAlgorithmProtection = 1.2.840.113549.1.9.52) is a new signed or authenticated CMS attribute that carries copies of the digestAlgorithm and either the signatureAlgorithm or macAlgorithm identifiers so they are cryptographically protected.

crypto, security

protocol-element §2

The digestAlgorithm field of CMSAlgorithmProtection carries a copy of SignerInfo.digestAlgorithm or AuthenticatedData.digestAlgorithm including all parameters; the signatureAlgorithm field is populated only when the attribute appears in SignerInfo.signedAttrs; the macAlgorithm field is populated only when in AuthenticatedData.authAttrs.

crypto, security

registry §4

All identifiers defined by this document are assigned out of the S/MIME OID arc. The OID id-aa-CMSAlgorithmProtection (1.2.840.113549.1.9.52) is registered therein; no new IANA registry is created.

registry, crypto

security-consideration §5

The CMSAlgorithmProtection attribute provides no additional security if placed in an unsigned or unauthenticated location; it must be placed where it is covered by the signature or message authentication code to be effective.

crypto, security

security-consideration §5

This document addresses algorithm substitution attacks on CMS, where an attacker changes the algorithm identifier or its parameters to alter signature or authentication verification results. While no known exploitation method exists at publication time, a successful attack could substitute a weaker algorithm or modify parameters (e.g., initial values for parameterized hash functions).

crypto, security

wire-format §2

CMSAlgorithmProtection is an ASN.1 SEQUENCE containing: digestAlgorithm (DigestAlgorithmIdentifier), signatureAlgorithm [1] OPTIONAL (SignatureAlgorithmIdentifier), and macAlgorithm [2] OPTIONAL (MessageAuthenticationCodeAlgorithm). A WITH COMPONENTS constraint enforces that exactly one of signatureAlgorithm or macAlgorithm is present.

crypto, security