Internet-Draft | DKIM Replay Problem | April 2023 |
Chuang, et al. | Expires 3 October 2023 | [Page] |
DomainKeys Identified Mail (DKIM, RFC6376) permits claiming some responsibility for a message by cryptographically associating a domain name with the message. For data covered by the cryptographic signature, this also enables detecting changes made during transit. DKIM survives basic email relaying. In a Replay Attack, a recipient of a DKIM-signed message re-posts the message to other recipients,while retaining the original, validating signature, and thereby leveraging the reputation of the original signer. This document discusses the resulting damage to email delivery, interoperability, and associated mail flows. A significant challenge to mitigating this problem is that it is difficult for receivers to differentiate between legitimate forwarding flows and a DKIM Replay Attack.¶
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 https://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 3 October 2023.¶
Copyright (c) 2023 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 (https://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 Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
DomainKeys Identified Mail (DKIM) permits a person, role, or organization to claim some responsibility for a message by associating a domain name [RFC1034] with the message [RFC5322], which they are authorized to use. This can be an author's organization, an operational relay, or one of their agents. Assertion of responsibility is validated through a cryptographic signature and by querying the Signer's domain directly to retrieve the appropriate public key.¶
The presence of a DKIM signature serves as a basis for developing an assessment of mail received, over time, using that signature. That assessment constitutes a reputation, which then serves to guide future handling of mail arriving with a DKIM signature for that domain name. The presence of a validated DKIM signature was designed to ensure that the developed reputation is the result of activity only by the domain owner, and not by other, independent parties. That is, it defines a 'clean' channel of behavior by the domain owner, with no 'noise' introduced by other actors.¶
A receiving filtering system contains a rich array of rules and heuristics for assessing email, for protecting users against spam, phishing, and other abuses. DKIM therefore provides an identity that this system can use for reputation assessment and prediction of future sender behavior.¶
During development of the DKIM specification, DKIM Replay was identified as only of hypothetical concern. However, that attack has become commonplace:¶
Internet Mail permits sending a message to addresses that are not listed in the content To:, Cc: or Bcc: header fields. Although DKIM covers portions of the message content, and can cover these header fields, it does not cover the envelope addresses, used by the email transport service, for determining handling behaviors. So this message can then be replayed to arbitrary thousands or millions of other recipients, none of whom were specified by the original author.¶
That is, DKIM Replay takes a message with a valid DKIM signature, and distributes it widely to many additional recipients, without breaking the signature.¶
Therefore, DKIM Replay is impossible to detect or prevent with current standards and practices. Simply put, email authentication does not distinguish benign re-posting flows from a DKIM Replay Attack.¶
ARC [RFC8617] is a protocol to securely propagate authentication results seen by Mediators that re-post a message, such as mailing lists. It can be used to adjust DMARC [RFC7489] validation as described in section 7.2.1. Because ARC is heavily based on DKIM it has the same "replay" issue as described in section 9.5.¶
Modern email operation often involves many actors and many different actions. This section attempts to identify those relevant to Replay Attacks.¶
This document is only Informative and omits the normative language defined in [RFC2119]. Mail architectural terminology that is used here is from [RFC5598] and [RFC5321].¶
[RFC5598] defines mail interactions conceptually from three perspectives of activities, divided into three types of roles:¶
This includes end-users, but also Mediators that re-post a message after delivery¶
Moving a message from a single submission to its related delivery¶
Covering independent operational scope, where functions of authorship, handling, and receiving can take place in any number of different ADMDs¶
Also, as noted in [RFC5598], a given implementation might perform multiple roles.¶
It is useful to broadly identify participants in mail handling by functionality as defined in [RFC5598] as:¶
In addition, a user interacts with the handling service via a:¶
The following is a subset of the Mail Handling Services defined in [RFC5598] to be used in this document:¶
defined in Section 2.2.1. This is the first component of the MHS and works on behalf of the author to ensure the message is valid for transport; it then posts it to the relay (MTA) that provides SMTP store-and-forward transfer. The Originator can DKIM sign the message on behalf of the author, although it is also possible that the author's system, or even the first MTA, does DKIM signing.¶
defined in Section 5.1. A type of Mediator user, operating in between a delivery and a following posting. The Alias replaces the original RCPT TO envelope recipient address but does not alter the content address field header fields. Often used for Auto-Forwarding.¶
as defined in Section 5.2, is a type of Mediator user, like an Alias; however the ReSender updates the recipient address, and "splices" the destination header field and possibly other address fields as well.¶
defined in Section 5.3 is another Mediator; it receives a message and reposts it to the list's members; it might add list-specific header fields e.g. List-XYZ: might modify other contents, such as revising the Subject: field, or adding content to the body.¶
defined in Section 2.2.4 is the last stop in the MHS, and works on behalf of the recipient to deliver the message to their inbox; it also might perform filtering.¶
Any of these actors, as well as those below, can add trace and operational header fields.¶
Modern email often includes additional services. Four that are relevant to DKIM Replay are:¶
Often called a Bulk Sender - An originating third-party service, acting as an agent of the author and sending to a list of recipients. They may DKIM sign as themselves and/or sign with the author's domain name.¶
Rather than sending directly to recipients' servers, the Originator can route mail through a Filtering Service, to provide spam or data loss protection services. This service may modify the message and can be administratively separate from the Originator.¶
The Receiver can also route mail through a Filtering Service, to provide spam, malware and other anti-abuse protection services. Typically, this is done by listing the service in an DNS MX record. This service may modify the message and can be administratively separate from the Receiver.¶
The above services can use email authentication as defined in the following specifications:¶
Defined in [RFC6376], with a cryptographic signature that typically survives basic relaying but can be broken when processed by a Mediator. Further, DKIM Replay is defined in RFC6376 section 8.6.¶
Defined in [RFC7208], is another form of message handling authentication that works in parallel to DKIM and might be relevant to the detection of a DKIM Replay Attack.¶
The following section categorizes the different mail flows by a functional description, email authentication and recipient email header fields.¶
In this case, email travels directly from the author's ADMD or the ADMD of their agent -- to the recipient's ADMD or their agent. That is, for origination and reception, any interesting creation or modification is done by agreement with either the author or the recipient. As such, these cases should have authentication that succeeds.¶
In this type of flow, SPF is expected to validate.¶
A DKIM Replay Attack uses a single message, sent through Direct delivery, and repurposes it.¶
This is mail involving a Mediator, producing a sequence of submission/delivery segments. While not required, the Mediator is typically viewed as being in an ADMD that is independent of the author's ADMD and independent of the recipient's ADMD.¶
An ESP is authorized to act on behalf of the author and will originate messages given a message body and a list of recipients, sending a different message to each recipient. Content address fields are typically restricted to just the address of that copy's recipient. The mail that is sent is typically 'direct', but the ESP cannot control whether an address refers to an alias or mailing list, or the like. So, the message might become indirect, before reaching the final recipient.¶
The bulk nature of ESP activity means that it can look the same as DKIM Replay traffic.¶
If the Author's domain has an SPF record that does not list this filtering service, SPF validation for the author's domain will fail. However, the ESP might produce an SPF record of their own and use their own SMTP MAIL FROM (return) address.¶
Typically, an inbound filtering service will add the results of its analysis to the message. It might make other modifications to the message.¶
Indirect mail flows break SPF validation, unless the Mediator is listed in the SPF record. This is almost never the case.¶
The modifications done by a mailing list especially to the Subject: header field and the body of the message - nearly always break any existing DKIM signatures.¶
Typically, the envelope return (MAIL FROM) address is replaced, to be something related to the forwarder. A resender might add trace headers, but typically does not modify the recipients or the message body.¶
A spammer will find a mailbox provider with a high reputation and that signs their message with DKIM. The spammer sends a message with spam content from there to a mailbox the spammer controls. This received message is sometimes updated with additional header fields such as To: and Subject: that do not damage the existing DKIM signature, if those fields were not covered by the DKIM signature. The resulting message is then sent at scale to target recipients. Because the message signature is for a domain name with a high reputation, the message with spam content is more likely to get through to the inbox. This is an example of a spam classification false negative incorrectly assessing spam to not be spam.¶
When large amounts of such spam are sent to a single mailbox provider -- or through a filtering service with access to data across multiple mailbox providers -- the operator's filtering engine will eventually react by dropping the reputation of the original DKIM signer. Benign mail from the signer's domain then starts to go to the spam folder. For the benign mail, this is an example of a spam classification false positive.¶
In both cases, mail that is potentially wanted by the recipient becomes much harder to find, reducing its utility to the recipient (and the author.) In the first case, the wanted mail is mixed with potentially large quantities of spam. In the second case, the wanted mail is put in the spam folder.¶
Legitimate mail might have a valid DKIM signature and no associated SPF record.¶
So might a Replay attack.¶
Example benign indirect flows are outbound and inbound gateway, mailing lists, and forwarders. This legitimate mail might have a valid DKIM signature, and SPF validation that is not aligned with the content From:¶
So might a Replay attack.¶
A message that has been replayed will typically show these characteristics:¶
As can be seen from the above discussion, there is no straightforward way to detect DKIM Replay for an individual message, and possibly nothing completely reliable even in the aggregate. The challenge, then, is to look for passive analysis that might provide a good heuristic, as well as active measures by the author's system to add protections.¶
Here are some potential solutions to the problem, and their pros and cons:¶
Since this information is different in the Replay, than it was in the original sending, locking it into the signature will make validation fail, if the value has been changed.¶
This technique caches known DKIM signatures and counts them. Those above a certain threshold is considered DKIM replay.¶
Distinguish each forwarding hop by its own signature. This permits each forwarding hop to specify the next destination domain which can be verified to detect DKIM replay.¶
This document has no IANA actions yet.¶
Thanks goes to Emanuel Schorsch and Evan Burke for their advice.¶