[M-7] Subject-DN validation is a weak blacklist — no control chars, RTL overrides, length caps, or IC format check #19

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

Finding

@blacklisted_chars misses NUL/control characters, zero-width/RTL override (U+202E name spoofing), backslash, %; no length caps; serialNumber not constrained to a MyKad pattern (validation removed in d69c944).

Evidence

  • lib/mdid_ws/cert_management/subject_validator.ex:7, 44-51

Impact

Name-spoofing via bidi/zero-width characters and malformed subjects in issued certificates.

Fix

  • Per-attribute allowlists (serialNumber ^\d{12}$, CN limited to letters/space/'()-)
  • Printable-characters-only check and max lengths

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

## Finding `@blacklisted_chars` misses NUL/control characters, zero-width/RTL override (U+202E name spoofing), backslash, `%`; no length caps; serialNumber not constrained to a MyKad pattern (validation removed in d69c944). ## Evidence - `lib/mdid_ws/cert_management/subject_validator.ex:7, 44-51` ## Impact Name-spoofing via bidi/zero-width characters and malformed subjects in issued certificates. ## Fix - [ ] Per-attribute allowlists (serialNumber `^\d{12}$`, CN limited to letters/space/'()-) - [ ] Printable-characters-only check and max lengths _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.