From 4be1967ab040636482b69f85d3f81c223cb8e7b8 Mon Sep 17 00:00:00 2001 From: team-orangeBlue <63470411+team-orangeBlue@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:12:56 +0300 Subject: [PATCH 1/2] Add WTX support in ExchangeRaw14A For whatever reason there was no support for WTX replies from a tag. If a tag replied with an APDU frame of 0xF[n] instead of 0x0[n], the client would error out when it should not have done that. There's now support for that. Signed-off-by: team-orangeBlue <63470411+team-orangeBlue@users.noreply.github.com> --- client/src/cmdhf14a.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 44ef40c3a..dc3066bdd 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -1162,6 +1162,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav uint8_t *recv; PacketResponseNG resp; +resend: if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { recv = resp.data.asBytes; int iLen = resp.oldarg[0]; @@ -1184,7 +1185,23 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav } return PM3_ELENGTH; } - + if (recv[0] & 0xf0) { + uint8_t dbg_curr = DBG_NONE; + if (getDeviceDebugLevel(&dbg_curr) != PM3_SUCCESS) { + return PM3_EFAILED; + } + if (dbg_curr >= DBG_DEBUG) { + PrintAndLogEx(WARNING, "Card requested WTX"); + } + // WARNING for users of this function: + // This NO_DISCONNECT flag will NOT save you. If you run your commands with LeaveSignalOn set to false, they will still fail if a card asks for WTX. + // Better keep the flag on and do a DropField(); at the end. + SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_NO_DISCONNECT | cmdc, 5, 0, recv, min); // 2b frame +1b "data" + 2b crc. Hardcode length to 5 and reply to response + goto resend; + } + // OBS + // This if check below breaks command flow if the card for whatever reason decides to request a WTX. + // Because WTX will do a |= 0xF0 to the framing, this check triggers and everything that was happening will stop. if (recv[0] != data[0]) { if (silentMode == false) { PrintAndLogEx(ERR, "iso14443-4 framing error. Card send %2x must be %2x", recv[0], data[0]); From 54e9a48e7b4a16d00b1a9888f487d801d552f6d5 Mon Sep 17 00:00:00 2001 From: team-orangeBlue <63470411+team-orangeBlue@users.noreply.github.com> Date: Wed, 25 Mar 2026 10:15:30 +0300 Subject: [PATCH 2/2] Update CHANGELOG.md Signed-off-by: team-orangeBlue <63470411+team-orangeBlue@users.noreply.github.com> --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a20f8bf4..040420bfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed WTX response behavior in `ExchangeRaw14A()` (@team-orangeBlue) - Added `-t` / `--timeout` option for `hf 15 sim` (@recursivenomad) - Added `--aid` parameter to `hf seos` commands (@kormax) - Added `hf iclass blacktears` command to perform an automated tearoff of block 1 to set non-secure page mode(@antiklesys)