# DKIM was introduced at a very unlucky time; or, happy 20 years of CVE-2008-0166

96 of Tranco top million domains still publish DKIM keys generated by vulnerable Debian OpenSSL, letting anyone forge validly signed email for them.

- Payout: Research
- Severity: high
- Program: Debian OpenSSL
- Write-up by: robin
- Disclosed: 2026-12-05
- CVE: CVE-2008-0166
- Write-up quality: 6/10
- Original: https://dreamstation.systems/personal/dkimdebian.html
- Library page: https://bugbountylibrary.com/r/blog%3Adreamstation-systems-personal-dkimdebian-html
- Tags: area:oss domain:oss impact:integrity kind:research platform:research sev:high tech:email technique:default-creds technique:recon vuln:crypto

**Target:** DKIM DNS TXT records of top million domains
**Root cause:** Debian's OpenSSL patch reduced RNG entropy to only the PID (32,768 values), so generated DKIM keys come from a tiny enumerable keyspace; DKIM does not require key rotation, so old keys persist.
**Steps:**
1. Scrape DKIM DNS records (TXT selectors) for Tranco top million domains
2. Run each public key through badkeys to detect CVE-2008-0166 weak keys
3. Enumerate the 32,768 possible private keys per architecture/key type and match against the published public key
4. Sign forged email with the recovered private key; DKIM validation passes for the domain
**How found:** Author knew DKIM keys were often generated in 2007 on Debian with OpenSSL, and that DKIM lacks mandatory key rotation; scraped DKIM records for the Tranco top million and ran them through badkeys.
**Exploitation:** Recover the private key by enumerating the 32,768-value keyspace and matching the published DKIM public key, then sign arbitrary forged mail so it validates as authorized for the victim domain.
**Insight:** Old, non-rotated cryptographic material (DKIM selectors, long-lived signing keys) can still be compromised by historical RNG bugs; bulk-scrape published keys and run badkeys to find enumerable ones at scale.

