Skip to main content
MediumEmailOWASP A02:2021CWE-327

How to fix: DKIM selector restricted to the SHA-1 hash algorithm

A DKIM selector record declares h=sha1 and offers no sha256 alternative alongside it. Signatures under that key are restricted to the rsa-sha1 algorithm.

Why it matters

SHA-1 is collision-vulnerable and a DKIM signature covers a hash of the message. RFC 8301 formally deprecated rsa-sha1 for DKIM and tells verifiers to treat such signatures as failing, so conforming receivers discard the signature entirely. That is both a weakness and a deliverability problem: mail signed only with SHA-1 loses DKIM alignment under DMARC.

The h= tag is a restriction rather than a description: it tells verifiers which hash algorithms are acceptable for this key. A selector limited to sha1 usually predates RFC 8301 and has never been rotated. Removing the tag entirely is the normal fix, since the default already permits sha256.

How to fix it

  1. 1Configure the signing service to use rsa-sha256, or ed25519-sha256 where it is supported.
  2. 2Publish a replacement key without the h=sha1 restriction.
  3. 3Rotate to a new selector rather than editing the existing record in place, so mail already in flight still verifies.

Code examples

Generate a replacement key under a new selector

bash
opendkim-genkey -b 2048 -d example.com -s s2026a
# publish s2026a._domainkey.example.com with no h= restriction, then switch the signer

References

Detected automatically by VulnRadar. The check id is email-dkim-sha1-hash, stable across every scan so you can filter or diff on it.

See every email check

Questions

How severe is DKIM selector restricted to the SHA-1 hash algorithm?
VulnRadar rates this medium severity in the email category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id email-dkim-sha1-hash, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does DKIM selector restricted to the SHA-1 hash algorithm map to?
It maps to CWE-327. In the OWASP Top 10 it falls under A02:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for dkim selector restricted to the sha-1 hash algorithm

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

DKIM selector restricted to the SHA-1 hash algorithm | VulnRadar