lf t55xx detect: do not send a password the PWD bit has not confirmed

`lf t55xx detect -p <pwd>` reached for the password whenever detection
failed without one, and sent it across every downlink mode and again
after a wake. On a tag that is not password protected those frames can
be taken for a write: the PWD bit gets set and the tag's data is
destroyed, leaving it locked behind whatever block 7 already held.

`lf t55xx read` and `lf t55xx dump` already guard against this. They
verify the PWD bit in the configuration block before using a password,
and expose -o/--override to bypass the check deliberately. detect had
neither, and T55xxReadBlockEx() treats a live `detect -p` as proof the
bit is set.

detect cannot run the same check -- reading the configuration is what it
is for, and the password is only reached for once that has failed -- so
the risk has to be the user's to accept. Gate it behind -o/--override to
match read and dump, and carry read's warning banner into the help.

No change in behaviour for anyone not passing -p.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Matthew CarrollandClaude Opus 5 committed 2026-10-01 16:13:49 -07:00
1 parent 256f30f0fa
commit 8917c48cde
3 files changed
+30 -13

No files matched your search

+4 -3
View File
@@ -14594,24 +14594,25 @@
},
"lf t55xx detect": {
"command": "lf t55xx detect",
"description": "Try detecting the tag modulation from reading the configuration block",
"description": "Try detecting the tag modulation from reading the configuration block. * * * WARNING * * * Use of detect with password on a tag not configured for a password can damage the tag * * * * * * * * * *",
"notes": [
"lf t55xx detect",
"lf t55xx detect -1",
"lf t55xx detect -p 11223344"
"lf t55xx detect -p 11223344 -o"
],
"offline": true,
"options": [
"-h, --help This help",
"-1 extract using data from graphbuffer",
"-p, --pwd <hex> password (4 hex bytes)",
"-o, --override override safety check",
"--r0 downlink - fixed bit length (detected def)",
"--r1 downlink - long leading reference",
"--r2 downlink - leading zero",
"--r3 downlink - 1 of 4 coding reference",
"--all try all downlink modes"
],
"usage": "lf t55xx detect [-h1] [-p <hex>] [--r0] [--r1] [--r2] [--r3] [--all]"
"usage": "lf t55xx detect [-h1o] [-p <hex>] [--r0] [--r1] [--r2] [--r3] [--all]"
},
"lf t55xx deviceconfig": {
"command": "lf t55xx deviceconfig",