Menu

1 / 2

Signing and replaying DKIM email in the browser with Web Crypto

DEV Community: javascript·Yuuki Yamashita·13 days ago
#1PW5NH2S
#devtojavascript#devto#dev#dkim#const
Reading 0:00
15s threshold

An AWS Security Blog post from November 2, 2026, "Beyond DKIM key rotation: understanding email replay attacks", makes a claim that sounds wrong at first: rotating your DKIM key does not stop an attacker from replaying mail you already signed, and neither does DMARC p=reject.

The argument is simple once you see it. A DKIM signature only says "these bytes haven't changed since I signed them." If an attacker resends your genuine email unchanged, the signature still verifies, DMARC passes on DKIM alone, and p=reject never applies. Only deleting the old public key from DNS makes those captured copies fail.

I wanted something I could click through, so I built a small simulator with Claude Code. This post is about how it works under the hood: signing and verifying DKIM-style signatures with the Web Crypto API, modeling DMARC, and two bugs that testing caught.

The shape of the simulator

It is one HTML file with no dependencies.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.