It started with a simple, nagging curiosity. Whenever you download a firmware update for the Lab599 TX-500 Discovery (like mtrx1.30.00.fw), you get a ~246 KB binary blob that the updater pushes straight to the radio over serial—as I previously documented when building my native macOS firmware updater and disassembling Lab599’s official v1.2 updater.

No release notes ever explain what lives inside that .fw container. Running strings returns random noise, and binwalk shrugs its shoulders. As someone who has spent years tinkering with security and cryptography—and having had some modest experience poking at encrypted firmware images before—this immediately felt familiar. In fact, the whole puzzle looked remarkably like the classic cryptography and binary challenges you see in CTF competitions; as the founder of ASIS CTF and CryptoCTF, recognizing patterns like keystream reuse, crib dragging, and statistical distinguishers was second nature.

I couldn’t shake two questions:

  1. Can we peel back the encryption and recover the raw ARM Cortex-M4F firmware—without ever dumping the locked bootloader?
  2. Does the TX-500’s CAT engine hide undocumented commands beyond what Lab599 publishes in their official CAT Protocol Rev 3 PDF?

What began as a weekend hex-editor peek—and an OSINT-style dig through the Wayback Machine (web.archive.org) to hunt down long-deleted historical firmware releases—turned into a deep-dive reverse-engineering effort across 34 firmware builds (from v1.01.08 all the way to v1.31.02), combining custom Python/C tooling, LLM-assisted trial-and-error hypothesis testing, and static disassembly to recover a 100% decoded code/data image and 10 undocumented CAT commands.


1. First Look: The BL20 Container & Entropy 7.999

Opening mtrx1.30.00.fw (246,384 bytes) immediately ruled out a raw STM32 image. Its payload entropy measured 7.999171 bits per byte—virtually indistinguishable from uniform random noise.

Because the PC updater (57600 baud, 8N1) streams the 16-byte header, waits for OK, and sends the rest of the file verbatim without touching a single byte, all decryption and integrity verification live inside the STM32F407 bootloader (0x08000000–0x0801FFFF).

The 16-byte BL20 header breaks down like this:

Offset:  00 01 02 03 | 04 05 06 07 | 08 09 0A 0B | 0C 0D 0E 0F
Bytes :  42 4C 32 30 | 62 84 FF D3 | AD 6C C2 50 | AA B4 1A C6
Field :  [  "BL20" ] | [h4_checksum] | [h8_enc_len] | [ model_id ]
  • BL20: 4-byte container magic.
  • model_id: Little-endian hardware ID (0xc61ab4aa for TX-500 Discovery / PRO / ALTAI, 0xf4cd3b96 for TX-500MP).
  • h8_enc_len: Payload length XORed with a model-specific mask (0x50c1aef1 for TX-500, 0x5b058d35 for TX-500MP).
  • h4_checksum: A 32-bit integrity field that remained a stubborn mystery until late in the project.

2. The Spark: Wayback Machine OSINT & Cross-Version XOR

One firmware file alone tells you almost nothing. The real clue came from comparing multiple versions side by side—which meant I needed as many historical .fw releases as I could find. Since Lab599’s live site only hosts recent builds, I had to treat it like an OSINT exercise, crawling archive.org’s Wayback Machine to recover forgotten releases going all the way back to v1.01.08, v1.02.00, v1.04.xx, v1.12.08, and v1.13.08, alongside PRO, ALTAI, and TX-500MP variants.

Once I XORed different versions against each other (v1.29.06 vs. v1.30.00, and later v1.31.02), two unmistakable patterns jumped off the screen:

  1. Identical tails: Past .data, adjacent versions had tens of kilobytes of zero XOR (58,787 identical bytes between 1.30.00 and 1.31.02).
  2. Vector table deltas: At offset 0x00000, XORing two builds produced clean, small 32-bit pointer deltas—classic signatures of an ARM Cortex-M4 vector table where function addresses shifted slightly between compiles.

Just like a classic CTF “two-time pad” stream-cipher challenge, every firmware in the 0xc61ab4aa family is encrypted with a static, position-aligned XOR keystream:

\[C_v[i] = P_v[i] \oplus K[i]\]

When you XOR two versions $A$ and $B$ at the same offset, the secret keystream $K[i]$ cancels out completely:

\[C_A[i] \oplus C_B[i] = \bigl(P_A[i] \oplus K[i]\bigr) \oplus \bigl(P_B[i] \oplus K[i]\bigr) = P_A[i] \oplus P_B[i]\]

This single property held across all 34 images from 1.01.08 through 1.31.02.


3. Roadblocks Along the Way

Getting from a neat CTF-style XOR observation to a clean, disassemblable binary was anything but smooth. Here are the biggest walls I ran into—and how custom scripts paired with LLM-assisted trial-and-error and statistical testing helped break through them:

Roadblock #1: No Shortcut to the Keystream Generator

Naturally, I tried to crack the keystream $K[i]$ mathematically. Using automated test suites and LLMs to rapidly brainstorm, implement, and falsify candidate PRNGs and statistical distinguishers, every standard hypothesis failed:

  • Periodicity & KMP: Across 131,680 contiguous known bytes, there wasn’t a single repeating 8-byte block, and lag correlation up to 140,000 hovered at random noise ($1/256 \approx 0.39\%$).
  • Berlekamp–Massey over $\mathbb{F}_2$: Linear complexity was $L \approx n/2$ (22,000 bits on 44,000-bit windows), ruling out LFSRs, MT19937, xorshift, and xoroshiro.
  • Standard Ciphers & PRNGs: Truncated LCGs, SplitMix, Murmur3, Icom-style additive autokey (65,536 parameter pairs), and 77,760 AES-CTR / ChaCha20 / RC4 / XTEA key/IV guesses all came up empty.
  • Uniformity: $\chi^2 = 233.50$ ($df = 255$)—statistically indistinguishable from a full-length nonlinear stream pad.

Takeaway: Without a bootloader dump, there is no closed-form formula for $K[i]$. Every byte of $K[i]$ had to be recovered empirically from overlapping firmware builds.

Roadblock #2: Hitting the 0x1adac Wall (Stuck at 30.45%)

My first relocation scanner assumed simple linear shifts between two builds. It marched backward from the zero-tail and slammed into a wall at 0x1adac (30.45% coverage). All 21 system/interrupt vectors and the entire CAT parser remained scrambled.

Roadblock #3: The +0x68 Shift Trap & crtbegin.o

Switching to a dynamic, relocation-independent multi-version scanner across 16 (and eventually 34) Discovery, PRO, and ALTAI images shattered the 30% wall and jumped coverage to 94.82%.

Still, two stubborn pockets fought back:

  • A +0x68 shift assumption broke at 0x00dc4..0x00e2c because cat_rx_handler was refactored between 1.30.00 and 1.31.02. Bridging through older 1.12.08 -> 1.13.08 builds (+0x110 shift) resolved it with zero <UNDEFINED> instructions.
  • The startup stub crtbegin.o (0x00188..0x001d0) had 16 bytes that never moved across modern builds. I tracked down the exact compiler toolchain (GCC 9.3.1 9-2020-q2-update), extracted its crtbegin.o, and traced Reset_Handler -> __libc_init_array -> bl _init across 24 builds to prove the final two literals (0x001b0, 0x001cc) point to _init() (0x08048770).
  • Hardware confirmation: Recovering all 98 / 98 vector table slots (392 bytes, SP = 0x20020000, NMI–SysTick, plus 12 active DMA/I2C/UART IRQs) and confirming zero references to CRYP (0x50060000) verified the MCU is indeed an STM32F407.

4. Firmware Schematic: Green (Recovered) vs. Red (Unrecovered) in v1.31.02

For the latest mtrx1.31.02.fw (251,800-byte payload, mapped at 0x08020000), every single byte of code, constants, and verified padding from 0x00000 to 0x3c260 (246,368 bytes = 97.84%, Blocks B00–B59 + the first 608 bytes of B60) is 100.00% cryptographically recovered with zero conflicts (extended_plaintext_sha256: 251a6717...a26efb9206bce2791b8852c56c).

Inspecting Reset_Handler’s literal pool (_sidata = 0x0804dbe4, _sdata = 0x20000000, _edata = 0x200000dc) also revealed a remarkably clean linker invariant: across 1.29.01, 1.29.06, 1.30.00, and 1.31.02, the distance from the end of .data (0x2dcc0 in 1.31.02) to the end of the payload is always exactly 0x0fad8 (64,216) bytes.

Only 5,432 bytes (2.16%) at the very end (0x3c260..0x3d798—the remainder of B60 and all of B61) remain unrecovered in red, simply because 1.31.02 is 5,432 bytes longer than 1.30.00, leaving no older firmware overlap at those offsets.

Block-by-block recovery schematic of Lab599 TX-500 v1.31.02 showing 60 green 4 KiB blocks, partial block 60, and red unrecovered tail
Full 62-block (4 KiB each) recovery schematic of mtrx1.31.02.fw: Green = 100% cryptographically verified; Red = unrecovered tail beyond v1.30.00.

Bonus: Cracking the h4_checksum Structure

With 33 complete images in hand, the 32-bit h4 header field also revealed its structure:

\[h_4 = \left(\sum_{i=0}^{N-1} P[i] + d\right) \oplus \texttt{0xd2d75d81}\]

Across all 33 images, the top 19 bits and bit 0 (parity) match this formula 100% of the time, leaving only a small even residual $d \in [-304, +866]$ computed inside the bootloader. Even better, h4 for 1.31.02 (0xd3e5dea6) yields $d = +400$ under --zero-tail, independently corroborating that those final 5,432 red bytes are indeed 0x00.


5. Inside the Binary: 10 Undocumented CAT Commands

Disassembling mtrx1.31.02 at 0x08020000 led straight to the main CAT command dispatcher at 0x08020f68 (called from 0x08039700).

The dispatcher handles 64 two-letter commands in total. Comparing them against Lab599’s official CAT Protocol Rev 3 manual:

  • 54 commands match the official documentation (with a few interesting implementation quirks, such as MD6 and MD9 both mapping to internal mode 4 (DIG) at 0x080218d4, returning '2' in ID019 mode and '6' in ID500 mode).
  • 4 commands in the Rev 3 PDF are absent in TX-500 v1.31.02 (AC, CN, CT for the TX-500MP, plus NF, which is a PDF typo for NT).
  • 10 commands are completely undocumented in Rev 3:
Command Address Behavior in Firmware 1.31.02 Purpose / Notes
AI 0x0802220e AI; always returns AI0; Legacy Kenwood TS-2000 compatibility stub (Auto-Info off).
EX 0x080222b8 Any EX...; returns EX + 23 zeros + ; Dummy TS-2000 compatibility stub.
Fw 0x08021392 Case-sensitive lowercase w! Fw; returns Fw0<rx>0<tx>; (FW; errors). Legacy/hidden version of FL (DSP RX/TX filter).
MX 0x080217a4 MX; / MX1;..MX9; (excluding MX8). Fast mode read/set without full TX/audio path reset (likely factory test).
XX (XXX) 0x08021952 XXX; returns (C)RA9YTJ; Developer signature / Easter egg (RA9YTJ, Lab599’s designer)!
SE (SET) 0x08021e58 SET; returns a 10-char challenge; SET00<8chars>; unlocks service mode. Master unlock key (0x20019870 = 1).
XL 0x08021a3a XL<addr>; returns XL<3-digit-u8>; Reads raw bytes from status RAM (locked) or 1024-byte NVM config (unlocked).
XS 0x080219e2 XS<4digit><sep><val>; returns XS0; Writes raw bytes to status RAM or 0x20019da0 NVM config (has a signed-overflow bug for addr < 1000).
ZG 0x08020dc4 Unlocked only: ZG<4hex><8hex>; Engineering dump of TX/VFO frequencies & Backup SRAM (0x40024400) channels.
ZS 0x0802150a Unlocked only: ZS000000000001; (save to Flash), ...0000; (MCU reset), ...0002; (Factory Reset). Commits 0x20019da0 permanently to Flash Sector 1, factory resets, or reboots the MCU.

(A fun reverse-engineering side note: XS actually has a signed comparison bug—ble on addr - 999 <= r9 at 0x08021a02—which allows negative offsets below 1000 into memory preceding 0x20019ad8, including the unlock flag itself at -616. Once the SET; math was solved, there was no need to rely on that bug.)


6. The Crown Jewel: SET; Service Unlock & the Hidden Wide-TX Table

The biggest surprise is the SET; authentication handshake. The radio derives a 10-character challenge (encoded in 'A'..'P' nibbles) from the 96-bit STM32F4 Unique Device ID (0x1FFF7A10..0x1FFF7A18):

\[B = \mathrm{UID}[1] \bmod 256, \qquad S = \bigl(\mathrm{UID}[0] + \mathrm{UID}[1] + \mathrm{UID}[2]\bigr) \bmod 2^{32}\] \[M = B \cdot \texttt{0x01010101}, \qquad R = S \oplus M\]
Sequence diagram of the hidden SET; challenge-response handshake using the STM32F4 96-bit UID
The hidden SET; challenge-response protocol that unlocks ZG, ZS, full 1024-byte XL/XS access, and the front-panel Service Menu.

Once unlocked (0x20019870 = 1), ZG and ZS wake up, XL/XS switch to the 1024-byte Flash-backed configuration structure (0x20019da0), and holding button #13 opens the hidden Service Menu (SetTX, SetTX pin, Corr Volt, AntTuner).

Even wilder: the TX gate (0x0803dcdc) already ships with 4 factory TX profiles (Region 0..3 at 0x0803b3fc)—and Region 0 enables Band[11]: 0.5000 – 55.9900 MHz! At boot (0x08038150..0x0803837a), the firmware reads two active-low hardware strap pins (PD0 and PD2 on GPIOD 0x40020c00) as SetTX pin: if pin_code == 0, the SetTX menu is user-selectable; if pin_code == 3, Region 0 is forced at boot. As long as the 0xAA55 magic at +0 in 0x20019da0 stays intact and the hardware strap state hasn’t changed, Flash Sector 1 (0x08004000) preserves any modified band table across reboots.


SERIOUS HARDWARE & BRICKING WARNING — READ BEFORE EXPERIMENTING!

First, please note where this research currently stands: these findings have not yet reached the stage of patching final .fw firmware images or injecting new custom features into the firmware binary itself (solving the remaining 5,432-byte tail and the exact h4_checksum residual $d$ still requires a read-only bootloader dump).

Second, reckless or improper use of these undocumented commands can permanently brick your radio or destroy its RF hardware. Please be extremely careful:

  1. Never flash partial/decoded .bin files (mtrx1.31.02.decoded.bin, etc.) to your transceiver. They are strictly for static analysis and will brick the unit or be rejected by the bootloader.
  2. XS and ZS have zero safety guardrails: Writing to the wrong byte offset with XS and committing it to Flash Sector 1 with ZS000000000001; can corrupt calibration tables, VCO/ADC constants, or boot flags—potentially bricking your TX-500 beyond recovery. Always back up all 1024 bytes (XL1000;–XL2023;) before touching a single byte.
  3. PA & Harmonic Filter Danger (LPF = 7 on Band[11]): Firmware analysis (0x0803ad4e) shows that transmitting on Band[11] (0.500–55.990 MHz) selects LPF = 7 (the 50 MHz / 6m low-pass filter)! Transmitting below 50 MHz through Band[11] bypasses proper harmonic filtering, risking severe out-of-band spurious emissions and frying your PA (RD15HVF1 MOSFETs)—especially into anything other than a 50-ohm dummy load or without an external LPF.

7. Coming Soon to Lab599 Radio Utility

I’m planning to bring the safe, genuinely useful parts of these findings—such as full configuration backup/restore, deeper diagnostics, memory management, and cleaner CAT integration—into the upcoming version of Lab599 Radio Utility.

If you’re interested in this work, want to help test upcoming builds, or just want to geek out over STM32 reverse engineering and Lab599 internals, feel free to reach out and message me!

73 — EP2AES