schedule 19-min read

Can DKIM Be Spoofed? DKIM Replay Attacks Explained

DMARC AI editorial team · Last updated

DKIM signatures cannot be forged without the private key, but signed mail can be replayed. How DKIM replay works and what DMARC does and does not stop.

01

Can DKIM be spoofed?

DKIM cannot be spoofed in the usual sense: nobody can forge a valid DKIM signature for your domain without your private key, unless that key is weak. But a message your domain has genuinely signed can be captured and resent to thousands of new recipients, and it still passes DKIM and DMARC. That is a DKIM replay attack.

DKIM (DomainKeys Identified Mail) is defined in RFC 6376, and the standard names replay itself in Section 8.6, "Replay/Spam Attacks". This guide explains what a DKIM signature really proves, how replay exploits the gap, which signing settings make it worse, what DMARC policy can and cannot stop, and what an MSP (managed service provider) should check across client domains. For DKIM basics, start with the DKIM pillar guide.

02

Key takeaways

  • A DKIM signature cannot be faked without the private key. RFC 8301 sets a 1024-bit RSA minimum, and weak or leaked keys are the exception, not the rule.
  • A valid signature proves that the d= domain signed specific headers and body. It does not prove who the message was meant for, so a signed message can be resent to anyone.
  • DMARC at p=reject does not stop a replay of your own signed mail, because the replayed copy still aligns with your From domain.
  • Signing settings decide how much an attacker can change: avoid l=, oversign From, To and Subject in h=, and use x= expiry where your platform allows it.
  • The realistic route to "spoofed" DKIM mail is a compromised ESP (email service provider) account that signs with the client's domain, not broken cryptography.
03

Can a DKIM signature be forged or faked?

Not in practice, if the key is sound. The b= value is an RSA or Ed25519 signature over a hash of the signed headers and body. Producing one that verifies against the public key in DNS requires the matching private key. Changing any signed byte after signing makes verification fail.

There are three real exceptions, and none of them is forgery of a sound key:

Exception What happens Defence
Weak key A short RSA key may be factored, letting an attacker derive the private key 2048-bit keys; RFC 8301 says verifiers must not accept signatures from RSA keys under 1024 bits
Stolen or leaked key Anyone holding the private key can sign as your domain Key custody, key rotation
Misused signing service An attacker sends through a platform that signs with your domain on their behalf Account security at every ESP, sender inventory

RFC 8301 states that signers "MUST use RSA keys of at least 1024 bits" and "SHOULD use RSA keys of at least 2048 bits". The background on key sizes is in DKIM key length: 1024 vs 2048. RFC 6376 Section 8.3, "Misappropriated Private Key", spells out the second case: a compromised private key means an intruder or malware can send mail signed by the advertised domain.

04

Does DKIM prevent spoofing?

Only partly, and not on its own. DKIM lets a receiver confirm that a domain signed a message. It does not stop an attacker from sending unsigned mail with your address in the From header, and it says nothing about what the receiver should do with that mail. That policy job belongs to DMARC.

Even with DMARC, DKIM protects the author domain, not the recipient list. A spoofer who cannot sign as you is stopped by DMARC enforcement. A spoofer who obtains one genuinely signed message from you is not. Why DKIM alone is not enough covers the policy gap; the rest of this guide covers the replay gap that remains even after DMARC is enforced.

05

What is a DKIM replay attack?

A DKIM replay attack takes a message that a domain has legitimately signed and sends it again, unchanged in its signed parts, to recipients the signer never intended. Every copy verifies, because nothing in the signature is broken. The attacker borrows the signing domain's reputation to get mail delivered.

RFC 6376 describes it in Section 8.6: "a spammer sends a piece of spam through an MTA that signs it," then resends it to many recipients, relying on the signing domain's reputation. The same section notes that "Large Verifiers might be able to detect unusually large volumes of mails with the same signature in a short time period", which is one of the few defences the standard offers.

A typical sequence:

  1. The attacker gets one signed message out of your domain: by signing up for a free trial, triggering a transactional email, or sending through a compromised account on a platform that signs as you.
  2. The message arrives in a mailbox the attacker controls, signed with d=example.com.
  3. The attacker resends the raw message from their own server to a large list, using new SMTP envelope recipients.
  4. Each receiver verifies the signature, finds it valid and aligned with the From domain, and scores the message on example.com's reputation.

Here is the original as the attacker received it (values shortened):

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
 s=esp2026; t=1794993242; h=from:subject:date:message-id;
 bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
 b=Kx9fQm3vT0pLr8sYw2NcHd7aE1bGjU4oZiR6...
From: Example Ltd <billing@example.com>
To: trial-user@example.net
Subject: Your account is ready
Date: Wed, 18 Nov 2026 09:14:02 +0000
Message-ID: <a81f2c@mail.example.com>

And here is how a replayed copy can look at a third-party receiver:

Authentication-Results: mx.example.org;
 dkim=pass header.d=example.com header.s=esp2026;
 spf=pass smtp.mailfrom=bounce.attacker.example;
 dmarc=pass (p=REJECT) header.from=example.com
Received: from relay.attacker.example (relay.attacker.example [198.51.100.77])
 by mx.example.org with ESMTPS; Wed, 18 Nov 2026 13:40:11 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
 s=esp2026; t=1794993242; h=from:subject:date:message-id; ...
From: Example Ltd <billing@example.com>
To: trial-user@example.net
Subject: Your account is ready

SPF passes for the attacker's own envelope domain, which does not align with example.com, so it contributes nothing to DMARC. DKIM passes and aligns, so DMARC passes. The To: header still shows the original recipient, but receivers deliver on the SMTP envelope, not the header, so the copy lands anyway.

06

What does a DKIM signature actually prove?

A valid signature proves that the domain in d= signed the listed headers and the body hash, and that those parts have not changed since. It does not prove that the message was sent to this recipient, that it was sent today, or that it came from the signer's servers. Anything outside the signature is unprotected.

Four gaps matter for replay:

  • No recipient binding. The SMTP envelope (MAIL FROM, RCPT TO) is not signed. A message can be sent with Bcc and carry no evidence of its intended recipient.
  • No sending path binding. DKIM does not check the connecting IP address. That is what lets DKIM survive forwarding, and it is also what lets replay work.
  • d= is the signer, not the author. The d= domain proves who took responsibility. Only DMARC alignment connects it to the visible From address, as explained in what is DKIM and why DMARC depends on it.
  • No freshness by default. The x= expiry tag is optional, and verifiers "MAY" treat expired signatures as invalid, so an old signature can keep verifying for as long as its key is published.

RFC 6376 Section 1.5 sets the limit plainly: verification "asserts that the hashed content has not changed since it was signed" and asserts nothing else.

07

How do unsigned headers make replay worse?

Any header not listed in h= can be added or changed by an attacker without breaking the signature. If Subject or To is unsigned, a replayed copy can carry a new subject line or a convincing recipient address. Even signed headers can be duplicated unless the signer protects against extra instances.

RFC 6376 requires only one header: Section 5.4 says "The From header field MUST be signed". Section 5.4.1 recommends signing the "core" of the message, giving From, Reply-To, Subject, Date, To, Cc, In-Reply-To, References and the List-* fields as examples, and excluding fields that change in transit, such as Received and Return-Path.

The duplication problem is covered in Section 8.15, "Attacks Involving Extra Header Fields": agents should not assume that every instance of a header is signed just because one is. A receiver may display a different instance from the one that was verified.

What is DKIM oversigning?

Oversigning means listing a header name in h= one more time than it appears in the message. RFC 6376 allows signers to claim headers that do not exist, treating the missing instance as a null string. If an attacker then adds a second Subject or From, the signature breaks.

Compare a minimal signature with an oversigned one:

; Minimal: To and Subject can be added or changed freely
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=esp2026;
 h=from:date:message-id; ...

; Oversigned: one extra listing for each core header
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=esp2026;
 h=from:from:to:to:subject:subject:date:date:reply-to:reply-to:
 cc:cc:message-id; ...

Oversigning does not stop a byte-for-byte replay; nothing in the signature can. It stops the attacker from editing the replay: no new subject, no added To, no second From to confuse a mail client. That keeps replayed mail obviously out of context, which limits its value for phishing.

Most mail platforms choose h= themselves. Check what each client platform actually signs by reading real headers rather than trusting documentation.

08

Why is the l= body length tag risky?

The l= tag tells the verifier to hash only the first N octets of the body. Anything appended after that point is unsigned, so an attacker can add their own content, including a new HTML part, and the signature still passes. RFC 6376 warns signers to be "extremely wary" of using it.

Section 8.2, "Misuse of Body Length Limits", states that "Use of the "l=" tag might allow display of fraudulent content without appropriate warning to end users." The appended content can replace what the recipient sees, especially in MIME messages where a mail client renders the last part.

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
 s=esp2026; l=1184; h=from:to:subject:date:message-id; ...

If a client platform's signatures carry l=, ask the vendor whether it can be disabled. It was designed to survive mailing-list footers, and it is rarely worth the risk on mail from a business domain.

09

Do x= expiry and key rotation stop replay?

They narrow the window but do not close it. A short x= expiry makes a captured signature worthless after hours or days, at receivers that honour it. Rotating a key and revoking the old selector kills every signature made with it, legitimate or replayed. Neither prevents a replay that happens quickly.

An expiry 24 hours after signing:

DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=esp2026;
 t=1794993242; x=1795079642; h=from:from:to:to:subject:subject:date; ...

RFC 6376 defines x= as "RECOMMENDED, default is no expiration" and says "Signatures MAY be considered invalid if the verification time at the Verifier is past the expiration date." That "MAY" matters: you cannot rely on every receiver enforcing it. Set the expiry too short and delayed legitimate mail can fail too.

Key rotation has a similar trade-off. Revoking a selector with an empty p= invalidates replays of old mail, but it also fails any genuine mail still in queues. The overlap method in how to rotate DKIM keys safely avoids that. The UK NCSC's DKIM guidance says "DKIM keys do not expire, but you should rotate them periodically (we suggest every 12 months)" and recommends a 2048-bit key. If you suspect a replay campaign or a leaked key, rotate immediately rather than waiting for the schedule.

10

What does DMARC p=reject stop, and what does it not stop?

DMARC at p=reject stops mail that uses your From domain without an aligned SPF or DKIM pass. That covers the classic spoof: an attacker's server sending as billing@example.com with no valid signature. It does not stop mail that genuinely authenticates as your domain, and a replayed message does.

RFC 9989, the DMARCbis standard that obsoletes RFC 7489, says a message produces a DMARC pass "if any DKIM-Authenticated Identifier aligns with the Author Domain." It also states that "A DMARC pass for a message indicates only that the use of the Author Domain has been validated for that message", which is not a statement that the message is safe or wanted.

Attack Stopped by DMARC p=reject? Why
Unsigned mail with your From domain Yes No aligned SPF or DKIM pass
Mail signed with the attacker's own domain, your From Yes d= does not align with the From domain
Replay of a message your domain signed No Signature is valid and aligned
Mail sent through a compromised ESP account that signs as you No Signature is genuine
Lookalike domain (examp1e.com) No Different domain, outside your policy
Display name only ("Example Ltd" from a free mailbox) No RFC 9989 Section 11.4 puts display name attacks out of scope

None of this is a reason to stay at p=none. Enforcement removes the cheapest and most common spoofing route. Replay requires the attacker to obtain your signed mail first, which is harder and leaves traces in aggregate reports.

11

Does strict DKIM alignment help against replay?

Not against a replay of your own mail. With strict alignment (adkim=s), the d= domain must exactly match the From domain. A replayed copy keeps its original d= and From, so it passes under strict alignment just as under relaxed alignment, which RFC 9989 keeps as the default.

Strict alignment helps with a related risk. Under relaxed alignment, any signature from the same Organizational Domain aligns, so a platform signing as news.example.com produces DMARC passes for mail with a From address at example.com. If that marketing platform account is compromised, strict alignment stops it being used to send as the main domain. The trade-offs are in DMARC alignment explained: relaxed vs strict.

_dmarc.example.com.  IN  TXT  "v=DMARC1; p=reject; adkim=s; rua=mailto:dmarc@example.com"

12

What is the realistic cause of "spoofed" DKIM mail?

In practice, a compromised or misused account at a service that signs with the client's domain. Once a marketing platform, CRM or helpdesk has custom-domain DKIM set up, anyone who can log in to that account can send mail that passes DKIM and DMARC as the client. No key theft and no cryptography are involved.

Signup and trial flows are the second source. Any system that sends signed mail to an address the requester controls (welcome emails, password resets, quote confirmations) hands out signed messages that can be replayed. A message with neutral content such as "Your account is ready" is less useful to an attacker than one where user-supplied text, such as a company name field, appears in the signed body.

For MSPs, both risks scale with the number of client platforms. Every ESP that signs as a client domain is a credential that can produce DMARC-passing mail. That makes the sender inventory a security control, not just a deliverability task. DKIM management for MSPs covers the inventory side.

13

How do you spot DKIM replay in aggregate reports?

Look for your client's DKIM domain passing from IP addresses that do not belong to any of its known senders. A replay shows up as DMARC pass rows with an aligned DKIM pass and an unaligned or failing SPF result, often from a hosting provider, with a volume spike that does not match the client's sending pattern.

An illustrative aggregate report record (RFC 9990 format, trimmed):

<record>
  <row>
    <source_ip>198.51.100.77</source_ip>
    <count>4180</count>
    <policy_evaluated>
      <disposition>none</disposition>
      <dkim>pass</dkim>
      <spf>fail</spf>
    </policy_evaluated>
  </row>
  <identifiers><header_from>example.com</header_from></identifiers>
  <auth_results>
    <dkim><domain>example.com</domain><selector>esp2026</selector><result>pass</result></dkim>
    <spf><domain>bounce.attacker.example</domain><result>pass</result></spf>
  </auth_results>
</record>

The selector tells you which platform's key was replayed, which tells you which account to investigate and which key to rotate. A DMARC platform such as DMARC AI processes aggregate reports and uses AI to classify sending sources, so a source signing with a client's key from an unknown network stands out against that client's known senders. The reading of these reports is explained in DMARC aggregate reports explained.

14

How do you check a client's DKIM signing settings?

Send a test message from each platform to a mailbox you control, open the raw source and read the DKIM-Signature header. Check d= (does it sign as the client?), h= (are From, To and Subject signed and oversigned?), l= (absent?) and x= (present?). Then check the key length behind the selector.

Look up the selector from s= and check the key:

dig +short TXT esp2026._domainkey.example.com

To confirm the RSA key size, save the base64 value from p= as key.b64 and run:

( echo "-----BEGIN PUBLIC KEY-----"; fold -w 64 key.b64; echo "-----END PUBLIC KEY-----" ) > key.pem
openssl rsa -pubin -in key.pem -noout -text | head -1

The first line shows Public-Key: (2048 bit) or similar. For a quicker check, the DKIM validator parses the record, and the email header analyzer shows d=, s= and h= from a pasted header. How to read email headers explains the rest of the header block.

15

What is the IETF doing about DKIM replay?

The IETF DKIM working group is developing DKIM2, a successor that aims, among other goals, to make replay detectable. It is still an Internet-Draft, not an RFC, so nothing changes for production mail yet. Plan around RFC 6376 for now and watch the work.

According to the DKIM working group page, the group is active and its charter describes replay as exploiting the "absence of a protected recipient address". The mechanism draft, draft-ietf-dkim-dkim2-spec, was at revision 09 in November 2026, and its abstract says DKIM2 also helps detect replayed messages. The WG motivation draft describes the approach: DKIM2 headers carry timestamps and state both the sender and recipient of each copy. The working group's milestone for submitting its documents to the IESG (Internet Engineering Steering Group) is March 2027. Drafts change, and deployment would follow standardisation, so treat any DKIM2 timeline as provisional.

16

What should an MSP check for each client domain?

Treat DKIM replay as a sender-hygiene problem across the portfolio. The checks below fit onboarding and quarterly reviews, and most take minutes per platform once you have real headers.

Check What good looks like How to verify
Which ESPs sign as the client domain A documented list, one selector per platform Aggregate reports, grouped by DKIM selector
Account security on those ESPs MFA, named users, no shared logins, leavers removed Platform admin consoles
h= on real messages From, To, Subject, Date signed; core headers oversigned Raw headers of a test message
l= tag Absent Raw headers
x= expiry Present where the platform supports it Raw headers
Key length 2048-bit RSA, no rsa-sha1 dig plus openssl, or the DKIM validator
Rotation Scheduled, about every 12 months per NCSC guidance; immediate after suspected abuse Rotation log per selector
Unused selectors Revoked with an empty p= Zone review against the sender list
DMARC policy Moving through p=none, p=quarantine and p=reject DMARC record and aggregate reports
Signed mail to untrusted recipients Signup and trial emails with fixed, low-value content Review of public forms

Record the answers per client. When aggregate reports show a client's selector passing from an unknown network, that record tells you which platform to investigate first.

17

FAQ

Can DKIM be faked by copying the signature?

Copying a signature onto a different message does not work, because the signature covers that message's body hash and signed headers. Change the body or a signed header and verification fails. What does work is copying the whole message, signature included, and resending it. That is replay, and it passes because nothing signed has changed.

Does DMARC stop DKIM replay attacks?

No. A replayed message keeps its original, valid DKIM signature, and that signature aligns with the From domain, so DMARC passes at p=reject. DMARC stops mail that cannot authenticate as your domain. Defences against replay are signing settings, key rotation, ESP account security and receiver-side volume detection.

Is a dkim=pass result proof that an email is safe?

No. It proves the d= domain signed the message and the signed parts are unchanged. A replayed message, a message from a compromised ESP account, or mail from a legitimate but unrelated domain can all show dkim=pass. RFC 9989 says a DMARC pass validates only the use of the Author Domain, not the message itself.

Should I stop using DKIM because of replay?

No. Without DKIM, most third-party senders cannot reach a reliable DMARC pass, and forwarded mail would depend on SPF, which breaks on forwarding. Replay is a reason to tighten signing settings and watch aggregate reports, not to remove DKIM. DKIM plus DMARC enforcement still blocks the far more common unsigned spoof.

18

Final thoughts

DKIM signatures are hard to forge, so attackers rarely try. They reuse genuine signatures instead, through replay or through accounts on platforms that sign as your domain. DMARC enforcement does not see either as spoofing, because both authenticate.

For MSPs, the controls are unglamorous: know every platform that signs as each client, read real headers for h=, l= and x=, keep keys at 2048 bits and rotate them, and watch aggregate reports for a client's selector appearing from networks it does not use. That turns DKIM replay from an invisible risk into something you can detect and contain.

Related articles

Related tools

Ready to Implement?

Get authenticated mail moving in minutes: start free, book a guided demo, or talk to the team about your stack.