As Andrew Ayer pointed out in
https://github.com/FiloSottile/sunlight/issues/35, there is still space to mitigate misconfiguration risk by rejecting seeds that aren't exactly 32 bytes long, and by implementing seed generation functionality in sunlight-keygen. Those changes are planned as part of a set of usability improvements for v1.0.0.
Hi Filippo,
I discovered a critical security vulnerability in Sunlight's key generation that allows predictable private keys for CT logs.
Both sunlight-keygen and sunlight accept weak/empty seed files without validation, using them to derive deterministic keys. This allows attackers to recreate private keys and impersonate CT logs.
I accidentally found this while benchmarking - I used 'echo " " > seed' to quickly create a seed file, and Sunlight accepted it without warnings.
Details:
- cmd/sunlight-keygen/keygen.go:29 - No validation at all
- cmd/sunlight/main.go:447-453, 608-614 - Only checks length >=32 bytes, not entropy
- No user warnings about seed quality requirements
- Code comments mentions /dev/urandom but doesn't emphasize criticality
Impact:
- Predictable CT log private keys
- Potential impersonation of production CT logs
- Undermines web PKI trust
Recommendation:
Derive keys from app-generated cryptographically secure random seeds instead of user-provided files.
I've already requested a CVE ID for this issue from MITRE. I wanted to inform you directly so we can coordinate on the fix and disclosure timeline. Happy to provide more details or discuss remediation.
Best,
Pierre