-
Notifications
You must be signed in to change notification settings - Fork 3.1k
MIFARE Classic Key Recovery Improvements #3822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR also resolves |
The accelerated dictionary attack is mostly working. I'm tracking down a minor bug in it and making sure the UI reflects the state of the attack. The fork takes an average of 10 seconds to run dictionary attacks in my tests (1 second of the average is backdoor detection - separate from the dictionary attack). OFW 0.105.0 takes an average of 3 minutes 10 seconds. On real tags the number of unknown keys and the offset in the dictionary are all different, here are five benchmarks on random MIFARE Classic tags:
|
All issues resolved that I could reproduce, please re-test this PR @skotopes @RebornedBrain @doomwastaken:
Steps taken
ConclusionTwo issues: faulty state machine logic, target sector on 4K cards. Fixed in 4be9e79
Steps taken
ConclusionPossible cache issue? Verify no keys are cached for this tag.
Steps taken
ConclusionInconsistent assignment of known key and known key type/sector led to repeated failed authentication attempts. Keys were provided by specific NFC plugins instead of the dictionary attack. Fixed in 897817a and db26c85
Steps taken
ConclusionLikely related to the other (now fixed) issues. Please re-test. |
Since #3961 (comment) will delay 1.1, is it still possible to squeeze this PR in too if the issues identified in QA are resolved by #3822 (comment) ? These changes would allow me to share an early, significantly easier process with the users as well as limit the scope of each PR versus rolling up more changes into this single PR making it unwieldy to do QA. Additionally, it would be useful to collect feedback from users so we can identify any rare or uncommon issues (thanks to the exceptional QA already done, every issue that was reported to me - even prior to the review - has been resolved). RE: how users could use the nonces collected by this PR, PR 243 to good-faps would make a complete process available: flipperdevices/flipperzero-good-faps#243 Wanted to bring this up for your consideration. I understand if it's not possible. For context, this is what is required for reading cards today. It becomes a two step process with this PR (3822) plus PR 243 to good-faps. |
@noproto, Hi, I've retested those cases and here are the results: Test 1: no plugins, stuck at particular key - Fixed, now works fine. ✅ Now about new issue which I've noticed. Actually, maybe it was even previously, but we didn't see it. When I tested test 2 and 3, sometimes Flipper tries to perform attack again, even if I already have cracked nonces with the help of MFKey and key Here are steps to reproduce:
Expected result: Flipper reads card totally each time without any attempts of collecting nonces, because it already has known key in user dictionary. Result: Flipper sometimes doesn't apply known key during read process, instead it collects nonces. |
Hi @RebornedBrain, good catch. Fixed in 6dbb46a I believe. Try again. |
I guess we are ready to merge this PR, couple small things left to cleanup:
|
Remaining TODOs marked with FL-3926. I'll open the refactoring PR when 3822 is merged, and I'll keep improving it as needed (clearing all TODOs, unit tests for parity, backdoor detection moved outside the poller). If its helpful, I'll add FL-3926 to the title of the next PR. RE: PVS:
All good warnings by PVS this time. |
@noproto awesome work ) |
Thanks everyone involved for the work landing this! Looking forward to trying it out. |
Thanks for your work @noproto. And an opened question. Do you think, guys, nonces recovery could be implemented on a mobile app side conceptually? |
I appreciate your reply @mishamyte. As far as offloading goes, I am only interested in doing this for attacks which are not possible to run on the Zero (Hardnested). Since the Flipper Zero is a first generation device, the on-device attacks today are the worst they will ever be. Optimization of the key recovery process on the device has brought multiple recovery methods from taking months to minutes. I will continue to optimize and develop code for the process defined in this PR, but as new hardware revisions are imminent I expect that even without changes it will soon run in seconds rather than minutes (which would immediately deprecate any offloading effort done except for Hardnested). |
Thank you! So personally I would prefer to have both options. As we had it previously - with Python script + old fap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool
Awesome work @noproto , do you think this might now work on legacy oyster card, which I think are based on MIFARE Classic? |
I don't see why not. Update to the latest firmware and try it out, let me know if you experience any issues. Here is a guide to using the features: https://flipper.wiki/mifareclassic/ |
What's new
Verification
This PR currently contains the minimum necessary code to achieve the intended functionality. It will be superseded with performance improvements.
Checklist (For Reviewer)