[L-5] Crypto nits: serial modulo bias, digit-only stored-serial decimal misread (~5e-7), undocumented OCSP 'good' for expired, SHA-384 responses with P-256 key #35

Closed
opened 2026-11-14 18:28:58 +01:00 by amiryahaya · 0 comments
Owner

Finding

First serial byte uses rem(byte, 0x7F) + 1 (slight modulo bias — residues 0-1 occur 3/256 vs 2/256); an all-digit stored serial is interpreted as decimal (prob ≈5e-7 per cert; primary path re-derives from the cert payload so it's a fallback issue); OCSP answers good for expired records (RFC-permissible but undocumented to relying parties); OCSP signs SHA-384 responses with a P-256 responder key.

Evidence

  • lib/mdid_ws/cert_management/cert_serial_number.ex:18-19, 114-131
  • lib/mdid_ws/cert_management/ocsp_responder.ex:179-183, 210-211

Impact

Negligible individually; worth fixing while touching the modules.

Fix

  • Rejection-sample the first byte instead of rem
  • Hex-prefix or re-derive stored serials
  • Document the expired→good policy; align OCSP hash with key strength

Line numbers refer to the initial import commit 282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).

## Finding First serial byte uses `rem(byte, 0x7F) + 1` (slight modulo bias — residues 0-1 occur 3/256 vs 2/256); an all-digit stored serial is interpreted as decimal (prob ≈5e-7 per cert; primary path re-derives from the cert payload so it's a fallback issue); OCSP answers `good` for expired records (RFC-permissible but undocumented to relying parties); OCSP signs SHA-384 responses with a P-256 responder key. ## Evidence - `lib/mdid_ws/cert_management/cert_serial_number.ex:18-19, 114-131` - `lib/mdid_ws/cert_management/ocsp_responder.ex:179-183, 210-211` ## Impact Negligible individually; worth fixing while touching the modules. ## Fix - [ ] Rejection-sample the first byte instead of rem - [ ] Hex-prefix or re-derive stored serials - [ ] Document the expired→good policy; align OCSP hash with key strength _Line numbers refer to the initial import commit `282cb11`. Source: comprehensive audit, 2026-11-12 (first review of this codebase)._
Sign in to join this conversation.
No description provided.