RfidResearchGroup / proxmark3

Iceman Fork - Proxmark3
http://www.icedev.se
GNU General Public License v3.0
3.65k stars 981 forks source link

Fix for issue #2244 (hf15 raw -k command) #2245

Closed Chris-P-Young closed 6 months ago

Chris-P-Young commented 6 months ago

Description This PR is submitted to address issue #2244 (hf 15 raw -k option (keep field on) is broken/removed)

Currently, the -k option for hf 15 raw command does not keep the RF field turned on. The option is parsed, but the DirectTag15693Command in iso15693.c explicitly turns off the field at the end of the command. It also unconditionally resets the field at the start of the command.

Why is this important? This is important for tags that have non standard Iso15693 commands that require the tag to remain powered between commands. An example is the NXP ICODE SLIX-L which requires that the tag remains powered during the privacy disable sequence (get random number followed by set password command). We already have instruction support for SLIX privacy enable/disable, but we should also be able to achieve the same thing using raw commands as Proxmark is meant to be a learning and investigative tool.

Solution This PR updates the code provided in PR #1636 to be compatible with the new code base. This PR also includes a minor modification to enable "write alike" timing for two ICODE SLIX-L commands (set password / enable privacy". Without this, the timeout is too short and the tag response is missed resulting in the client returning a "command failed" response.

github-actions[bot] commented 6 months ago

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

iceman1001 commented 6 months ago

Great,
The sending of flags is not good all. It should use our new prefered way of sending a struct. Another suggestion as below, it would remove the need for a new global var and upside we can prep hf 15 for APDU support.

add ISODEP_NFCV

typedef enum {
    ISODEP_INACTIVE = 0,
    ISODEP_NFCA,
    ISODEP_NFCB,
} isodep_state_t;

void SetISODEPState(isodep_state_t state) {
    isodep_state = state;
    if (APDULogging) {
        PrintAndLogEx(SUCCESS, "Setting ISODEP -> %s%s%s"
                      , isodep_state == ISODEP_INACTIVE ? "inactive" : ""
                      , isodep_state == ISODEP_NFCA ? _GREEN_("NFC-A") : ""
                      , isodep_state == ISODEP_NFCB ? _GREEN_("NFC-B") : ""
                     );
    }
}
Chris-P-Young commented 6 months ago

Hi Iceman, Many thanks for your feedback. Unfortunately, I'm not sure that my coding skills are up to the job of implementing something that will pass review cleanly. Also, I'm not familiar with APDU and so I will have to leave this to the experts. I raised the issue reports and PR because I wanted to highlight the issues. My initial concern was that the -k flag did not perform as documented. However using a hard coded "command" list to determine response time for a "raw mode" seems an even worse issue.

iceman1001 commented 6 months ago

No worries, I have refactored the 15 raw command, I will need you to test things out.

iceman1001 commented 6 months ago

try https://github.com/RfidResearchGroup/proxmark3/commit/8d0b41a911ca308eac990cc6bdb21d3fd073ef1c and see if this works better.