DKIM proves that a message was signed by a domain and that the signed parts were not changed afterwards. It does not prove that the message was sent only once, to the intended person, at the intended time. That gap is the basis of the DKIM replay attack. An abuser obtains one genuinely signed message, for example by signing up to a service that sends a welcome email or by sending a message through a legitimate provider, and then resends the identical message to a large number of recipients through their own infrastructure. Every copy carries a valid signature from a reputable domain, so authentication passes and filters may be more lenient. The abuser borrows your reputation without ever breaking your cryptography. This guide explains how replay works, what makes a message replayable, what senders can do to reduce exposure, what receivers do, and how to notice replay of your own mail. It builds on which headers to sign, spoofing and reputation recovery.
How the attack works
- The abuser triggers a legitimate service to send a message to an address they control. Common sources are signup confirmations, invitations, share notifications, ticket receipts and "tell a friend" features where the abuser can influence the content.
- The message arrives with a valid DKIM signature, for example
d=service.example, covering From, Subject, Date, Message-ID and the body. - The abuser edits nothing that the signature covers. The visible From, Subject and body stay exactly as signed.
- They replay it: connect to many mail servers and submit the identical bytes, using a different SMTP envelope sender and different envelope recipients. The To header may still show the original address, which is allowed, since many legitimate messages (lists, Bcc) have To headers that differ from the envelope.
- Receivers verify the DKIM signature, see a pass for a well-regarded domain and may treat the message more favourably. Complaints and blocks then accrue to the signing domain.
Because the abuser controls the content of the original message, the replayed email often contains a link or text that the service allowed the abuser to inject, such as a custom message, a name field or an invitation note. Replay therefore often combines two weaknesses: an abusable feature on the sender side and the absence of recipient binding in DKIM.
What makes a message replayable
| Factor | Effect on replay risk |
|---|---|
| User-controlled content in the message (names, notes, subjects, links) | High: the abuser can plant the spam payload in a signed message |
| No expiry in the signature (no x= tag) | High: the signature stays valid for years |
| Unsigned To header | The abuser can freely change visible recipients; signing To helps with display but not with the envelope |
| Missing rate limits on features that send to arbitrary addresses | High: the abuser can generate many signed samples |
| Unsigned or weakly signed Date and Message-ID | Easier to modify without breaking the signature |
| Wide reputation of the signing domain | More valuable to abusers; a major provider's signature is a prize |
| Content that reads as promotional or deceptive | Raises complaints once replayed |
What senders can do
- Set a signature expiry. The
x=tag defines when the signature expires. A short lifetime (days rather than months) limits the window in which a captured message can be replayed. Do not make it so short that legitimate delayed delivery fails; retries can take several days. See retry schedules. - Sign the Date, To and Message-ID headers and oversign From, Subject and To, so that edits and header additions break the signature.
- Remove user-controlled free text from transactional templates where possible, or sanitise and limit it: length caps, no URLs, no HTML, and a prefix such as "Message from a user:".
- Rate limit and verify the features that send mail on behalf of users. Invitation, referral, share and contact-form features need per-user and per-IP limits, captcha or proof of account age and checks that the target address is not on suppression lists. See bot protection and header injection.
- Include the recipient in a visible way. A body that names the intended recipient (for example "Hello Alice, this was sent to [email protected]") makes a replay to thousands of strangers look odd to filters and humans.
- Use separate signing domains or selectors for high-risk features. If invitations are abused, you can rotate that selector without disturbing your main mail. See key rotation.
- Monitor your reputation and DMARC reports for sudden complaint spikes or for mail that passes DKIM from unexpected IP addresses. See authentication results.
What receivers do
Large receivers treat DKIM as one signal among many and do not simply trust a pass. Typical counter-measures include detecting many identical messages (same signature, same body hash) arriving from unrelated IP addresses, comparing the sending IP with the IP ranges they usually see for the signing domain, treating unexpected volume from a signed domain as suspicious even if it passes, and reducing trust for domains whose signed messages are frequently replayed. Receivers may also use the envelope-versus-header mismatch: a message whose To header names a different person than the envelope recipient and whose sending IP is unknown for the domain is a common replay signature.
Detecting replay of your own mail
| Signal | Where to look |
|---|---|
| Complaints about messages you did not send | Feedback loops and customer reports. See feedback loops |
| DMARC aggregate reports with DKIM pass from IPs you do not own | Report tools and the source IP columns. Remember that SPF will usually fail for such mail, while DKIM passes |
| Identical Message-ID or body hash in many external complaints | Samples forwarded by recipients or abuse desks |
| Strange text inside otherwise normal notification templates | Review templates and any variable that carries user input |
| Spikes in a feature that sends to arbitrary addresses | Application logs, rate-limit counters, outbound message counts by feature |
| Postmaster dashboards showing a falling domain reputation without sending changes | Provider dashboards |
Response plan
- Identify the abused feature from the content of the complaint samples.
- Disable or tighten the feature immediately: stricter limits, captcha, sanitised content or temporary shutdown.
- Rotate the DKIM selector used by that stream, publish the new key and retire the old one after queued mail is delivered. Messages signed with the old key become unverifiable, which ends the replay of previously captured samples.
- Add or shorten the
x=expiry on future signatures. - Notify affected providers if you have a contact and publish the incident in your own monitoring.
- Review the templates of every notification for user-controlled text.
- Track complaint rates and reputation for two weeks, and document lessons in your runbook.
Limits of the defences
No setting fully prevents replay while keeping DKIM useful: a signature must be verifiable by anyone, so anyone who holds the message can try to resend it. Expiry narrows the window, content control reduces the value, rate limits reduce the supply of samples and monitoring shortens the response time. Together they make replay unattractive. Beyond DKIM, DMARC alignment does not help here, because the replayed mail carries the genuine aligned signature; neither does SPF, which the abuser simply does not rely on. That is why the practical controls are at the application level and in monitoring.
Treat replay as a reminder that authentication proves origin, not intent. Keep the features that send on behalf of users tightly controlled, sign sensibly with short lifetimes and watch your reports, and your signature will remain an asset instead of a tool for others.
Review your authentication Check DKIM, SPF and DMARC for your sending domains.
References and further reading
Frequently asked questions
What is a DKIM replay attack?
Resending a genuinely signed message to many recipients so that it passes DKIM and borrows the signer's reputation.
Why does a replayed message still pass DKIM?
The signature covers headers and body, not the SMTP envelope or recipient list, so the unchanged message still verifies.
How does the x= tag help?
It sets a signature expiry, limiting how long a captured message can be replayed.
What features are most at risk?
Invitations, referrals, shares, forms and notifications that include user-controlled text and can send to arbitrary addresses.
How do I stop an active replay?
Disable or tighten the abused feature, rotate the selector used for that stream and shorten signature lifetimes.