Skip to content

hf mfp dump implementation#3116

Merged
iceman1001 merged 7 commits intoRfidResearchGroup:masterfrom
apply-science:master
Mar 9, 2026
Merged

hf mfp dump implementation#3116
iceman1001 merged 7 commits intoRfidResearchGroup:masterfrom
apply-science:master

Conversation

@apply-science
Copy link
Contributor

A early version for performing dumps of MIFARE Plus credentials that supports both SL1, SL3 and mixed mode credentials.

Replace mf_check_keys (which hangs in firmware infinite retry loop)
with mf_read_sector for SL1 key probing. Defer MFC key probing to
the read phase so it only runs per-sector when SL3 auth fails.
Also fix mfcProbeKeys memory leak on early exit paths.
Restructure dump into 4 phases:
1. Classify sectors via single MFC probe (SL3 vs SL1)
2. AES dictionary only on SL3 sectors
3. MFC dictionary only on SL1 sectors
4. Read with found keys

Suppress firmware debug output during key probing to prevent
auth error message flood, matching MifareChkKeys behavior.
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

You are welcome to add an entry to the CHANGELOG.md as well

Signed-off-by: apply-science <106422483+apply-science@users.noreply.github.com>
@iceman1001
Copy link
Collaborator

Cool new functionality!

But why do I get a feeling you are mixing check keys (or find all needed keys) and dump in the same go?

I suggest you have a hf mfp chk which gives you a file with all keys needed for sl1, sl3 (mixedin mode)

and the reading of a json file, belongs in the fileutils.c

apply-science and others added 3 commits March 8, 2026 18:35
Restructure hf mfp dump to match hf mf dump pattern: load keys
from files, read sectors, save. Remove all key probing/checking
logic (use hf mfp chk and hf mf chk separately for key discovery).
Use MF_KEY_A/MF_KEY_B defines instead of magic numbers.
Replace custom JSON parser with existing loadFileJSON infrastructure.
Signed-off-by: apply-science <106422483+apply-science@users.noreply.github.com>
When no --keys or --mfc-keys arguments are given, automatically
look for hf-mfp-<UID>-key.json and hf-mf-<UID>-key.bin files,
matching the output of hf mfp chk --dump and hf mf chk --dump.
Fail with helpful message if no keys are available, matching
the behaviour of hf mf dump.
@iceman1001
Copy link
Collaborator

the dump command should support the nosave parameter as well.

@apply-science
Copy link
Contributor Author

apply-science commented Mar 9, 2026

the dump command should support the nosave parameter as well.

It already does.

  • Line 2000: arg_lit0(NULL, "ns", "No save to file")
  • Line 2022: bool nosave = arg_get_lit(ctx, 5);
  • Line 2332-2337: Skips saving when --ns is set

@iceman1001 iceman1001 merged commit d27885c into RfidResearchGroup:master Mar 9, 2026
12 checks passed
@iceman1001
Copy link
Collaborator

Execellent! Great PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants