Files
proxmark3/tools
Paul KilarandClaude Opus 5 aadcda0cb8 ePassport: stop a long document number leaking into optional data
ICAO spills a document number longer than nine characters into the
optional-data field: positions 1 to 9 hold the first nine, position 10 a
filler in place of the check digit, and the optional field opens with the
rest of the number and the check digit for the whole of it.

_extended_document_number() already puts that back together and returns
the optional field with the overflow removed.  _parse_td3() bound that
fourth value and then ignored it, re-slicing l2[28:42] raw, so the tail of
the document number stayed in the optional field.  From there it was
reported as the holder's personal number, which falls back to the MRZ
optional-data field when DG11 carries none - a 12-character number showed
its last three digits and a check digit as a personal number.

Use the value the function already returns.  The check digit still answers
for the field as transmitted, overflow included, since that is what the
MRZ actually carries.

_parse_td1() has always used the return value, which is where the intended
shape comes from.  _parse_td2() does not call the helper at all, so TD2
carries no support for long numbers; that is a gap rather than this bug and
is left alone.

Found while checking the decoder against ICAO 9303 Part 4.  Nothing else
came out of that: the composite check digit covers lower-line positions
1-10, 14-20 and 22-43 as the spec requires, verified by mutating all 43 and
confirming that nationality and sex are ignored and every other position is
caught; the 7-3-1 digits agree with an independent implementation across
four real TD3 documents.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-01 14:35:26 -04:00
..
2023-05-27 17:00:28 +02:00
2026-08-19 19:28:17 +02:00
2026-07-15 16:39:15 +02:00
2026-06-07 23:01:20 +02:00
2025-04-29 11:33:22 -04:00
2026-08-29 17:15:52 +02:00
2024-01-07 18:05:48 +01:00
…
2023-10-15 10:11:27 +02:00
2026-08-28 01:16:30 +02:00
2024-09-13 13:44:16 +02:00
2026-03-23 22:36:47 +01:00