Extracting RAR Firmware Images Using Unrar
Yes, unrar can be used to extract firmware images packed
in RAR format because it functions as an archive decompression tool
regardless of the payload inside. This article covers how to extract
RAR-compressed firmware files using unrar, the core
commands needed for the process, and the distinction between unpacking
the RAR archive and extracting the underlying firmware filesystem.
How Unrar Handles Firmware Files
Hardware manufacturers and developers often compress raw firmware
files—such as .bin, .img, or .hex
files—into RAR archives to reduce file sizes for distribution.
The unrar utility operates strictly at the archive
container layer. It does not inspect or modify the firmware itself;
instead, it decompresses the archive and extracts the binary image onto
your file system in its original form.
Commands to Extract Firmware
To extract a RAR-compressed firmware file on Linux, macOS, or Windows via the command line, use the following commands:
Extract with Original Directory Structure
To retain any internal directory hierarchy preserved within the
archive, use the x (extract with full paths) command:
unrar x firmware_package.rarExtract to a Specific Directory
To prevent cluttering your current working directory, specify a target destination folder at the end of the command:
unrar x firmware_package.rar /path/to/destination/Extract Flattened Files
If you want to dump all files directly into the current directory
without creating nested folders, use the e switch:
unrar e firmware_package.rarHandling Split and Password-Protected Firmware
Firmware archives distributed across forums or mirrored repositories may come split into multiple parts or protected with a password:
- Split Archives: Ensure all parts (e.g.,
firmware.part1.rar,firmware.part2.rar) reside in the same directory. Runningunrar x firmware.part1.rarautomatically detects and extracts subsequent volumes. - Password Protection: If the vendor or distributor
encrypted the archive, specify the password flag:
unrar x -p[password] firmware_package.rar
Decompressing the Archive vs. Unpacking the Firmware
While unrar successfully extracts the outer
.bin or .img firmware file, it cannot
decompress the contents inside the firmware image itself.
Firmware files typically contain proprietary bootloaders, kernel
images, and embedded file systems (such as SquashFS, JFFS2, or UBIFS).
To extract and analyze the components inside the extracted binary image,
specialized reverse-engineering tools like Binwalk or
firmware modification kits must be used after unrar
finishes extracting the container.