Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Netgear CHK

From ReverseEngineering.wiki
Format
Magic 2A 23 24 5E ("*#$^")
Extensions .chk
Endianness big
On this wiki Facts · Code · Notes · Topics

Netgear's firmware wrapper (.chk): a big-endian header starting with the bytes 2A 23 24 5E ("*#$^"), kernel/rootfs lengths and 16-bit-folded Fletcher-style checksums, a board-id string, then the kernel (often a TRX) and the root filesystem.

Header

Big-endian. Layout of struct chk_header in OpenWrt firmware-utils mkchkimg.c (lines 35-46), 40 bytes, followed by the board id string:

Offset Size Field
0x00 4 magic 0x2A23245E (bytes 2A 23 24 5E, "*#$^")
0x04 4 header_len: 40 + length of the board id
0x08 8 reserved: [0] region code (1 = WW, 2 = NA); [1..7] = version digits A..G of a name like DEVICE-VA.B.C.D_E.F.G.chk (lines 21-34); mkchkimg itself writes 99 (0x63) into bytes 1-7 (line 254)
0x10 4 kernel_chksum
0x14 4 rootfs_chksum
0x18 4 kernel_len
0x1C 4 rootfs_len
0x20 4 image_chksum: over kernel + rootfs
0x24 4 header_chksum
0x28 n board_id: ASCII, not NUL terminated, at most 64 bytes (default U12H072T00_NETGEAR)

The kernel image follows at offset header_len, then the root filesystem. In mkchkimg the "kernel" input is a TRX file (comment at line 260), so a CHK often wraps a Format:Broadcom TRX. Unverified: in that case the TRX already holds kernel and rootfs and rootfs_len is 0.

Checksum

Two running sums per byte c0 += byte; c1 += c0 (32-bit), then each is folded to 16 bits (b = (c & 0xFFFF) + (c >> 16); c = ((b >> 16) + b) & 0xFFFF) and the result is (c1 << 16) | c0 (lines 79-112). The header checksum is computed over the 40-byte header (with the header_chksum field still zero) plus the board id bytes (lines 311-316), and stored big-endian.

binwalk note

binwalk's parser (src/structures/chk.rs lines 18-29) reads the same layout big-endian but names the two length fields in the order rootfs_size, kernel_size, whereas mkchkimg writes kernel_len first (offset 0x18) then rootfs_len (0x1C). If you rely on binwalk's reported sizes, swap them; see the fact on this. It accepts header sizes up to 100 bytes and requires a non-empty board id.

Sources

openwrt/firmware-utils src/mkchkimg.c (GPL-2.0-or-later); ReFirmLabs/binwalk (MIT). See also Technique:Unpacking firmware update containers.

Code & repositories

  • https://github.com/openwrt/firmware-utils @ 0179ab1e367f756ac108a485f26585661d4c528c · license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize a license file)
    Image-building tools for router firmware: trx.c, mkchkimg.c, mktplinkfw.c, tplink-safeloader.c, seama.c/seama.h; per-file licenses (GPL-2.0-or-later, GPL-2.0-only, BSD-2-Clause, BSD-3-Clause, LGPL-2.1-or-later)
    Tested on: source read, not run: source read, not built · checked 2026-10-19; last activity 2026-10-12
  • https://github.com/ReFirmLabs/binwalk @ 26713972e3f9f52dc37d4a421c4554b0bd9e82ef · license: MIT
    binwalk 3 (Rust): signature and header parsers for TRX, CHK, SEAMA, TP-Link and other firmware formats
    Tested on: source read, not run: source read, not built · checked 2026-10-19; last activity 2026-08-11