Skip to content

Binwalk

65 commands

Analyses and extracts firmware images: finds embedded file systems, compressed data and executable code by signature and entropy.

  • firmware
  • reverse engineering
  • extraction

Install Binwalk

sudo apt install binwalk

Basic Syntax1

binwalk --help

Displays the main help menu listing all available options and flags

Basic Firmware Analysis2

binwalk firmware.bin

Performs a default signature scan to identify embedded file types and offsets

binwalk -B firmware.bin

Explicitly enables the standard signature analysis scan mode

Signature Scanning5

binwalk -b firmware.bin

Runs a dumb scan that ignores smart signature keywords for broader matching

binwalk -I firmware.bin

Shows all scan results including those marked as invalid by the magic definitions

binwalk -m ./magic.mgc firmware.bin

Uses a custom magic signature file instead of the default system signatures

Link
binwalk -R "\x1f\x8b\x08" firmware.bin

Scans the file for a specific raw byte sequence

binwalk -R "Copyright" firmware.bin

Scans the file for a specific ASCII string occurrence

Entropy Analysis4

binwalk -E firmware.bin

Calculates and displays the entropy of the file to identify compressed or encrypted data

binwalk -E -N firmware.bin

Calculates entropy but suppresses the generation of the entropy graph plot

Link
binwalk -E -J firmware.bin

Calculates entropy and saves the resulting graph as a PNG image

Link
binwalk -E -Q firmware.bin

Calculates entropy and omits the legend from the generated graph

Link

Filtering Results3

binwalk -y "filesystem" firmware.bin

Filters output to only show results containing the string filesystem

Link
binwalk -y "filesystem" -y "copyright" firmware.bin

Filters output to show results matching either filesystem or copyright

Link
binwalk -x "invalid" firmware.bin

Filters output to exclude any results containing the string invalid

Link

Extraction Workflows5

binwalk -e firmware.bin

Automatically extracts known file types found during the signature scan

Link
binwalk -D "png image:png" firmware.bin

Extracts files matching the png image signature and saves them with a png extension

Link
binwalk -D "gzip compressed data:gz:gunzip %e" firmware.bin

Extracts gzip data, saves with gz extension, and runs gunzip on the extracted file

Link
binwalk -e -r firmware.bin

Extracts known files and deletes the carved files after successful extraction

Link
binwalk -e -z firmware.bin

Carves data based on signatures but does not execute external extraction utilities

Link

Recursive Analysis3

binwalk -M -e firmware.bin

Recursively scans and extracts contents (Matryoshka mode) from extracted files

Link
binwalk -M -e -d 4 firmware.bin

Recursively extracts files but limits the recursion depth to 4 levels

Link
binwalk -M -e -C ./output_dir firmware.bin

Recursively extracts contents into a specific custom directory

Link

Extraction Limits2

binwalk -e -j 1048576 firmware.bin

Extracts files but limits the size of each extracted file to 1MB

Link
binwalk -e -n 50 firmware.bin

Extracts files but stops after extracting 50 files

Link

Opcode Analysis2

binwalk -A firmware.bin

Scans the file for common executable opcode signatures to identify CPU architecture

Link
binwalk -A -y "MIPS" firmware.bin

Scans for opcodes and filters results to only show MIPS architecture matches

Link

Output & Logging6

binwalk -f scan.log firmware.bin

Logs the scan results to a specified text file

Link
binwalk --csv firmware.bin

Formats the scan output as CSV for easy importing into spreadsheets

Link
binwalk --csv -f results.csv firmware.bin

Generates CSV formatted output and saves it directly to a file

Link
binwalk -t firmware.bin

Formats the output nicely to fit the current terminal window width

Link
binwalk -q firmware.bin

Runs the scan quietly, suppressing standard output unless errors occur

Link
binwalk -v firmware.bin

Enables verbose logging to display internal tool processing details

Link

Data Manipulation4

binwalk -l 1024 firmware.bin

Scans only the first 1024 bytes of the input file

Link
binwalk -o 4096 firmware.bin

Starts the scan at offset 4096, skipping the beginning of the file

Link
binwalk -O 0x800000 firmware.bin

Sets a custom base address for the scan, useful for memory dumps

Link
binwalk -g 2 firmware.bin

Reverses every 2 bytes before scanning, useful for endianness swaps

Link

Binary Diffing4

binwalk -W firmware1.bin firmware2.bin

Performs a hexdump comparison between two or more files

Link
binwalk -W -G firmware1.bin firmware2.bin

Diffs files and only shows lines where bytes are identical (Green mode)

Link
binwalk -W -i firmware1.bin firmware2.bin

Diffs files and only shows lines where bytes differ among all files (Red mode)

Link
binwalk -W -U firmware1.bin firmware2.bin

Diffs files and only shows lines where bytes differ among some files (Blue mode)

Link

Incident Response2

binwalk -E -B firmware.bin

Combines entropy analysis with signature scanning to correlate high entropy areas

Link
binwalk -e --disable-plugin=lzma firmware.bin

Extracts firmware while disabling the LZMA plugin to prevent false positives

Link

Malware Detection1

binwalk -A -l 5000 firmware.bin

Checks the bootloader area (first 5000 bytes) for executable code signatures

Link

Blue Team Validation2

binwalk -y "private key" firmware.bin

Specifically scans for potential embedded private key certificates

Link
binwalk -R "\x7fELF" firmware.bin

Validates the presence of ELF binaries using raw hex signatures

Link

Forensics Reporting1

binwalk -B -f report.txt --csv firmware.bin

Generates a standard signature scan report in CSV format for external processing

Link

Advanced Workflow5

binwalk -Me -f analysis.log firmware.bin

Performs full recursive extraction and logs all findings to a file

Link
binwalk -B -e -p firmware.bin

Scans and extracts files while explicitly disabling plugins for raw handling

Link
binwalk -y "filesystem" -e firmware.bin

Extracts only the identified filesystem components, ignoring other artifacts

Link
binwalk -E -o 1000 -l 2000 firmware.bin

Analyzes entropy for a specific middle chunk of the firmware image

Link
binwalk -M -e -r --directory=investigation firmware.bin

Clean recursive extraction into a named folder, deleting carved archives after expansion

Link

Defensive Validation1

binwalk --status firmware.bin

Shows the memory usage and running status of the scan (if supported by version)

Link

Advanced Carving1

binwalk -D "jpeg:jpg" firmware.bin

Carves all JPEG files found in the binary without executing any helper scripts

Link

Automation1

binwalk -q -e firmware.bin

Runs extraction in quiet mode for use in automated pipelines or scripts

Link

Plugin Management2

binwalk --enable-plugin=zlib firmware.bin

Explicitly enables the zlib scanning plugin

Link
binwalk --list-plugins

Lists all available binwalk scan plugins

Link

Visual Analysis1

binwalk -3 firmware.bin

Enables 3D visualization of the entropy plot (requires pyqtgraph)

Link

Signature Debugging1

binwalk -B -v firmware.bin

Runs a signature scan with verbose output to debug false positive signatures

Link

Complex Extraction1

binwalk -D "uimage header:uimage" -D "gzip:gz:gunzip %e" firmware.bin

Defines multiple custom extraction rules for uImage headers and gzip data simultaneously

Link

Offset Analysis1

binwalk -y "squashfs" -t firmware.bin

Locates SquashFS offsets and formats the output for easy reading

Link

Reverse Engineering1

binwalk -A -O 0x400000 firmware.bin

Scans for opcodes assuming the firmware is loaded at memory address 0x400000

Link

Forensics cleanup1

binwalk --rm firmware.bin

Scans and cleans up zero-size files generated during extraction attempts

Link

Math Analysis1

binwalk -E -K 1024 firmware.bin

Performs entropy analysis using a custom block size of 1024 bytes

Link

System Info1

binwalk --examples

Displays built-in usage examples and common command patterns

Link