Pangram verdict · v3.3
We believe that this text is a mix of AI, AI-assisted, and human-written content.
AI likelihood · overall
AIArticle text · 1,159 words · 34 segments analyzed
A few years ago, CUB3D demonstrated unsigned code execution on the iPod nano 6G and 7G through ipod_sun, a font-based exploit.
Whether the same approach would work on the 5G was still an open question. I wanted to get Rockbox running on the nano 5G, so I set out to adapt the exploit.
My motivation was simple: an up-to-date music player without an internet connection.
I built a fully untethered boot chain that loads Rockbox from the nano 5G’s NAND, with no computer or button sequence needed after installation.
I also found a way to make the existing exploit fully untethered on the nano 7G, and likely the 6G too.
Existing DFU exploits, including q3k’s wInd3x, provide code execution on the nano 5G, but booting custom code this way requires a computer each time. I used wInd3x to explore the device and develop a convenient, fully untethered exploit.
The firmware details below refer to the latest nano 5G firmware, 1.0.2 (34A20020).
Untethered Rockbox boot on the iPod nano 5G.
Watch on YouTube.
In this article The catch with ipod_sun Finding a bypass in the normal boot path Using emCORE to make it persistent A bootloader in less than 28 KB Taking control from the font parser Reading NAND and starting Rockbox Result and limits References The catch with ipod_sun The nano 5G’s NAND flash appears through a flash translation layer (FTL) as a logical disk with 4 KiB sectors. Its partition table separates a small private area for persistent device state, a firmware partition containing boot programs and resources, and a data volume for user files. The firmware partition has a directory of named images; the fonts live inside rsrc, a resource volume formatted as FAT16. The original ipod_sun chain combines a resource-validation bypass with a font-parser vulnerability. Apple’s firmware directory identifies the normal operating system as osos, the disk-mode program as disk, and the resource image containing fonts as rsrc. The disk-mode boot path does not request the resource signature check used by normal OS boot. Swapping the disk and osos directory entries exploits that difference: selecting disk mode now launches Apple’s regular OS under the disk-mode policy. The OS still reads its fonts, but the bootloader has not required a valid signature for the modified resource image. Disk-mode bypass · illustrative control flow, not a firmware-source excerpt// Resource-validation decision only; other image checks are omitted. if (selected_target == OSOS) { status = check_resource_policy(rsrc); if (failed(status)) return status; } // The DISK path does not request this rsrc check. return boot_image(firmware_directory[selected_target]); // With swapped entries, the DISK entry points to Apple's normal OS. The font then triggers CVE-2010-1797, the FreeType CFF stack-overflow vulnerability also known through the star exploit. A malformed font program corrupts the parser’s stack and redirects execution. My 5G port adapts that technique to the device’s font and execution context. The swapped images remain on disk, but each restart still requires choosing disk mode with the device’s buttons. A normal boot selects the other entry. I wanted a better experience, with the modified font loading through the normal OS path. Finding a bypass in the normal boot path The bootloader is organized into EFI-style modules stored as Portable Executable (PE) images.
The module that passes execution to the next boot stage decides whether to validate rsrc.
It first asks the PrivateData module for FirmwareStatus, which comes from an authenticated record in the private NAND partition.
The decisive branch is below.
This is reconstructed C from the reverse-engineered routine, with unrelated fuse handling and protocol setup omitted.
Normal boot · reconstructed resource-validation decisionstatus = private_data->get_variable( private_data, U16("FirmwareStatus"), &word); if (status != 0) return status; if (word & 0x1) return UINT32_C(0x8000000a); // Reject the boot attempt.
if (word & 0x2) return 0; // Skip rsrc signature validation. uint32_t size = sizeof(validation); // Check the rsrc signature and reject an invalid result.
status = resource->get_info( resource, BDS_GUID(BDS_VALIDATION), &size, validation); if (!BDS_ERROR(status) && validation[0] == 0) return UINT32_C(0x8000001a); return status; A value of 2 returns success before the resource-validation query.
Bit 0 must remain clear: it is checked first, so 3 would reject the boot attempt.
Tracing the restore OS shows that it sets the status to 1 during firmware transfer and clears it to 0 at the end. This suggests an update-in-progress guard that prevents booting an incomplete installation.
Apple’s resource-mount path writes status 2 only on the first successful boot, after rsrc has passed signature verification.
My hypothesis is that this avoids repeating signature verification to shorten boot time or reduce energy use.
This is the second bypass.
Instead of disguising the normal OS as disk mode, I can leave the firmware directory alone and supply a valid private record with bit 1 set.
The normal boot path then accepts the modified resource image, and its font delivers code execution automatically.
The record lives in the private partition, identified by MBR type 0x3e.
On the 5G layout I examined, the partition begins at logical block 1, with 4 KiB blocks. The bootloader reads a 512-byte header from its start.
The status-bearing format begins with the little-endian magic PRVD and has this layout: The fields needed to understand the bypass OffsetValue or purpose 0x000x44565250 (PRVD) 0x04–0x0cThree 32-bit words: 2, 0, 4 0x4032-bit FirmwareStatus; use 2 0x8016-byte device-bound integrity tag The integrity tag is device-specific, so creating and saving a valid PRVD record requires code execution on that iPod.
PrivateData reader · simplified reconstruction*firmware_status = 0; read_private_header(header); // Read-error handling omitted here.
if (is_plain_header(header)) return PD_SUCCESS; if (!is_prvd_v2(header)) return PD_UNSUPPORTED; // SHA-1 covers the first 0x80 bytes, including FirmwareStatus.
sha1(header, 0x80, digest); aes_encrypt_uid(digest, 16, expected_tag); if (!equal16(header + 0x80, expected_tag)) return PD_SECURITY_VIOLATION; *firmware_status = read_u32_le(header + 0x40); return PD_SUCCESS; The tag is the first 16 bytes of the SHA-1 digest, encrypted with the device’s hardware AES UID key, selected through key slot 2.
It authenticates the private header, but as the authentication is constructed on device we can falsify it if we have code execution.
Using emCORE to make it persistent To inspect and update the private partition, I adapted emCORE, an older framework from freemyipod’s earlier iPod exploitation and boot work.
It provided an existing USB-controlled environment to extend for the 5G. I wrote the nano 5G NAND driver and integrated it into emCORE alongside the flash translation layer (FTL) and hardware AES access. I’ll cover the flash memory sequencer subsystem (FMSS), which enables NAND writes, in a future post. The FTL presents logical sectors over physical flash; it is the layer through which I read and write the private record and install the modified font. The private-status tool verifies the existing header and tag, constructs the updated record, and obtains its new tag from the device. It rechecks the partition table and header before writing, then flushes the write and reads it back. The tool writes a complete 4 KiB logical sector even though the bootloader only consumes the smaller header.
This works on nano 5G hardware.