Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2015-09-09 00:26:01

abyjk
Member
Registered: 2014-11-27
Posts: 7

Nested - doesn't test all keys

Hi together,

I'm kind of new to this stuff but the function "CmdHF14AMfNested" (file cmdhfmf.c) doesn't seem to act like promised.
On command start (hf mf nested 1 0 A xxxx) it says "Testing known keys. (...)". It's plural, so I guess it checks all the keys from the given table (keyBlock with the one key from me and the 13 other ones from source code).

But the two loops around this commited line (https://github.com/Proxmark/proxmark3/commit/5330f5329f68fa6a95658ebd946d5eefc74e10c4#diff-93cfa90a992ea759349344d0de98029eR682) iterate through every block and key type and give the 'keyBlock' to the checking function ("mfCheckKeys" in file mifarehost.c). This function is taking only the FIRST 6 Bytes, interprets and tries them as a key.

So in reality for every block this whole part only checks my one given key (because my key is at top of the table).
Is this the intended way?

I know, the one given key in the parameter list should be tested and this is the way how to test it, but then there should not be printed "Testing known keys (...)"!

But if really every one of these keys should be tested, I suggest the following change:

for (i = 0; i < SectorsCnt; i++) {
	for (j = 0; j < 2; j++) {
		if (e_sector[i].foundKey[j]) continue;
		
		// new loop to iterate through the given keys
		for (int h = 0; h < sizeof(keyBlock)/6; h++){
			res = mfCheckKeys(FirstBlockOfSector(i), j, true, 6, (uint8_t*)(keyBlock + h * 6), &key64);

			if (!res) {
				e_sector[i].Key[j] = key64;
				e_sector[i].foundKey[j] = 1;
				break; // end inner loop if we found a key
			}
		}// same as before from now on
	}
}

According to this, I would try to implement a "fixpoint analysis" - in case of wrong or not working keys it should try with an other known key (because sometimes it finds only 80% but on restart it finds OTHER 80% of the keys and overwrites the good ones).

What do you think about it?

Offline

#2 2015-09-10 18:23:46

abyjk
Member
Registered: 2014-11-27
Posts: 7

Re: Nested - doesn't test all keys

Well okay, I changed my client code, but what now?
How do I post you the differences / ask for review?
Shall I post the entire file here??
Please guide me, I didn't find a hint in forum sad

Offline

Board footer

Powered by FluxBB