PR #2453 computed the parity bits over stream positions and PR #2947
inverted the checksum, so --fc/--cn clones did not match the genuine
cards on record, from issue #2939 and the DangerousThings forum. Both
carry the 26-bit Wiegand parity of getIndalaBits4041x and the checksum
from before #2947, and the encoder now reproduces them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeQL installs its packages with apt and stalls on
azure.archive.ubuntu.com like the Ubuntu jobs did
(actions/runner-images#14823). #3747 left this workflow out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The values went through uint8_t or & 0xFF, so --max 300 ran with 44
and --samples 1000 with 232. The --fs clocks stay 8-bit in the FSK
demod and are now refused above 255.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since cd5906674 the flash animation runs whatever stdout is, and a
redirected flash of fullimage.elf wrote a 7 MB log.
flash_pm3() replaced a flash error with the result of
flash_stop_flashing(), always PM3_SUCCESS, so a failed flash ended with
"All done". main() exited 0 after --flash, --dumpmem and
--reboot-to-bootloader whatever happened. dumpmem printed its negative
error code with %u.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
actions/checkout v6 hands the Windows path of its credentials config to
git config --unset as a regex, which MSYS2's git rejects in the
ProxSpace job (actions/checkout#2528, fixed in v7.0.1). The
persist-credentials: false added for it did not help and is dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Ubuntu jobs drop azure.archive.ubuntu.com from the runner's mirror
list. It sometimes serves at tens of kB/s, held apt-get install for up
to 50 minutes and apt never fails over (actions/runner-images#14823).
The ProxSpace job no longer asks for arm-none-eabi-gdb, which MSYS2
replaced with gdb-multiarch in 2023, and no longer persists the
checkout credentials, whose cleanup failed with MSYS2's git on PATH.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mfulc_des_brute added the Homebrew openssl@3.6 include directory, which
the macOS runners no longer have, and -Wmissing-include-dirs under
-Werror stopped the build. It now uses brew --prefix openssl, as #3734
did for mfd_aes_brute.
Since MSYS2 filesystem 2026.10.18 /etc/profile runs post-install
scripts on the first start only, so ProxSpace never installed its
packages and the build found no arm-none-eabi-gcc. The workflow now
runs ProxSpace's setup script when setup\installed is missing.
The third mfulc_des_brute test in pm3_tests.sh is now labelled 3/3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
caa76f57b ("Fix pm5 recovery image") also moved the AT91 pad from
0x00102000 to 0x00104000, but the AT91 boot area is 8 KB and the OS
image starts at 0x102000. recovery.bin had every fullimage section
0x2000 too high and 0xFF at the OS entry, so a JTAG recovery would
leave the bootrom in flash mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Large GET DATA returns 61 xx. Concatenate clear 00 C0 bodies before
unwrap so 255-byte AES and 2K3DES objects print instead of exit 246.
Co-Authored-By: Cursor Grok 4.6 <noreply@cursor.com>
The hardcoded openssl@3.6 include path fails macOS CI when that formula
is absent. Ask brew for the installed OpenSSL prefix and use it for
both headers and libraries.
Built all three mfd_aes_brute tools with Clang and GCC 16 against
OpenSSL 3 and 4 on macOS. Existing linker deprecation warnings remain.
GCC 8.5 emits COMMON globals by default. Apply -fno-common in the shared
Make and CMake flags so it covers the OS, bootrom and PM5 armlib. Also
remove bootrom archives on clean to avoid reusing old library objects.
Built OS and bootrom for PM5/RDV4 with GCC 8.5/13.3 using Make and CMake.
No COMMON object symbols remain; PM5 CDC state is inside BSS. Existing
build warnings remain. No hardware was flashed.
hf seos pacs on 2K3DES cards exited 236 with no message after mutual
auth. Print ExchangeAPDU14a failures, check mbedtls DES-CMAC without
mutating the caller key, decode SELECT 85 at its real length, and emit
short-form 85 when the cryptogram is under 128 bytes.
Co-Authored-By: Cursor Grok 4.6 <noreply@cursor.com>
The bootrom linker script defines __bss_end__ before COMMON symbols are
placed. Startup clears only up to that boundary. On PM5 with ARM GCC 8.5,
this leaves the entire 92-byte USB CDC structure outside the zeroed area,
even though bootrom sources themselves are built with -fno-common.
Place COMMON inside .bss before setting __bss_end__, and assert that the
boundary covers the whole section. The shared script applies to PM5 and
RDV4. On the tested PM5 build, stack addresses, the shared communication
area and the entry point remain unchanged.
Built both targets with ARM GCC 8.5 and ran bootrom/check. Checked ELF
boundaries and the 16 KiB boot partition; removing COMMON placement
triggers the new assertion. No compiler warnings; the existing PM5 RWX
LOAD-segment linker warning remains. CMake and BWM builds were not tested.
Flashed the bootrom alone on PM5 and verified readback against the image.
All internal flash bytes from the OS start onward matched the pre-flash
backup. Cold startup and five software reset cycles passed. Five complete
bootloader/read/reset cycles also passed after fixing the client's dump
cleanup separately. FPGA was not written. This corrects initialization;
it does not establish a fix for the USB-controller failures in #3642.
Bootloader memory-dump cleanup sends CMD_PING to wake the communication
thread after clearing its run flag. The thread can be waiting for another
transmit after the dump ACK, so it sends this command before exiting.
The non-BWM bootrom does not handle CMD_PING: its default dispatch enters
Fatal(), leaving the device unresponsive even though the dump succeeded.
Use CMD_DEVICE_INFO for the wakeup instead. It is already supported by the
bootloader and used to identify it before the dump. Keep the wakeup so
closing the client does not leave the communication thread waiting.
Reproduced on PM5: the dump completed, but the following reset and device
probe failed. With only the rebuilt client changed, the same test script
passed five OS-to-bootloader, memory-dump and reset-to-OS cycles, with a
successful ping after each. No firmware was flashed for this comparison.
Built the client with AppleClang through Make, CMake and experimental_lib;
client/check passed. GCC 16 compiled the changed translation unit with
-Wall -Werror. Existing macOS linker warnings remain. The full GCC host
build was not repeated because of the previously observed Apple SDK
alignment error. Linux and Windows were not tested; this change replaces
an existing protocol command without changing platform-specific code.
Problem
The native hf mfu countertear used a device-side
CMD_HF_MFU_COUNTER_TEAROFF path with a static increment payload,
decided once per run. The pyscript mfuev1_counter_reset.py implements
the same attack with auto-calibration, a 3-phase attack loop,
per-attempt BD delay tuning (hunting) and stuck-value handling,
which the native command lacked.
Change
- rewrite the client command around the generic tear-off hook
(hw tearoff) and raw INCREASE_CNT frames, mirroring the pyscript
step by step: preflight checks, CHECK_TEARING_EVENT support gate,
targeted repair/normalize, BD sweep calibration (working delay
accepted only on 0xBD), and the DECREMENT -> PREPARE (0x00FFFF)
-> RESET phases with the same increment payloads (000100 for
decrement steps, 010000 for reset/repair)
- same delay tuning on counter movement: +1 when unchanged, -1 when
a jump exceeds 10, delay locked after a successful decrement
- remove CMD_HF_MFU_COUNTER_TEAROFF usage from the client; device
side stays untouched
- add Lua port client/luascripts/mfuev1_counter_reset.lua with the
same behaviour, using core.console capture and Enter-to-stop
- regenerate doc/commands.md and doc/commands.json
Behaviour change
Same CLI shape as the pyscript (-c/-f/--DelayBD/--Delay00, legacy
-i/-l/-s/-x options removed). Console output now matches the pyscript.
Testing
gcc warningless for client, armsrc and bootrom (RDV4). make check
green. doc regenerated with GD enabled. Verified 1:1 against the
pyscript and the new Lua port on hardware (EV1 card). Not tested
here: clang, Windows/ProxSpace and macOS. No build files are touched,
so the usual client-side review applies.
Co-Authored-By: opencode agent (GLM-5.3-Flash-Free) <noreply@opencode.ai>
Validate counter choices 0-2, treat only 0x00/0xBD as valid
CHECK_TEARING_EVENT answers, and detect NACK replies from the raw
payload, so retry logic does not mistake a NACK for a real answer.
Building the client with -march=x86-64-v3 (the CentOS/RHEL 10
baseline) fails with gcc 14:
src/emv/emvcore.c:211:24: error: writing 32 bytes into a region of
size 22 [-Werror=stringop-overflow=]
gcc vectorizes the dash fill loop in aidlist_rule() into 32-byte
stores and loses the pos + 2 < dstlen bound. The bound was correct.
Compute the dash count with the same limit and fill it with memset,
so there is no vectorized loop store to mis-size. Output is unchanged.
Reported in #3671.
Co-Authored-By: Grok Bot <noreply@users.noreply.github.com>