Merge branch 'RfidResearchGroup:master' into 20260713-gdm
This commit is contained in:
5 files changed
+23
-7
No files matched your search
@@ -4,6 +4,8 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
||||
|
||||
## [unreleased][unreleased]
|
||||
|
||||
- Fixed `hf iclass view` reading past the end of dump files smaller than a picopass header, causing a heap out-of-bounds read and garbage/leaked heap data being printed as tag content (@munzzyy)
|
||||
- Fixed `wiegand decode` returning facility code 16777339 instead of the encoded value for the IR56 (Inner Range 56-bit) format by masking the header sentinel bit off the facility code (@munzzyy)
|
||||
- Fixed `lf em 4x05 dump` writing byte-swapped (corrupted) block data to the saved dump file (@munzzyy)
|
||||
- Added `hf 14b dump` support for Standard ISO14443-B tags (@thisiscamk)
|
||||
- Added `hf 14b ctrdbl` and `hf 14b ctdump` commands for interacting with ASK CTS tags (@kormax)
|
||||
|
||||
@@ -151,10 +151,10 @@ function Command:sendMIX( ignore_response, timeout, use_cmd_ack)
|
||||
arg1 = nil
|
||||
arg2 = nil
|
||||
arg3 = nil
|
||||
local count, length, magic, status, crc, ng
|
||||
local count, length, magic, status, reason, crc, ng
|
||||
|
||||
-- S S I s S L L L
|
||||
count, cmd, length, magic, status, crc, arg1, arg2, arg3 = bin.unpack('SSIsSLLL', response)
|
||||
-- S S I c c S L L L
|
||||
count, cmd, length, magic, status, reason, crc, arg1, arg2, arg3 = bin.unpack('SSIccSLLL', response)
|
||||
count, data, ng = bin.unpack('H'..length..'C', response, count)
|
||||
|
||||
local packed = bin.pack("LLLLH", cmd, arg1, arg2, arg3, data)
|
||||
@@ -175,9 +175,9 @@ function Command:sendNG( ignore_response, timeout )
|
||||
|
||||
data = nil
|
||||
cmd = nil
|
||||
local count, length, magic, status, crc, arg0, arg1, arg2
|
||||
local count, length, magic, status, reason, crc, arg0, arg1, arg2
|
||||
|
||||
count, cmd, length, magic, status, crc, arg0, arg1, arg2 = bin.unpack('SSIsSLLL', response)
|
||||
count, cmd, length, magic, status, reason, crc, arg0, arg1, arg2 = bin.unpack('SSIccSLLL', response)
|
||||
count, data, ng = bin.unpack('H'..length..'C', response, count)
|
||||
|
||||
--[[ uncomment if you want to debug
|
||||
@@ -198,6 +198,7 @@ function Command:sendNG( ignore_response, timeout )
|
||||
Length = length,
|
||||
Magic = magic,
|
||||
Status = status,
|
||||
Reason = reason,
|
||||
Crc = crc,
|
||||
Oldarg0 = arg0,
|
||||
Oldarg1 = arg1,
|
||||
|
||||
@@ -5306,7 +5306,10 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e
|
||||
endblock = maxmemcount;
|
||||
|
||||
// remember endblock needs to relate to zero-index arrays.
|
||||
if (endblock > filemaxblock - 1)
|
||||
// filemaxblock is 0 when filesize < 8, so filemaxblock - 1 would underflow.
|
||||
if (filemaxblock == 0)
|
||||
endblock = 0;
|
||||
else if (endblock > filemaxblock - 1)
|
||||
endblock = filemaxblock - 1;
|
||||
|
||||
/*
|
||||
@@ -5515,6 +5518,12 @@ static int CmdHFiClassView(const char *Cmd) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if (bytes_read < sizeof(picopass_hdr_t)) {
|
||||
PrintAndLogEx(FAILED, "Error, dump file is too small to be a valid iCLASS dump - bytes: %zu, expected at least: %zu", bytes_read, sizeof(picopass_hdr_t));
|
||||
free(dump);
|
||||
return PM3_EFILE;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "File size %zu bytes, file blocks %d (0x%x)", bytes_read, (uint16_t)(bytes_read >> 3), (uint16_t)(bytes_read >> 3));
|
||||
PrintAndLogEx(INFO, "Printing blocks from: " _YELLOW_("%02d") " to: " _YELLOW_("%02d"), (startblock == 0) ? 6 : startblock, endblock);
|
||||
|
||||
@@ -1472,7 +1472,9 @@ static bool Unpack_IR56(wiegand_message_t *packed, wiegand_card_t *card) {
|
||||
|
||||
if (packed->Length != 56) return false;
|
||||
|
||||
card->FacilityCode = packed->Mid;
|
||||
// Mask off the header/sentinel bit that add_HID_header sets at position 56
|
||||
// (Mid |= 1 << 24) so it doesn't leak into the 24-bit facility code.
|
||||
card->FacilityCode = packed->Mid & 0x00FFFFFF;
|
||||
card->CardNumber = packed->Bot;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -506,6 +506,8 @@ while true; do
|
||||
if ! CheckExecute "wiegand Verkada40 decode test 2" "$CLIENTBIN -c 'wiegand decode --raw 86400007D9'" "Verkada40.*FC: 50 CN: 1004 parity \( ok \)"; then break; fi
|
||||
if ! CheckExecute "wiegand Verkada40 encode test 3" "$CLIENTBIN -c 'wiegand encode -w Verkada40 --fc 81 --cn 5008'" "8A20002721"; then break; fi
|
||||
if ! CheckExecute "wiegand Verkada40 decode test 3" "$CLIENTBIN -c 'wiegand decode --raw 8A20002721'" "Verkada40.*FC: 81 CN: 5008 parity \( ok \)"; then break; fi
|
||||
if ! CheckExecute "wiegand IR56 encode roundtrip" "$CLIENTBIN -c 'wiegand encode -w IR56 --fc 123 --cn 123 --pre'" "9E000000100007B0000007B"; then break; fi
|
||||
if ! CheckExecute "wiegand IR56 decode roundtrip" "$CLIENTBIN -c 'wiegand decode --raw 9E000000100007B0000007B'" "IR56.*FC: 123 CN: 123"; then break; fi
|
||||
|
||||
echo -e "\n${C_BLUE}Testing LF:${C_NC}"
|
||||
if ! CheckExecute "lf hitag2 test" "$CLIENTBIN -c 'lf hitag test'" "Tests \( ok"; then break; fi
|
||||
|
||||
Reference in new issue
Block a user