[ DKIM ]

DKIM body-hash failures: find where the signed message changed

Preserve original message bytes, distinguish body-hash mismatch from other DKIM failures and isolate the first modifying hop.

By the EmailAuth research team · 5 min read

[ Key points ]

  • Keep body-hash mismatch separate from key lookup and signature-verification failures.
  • Compare preserved raw messages at the suspected transformation boundary.
  • Repair the processing route and verify the intended aligned identity on new mail.
On this page

A DKIM body-hash failure means the verifier did not reproduce the body hash carried in the signature, after applying the signature's relevant rules. It does not identify which system changed the message, and it is not the same diagnosis as a missing public key.

Start by preserving the original received message. Copying the visible text from a mail client loses MIME structure, encoding and other bytes that matter to verification.

Confirm the exact failure

Inspect the trusted receiver's result and the signature being assessed. A message can have more than one DKIM signature, and each can have a different signing domain or outcome.

Record d=, s=, the algorithm, the c= canonicalization setting and any l= body-length tag. Keep the exact verification reason. A key lookup timeout, an unsupported algorithm, a header-signature mismatch and a body-hash mismatch call for different investigations.

In RFC 6376 §3.5, the bh= value is the encoded hash of the canonicalized body, subject to the defined length treatment. The b= value belongs to the signature calculation. Treating these as interchangeable obscures which check failed.

Preserve evidence that can reproduce the result

Save the raw message through an approved export path and restrict access according to its content. Keep the received original intact, with a hash and collection time if the investigation process supports them.

Create analysis copies separately. Redacting an address, changing an attachment or saving a reconstructed message may alter material relevant to verification. A safe sharing copy can be useful, but it is not automatically equivalent to the preserved original.

Record the source of any verification output. A tool that normalises line endings on import may not be assessing the same bytes as the receiving server. If two tools disagree, first establish their inputs and supported behaviour.

Compare the message before and after likely modifiers

Map the actual route from the sender through gateways, relays, mailing lists and receiving services. Seek controlled captures immediately before and after a suspected transformation.

Common investigation candidates include a footer inserted after signing, URL rewriting, MIME re-encoding, attachment processing and repairs to malformed content. These are hypotheses until evidence places a relevant change at a hop.

Use a controlled test that follows the same route and exercises the suspected feature. For example, compare an otherwise equivalent message with and without the gateway's footer rule. Do not generalise from a direct test that bypasses the production gateway.

In a synthetic case, the sender's stored output verifies successfully, while the captured message after a disclaimer gateway has a body-hash mismatch. The gateway adds a footer after the sender signs. Under those stated hypothetical observations, that identifies a configuration dependency to address, rather than a reason to replace the DKIM public key.

Understand what canonicalization can tolerate

DKIM’s canonicalization rules permit particular normalisations. They do not make arbitrary content editing safe. Relaxed body canonicalization is not permission to rewrite links or add a paragraph after signing.

Inspect the algorithm specified by the signature and use a verifier that implements it correctly. Do not diagnose from a visually identical rendering: two displayed messages can contain different signed octets.

Under RFC 6376 §3.5, an l= value limits the canonicalized body octets covered by the defined calculation. It is not a general fix for a modifying gateway, and deliberately leaving content outside protection changes the security assessment. Use supported configurations and review the implications rather than adding a length limit to suppress a symptom.

Fix the modifying route, then reassess alignment

Where the organisation controls the route, arrange required modifications before the final appropriate signing stage. If a service re-signs mail, check the new signing identity and what it proves. A passing signature from an unrelated intermediary does not automatically align with the original visible From domain; RFC 9989 §4.4.1 requires the authenticated signing identity to align.

For legitimate indirect routes outside the sender's control, assess the applicable interoperability guidance. Do not disable security processing or weaken a domain policy solely because one test fails.

Repeat the affected business workflow and retain before-and-after evidence. Then use DMARC alignment diagnosis to establish whether a passing aligned path remains. The incident closes when the relevant transformation and its effect are understood and the intended route has been verified.

Choose the next diagnostic step

Use this proposed decision sequence; it records no executed test:

  • No usable key or key-query timeout: follow the lookup result under RFC 6376 §6.1.2 rather than diagnosing a footer.
  • Recomputed body hash differs from bh: compare the body representation, actual c/l settings and recorded bh value under RFC 6376 §6.1.3. A damaged or incorrectly generated bh, or a signer/verifier implementation error, is also a possible cause; the mismatch alone does not prove body modification.
  • Body hash matches but the signature fails: inspect signed headers, the signature calculation and the key-to-signer relationship; matching bh alone is not a DKIM pass.
  • Multiple signatures disagree: keep each result tied to its own d and s before deciding whether a passing aligned path remains.

[ Takeaway ]

Keep body-hash mismatch separate from key lookup and signature-verification failures. Compare preserved raw messages at the suspected transformation boundary. Repair the processing route and verify the intended aligned identity on new mail.

[ By role ]

What this means for you

Choose your role for practical next steps.

IT / Mail Admin

Compare original bytes at route boundaries.

Useful evidence distinguishes the preserved message from reconstructed, redacted or normalised copies.

Next steps

  1. Record each signature and canonicalization setting.
  2. Capture before and after the suspected modifier.
  3. Recheck the final aligned signing path.

CISO / SecOps

Preserve the evidence and its limits.

A mismatch is an integrity observation, not automatic attribution to an attacker or proof that all authentication failed.

Next steps

  1. Restrict raw-message access.
  2. Keep collection and analysis copies distinct.
  3. Review any change to unsigned or re-signed content.

Founder / Non-technical

Find the system that changed the message.

Replacing DNS records will not fix an unrelated content transformation after signing.

Next steps

  1. Ask for the exact failure reason.
  2. Keep the affected business workflow in the test.
  3. Assign an owner to the modifying stage.

[ FAQs ]

Frequently asked questions

Is a DKIM body-hash failure a missing-key problem?

Not the same diagnosis. Keep the exact verifier reason and distinguish body mismatch from key lookup, algorithm and header-signature failures.

RFC 6376 §6.1.2 RFC 6376 §6.1.3

Can I verify DKIM from text copied out of the email window?

Use the original received message. A visible-text copy omits MIME and byte-level details that can affect verification.

RFC 6376 §3.7

What is the difference between bh= and b=?

The bh= value represents the defined canonicalized body hash. The b= value is the signature value used in the separate signature-verification calculation.

RFC 6376 §3.5

Does a body-hash mismatch prove an attacker edited the email?

No. An authorised gateway or intermediary can change signed content too. Trace the route and compare preserved evidence before assigning a cause.

Will relaxed canonicalization tolerate a newly added footer?

Do not assume it will. The rules allow particular normalisations, not arbitrary additions or content rewriting after signing.

RFC 6376 §3.4.4

Should I use l= to make an edited message verify?

A body-length limit changes what the signature protects. Do not use it as a general workaround for a modifying gateway without a supported design and security review.

RFC 6376 §8.2

Does a gateway’s new passing signature restore DMARC automatically?

No. Check whether its signing domain aligns with the visible From domain. An unrelated intermediary signature may verify without providing the required alignment.

RFC 9989 §4.4.1

What evidence demonstrates the fix?

Retain the original failure, the modifying stage, the supported configuration change and a repeat test of the actual business route with trusted verification results.

[ Sources ]

Sources

  1. RFC 6376

    Sections §1 · §3.4 · §3.5 · §3.7 · §6.1.2 · §6.1.3 · §8.2 · §3.4.4

  2. RFC 9989

    Sections §4.4.1

  3. RFC 8601

    Sections §1.2

[ Glossary ]

Glossary

Body hash (bh)
The encoded hash of canonicalized body bytes, limited by l when present.

RFC 6376 §3.5

Signature value (b)
The encoded cryptographic signature value, distinct from the body hash.

RFC 6376 §3.5

Canonicalization
Defined preparation of headers or body before DKIM hashing and verification.

RFC 6376 §3.4

DMARC alignment
The required relationship between an authenticated identifier and the Author Domain.

RFC 9989 §4.4.1

Enterprise provenance

Why top financial institutions and governments retired their email security dashboards.

Traditional email authentication platforms sell you a dashboard and ask your engineers to do the labour. In high-stakes environments, manual oversight means delayed enforcement, configuration drift and unmonitored shadow domains.

EmailAuth is the agentic email provenance platform. Our agents enforce p=reject, keep third-party senders aligned and move your domains to full RFC 9989 compliance, the new DMARC standard,, with human-in-the-loop auditability.

Governments Large enterprises Tier-1 financial institutions

SaaS · Dedicated tenancy · Air-gapped on-prem · BYOK encryption

Knowledge Base