Firmware entropy analysis measures how random each region of a firmware image is, using Shannon's entropy formula, to flag which parts are encrypted, compressed or packed before any closer analysis. Plaintext code, configuration data and most filesystem metadata sit at low-to-moderate entropy; AES-encrypted blobs and already-compressed filesystems or archives sit near the theoretical ceiling of 8 bits per byte, statistically indistinguishable from true random noise.
Tools such as binwalk compute this per block of the file and graph it by offset, so a reviewer can line it up with signature matches and see in seconds which regions a binary-analysis pass can actually unpack — and which it cannot.
Key takeaways
- Firmware entropy analysis measures how random each region of a firmware image is, using Shannon's entropy formula, to flag which parts are encrypted, compressed or packed before any closer analysis.
- A firmware image is rarely one uniform blob — it's a bootloader, a kernel, one or more root filesystems, configuration data, certificates and often a vendor update mechanism, all concatenated into a single binary.
- No — and this is the single most common misreading of an entropy graph.
- Both split the input into fixed, non-overlapping blocks and calculate Shannon entropy per block; they differ in block size, scale and when they run.
Why do firmware images produce such different entropy from region to region?
A firmware image is rarely one uniform blob — it's a bootloader, a kernel, one or more root filesystems, configuration data, certificates and often a vendor update mechanism, all concatenated into a single binary. Each of those has a different statistical character. Code and text have structure: certain byte values (ASCII letters, common opcodes, null padding) repeat far more often than others, so a window of plaintext code sits well below the theoretical maximum entropy for its byte width. NIST SP 800-90B, written to formally define and validate entropy for random-number generators rather than for firmware, states the underlying mathematics plainly: "the maximum possible value for the min-entropy of a random variable with k distinct values is log2 k, which is attained when the random variable has a uniform probability distribution." For a byte stream, k is 256 possible values, so that ceiling is exactly log2(256) = 8 bits per byte — reached only when every byte value is about equally likely, which is precisely what a well-encrypted or well-compressed stream looks like, because a good cipher or compressor removes exactly the structure that would otherwise bias some byte values over others.
Does a high entropy score always mean something is encrypted?
No — and this is the single most common misreading of an entropy graph. ReFirmLabs' binwalk documentation puts the ambiguity directly: "Both compressed and encrypted data is, by nature, very random." A SquashFS partition, a gzip-compressed kernel, a JPEG splash screen and a genuinely encrypted update blob can all land in the same high-entropy band, because compression and encryption both aim to remove redundancy — one so the data takes less space, the other so an attacker can't exploit patterns. Lyda and Hamrock's widely cited 2007 IEEE Security & Privacy paper, Using Entropy Analysis to Find Encrypted and Packed Malware, demonstrated the same effect at malware-analysis scale: entropy reliably singles out packed and encrypted executables as statistical outliers against a large reference set of ordinary, unpacked code, but the entropy value by itself doesn't say which kind of outlier you're looking at. Separating "legitimate compressed filesystem" from "deliberately packed or encrypted payload" takes a second signal — a compression header or magic-byte sequence a signature scanner recognizes, or simply attempting to decompress the region and checking whether coherent structure comes out.
How do binwalk and unblob actually compute entropy?
Both split the input into fixed, non-overlapping blocks and calculate Shannon entropy per block; they differ in block size, scale and when they run.
In binwalk 3.x, -E (or --entropy) does one job and exits. The source divides the file into 2,048 equal blocks (a file under 2,048 bytes is one block), computes each block's entropy and draws a graph whose y-axis runs from "0 (not random at all) to 8 (very random)". The graph is saved as a PNG in the current directory unless --png names another file, and --log writes each block's start, end and entropy to JSON, as the JSON Analysis Results page shows. The combined binwalk -B -E signature-plus-entropy run in the older Quick Start Guide is binwalk 2.x syntax; in 3.x the signature scan is the default run, done separately.
unblob works the other way round. It extracts every chunk it recognizes, carves what it cannot identify into files named by start and end offset with a .unknown suffix, and then calculates "randomness" for those unknown files: Shannon entropy and a chi-square probability, both shown as percentages. The --entropy-depth option sets how deep that runs (default 1, the input file only; 0 turns it off), and the chart prints at verbosity level 3 (-vvv).
binwalk 3.x -E |
unblob | |
|---|---|---|
| What gets measured | The whole file | Only chunks no handler identified |
| Block size | File size ÷ 2,048 | 0x20000 bytes (128 KiB) in the guide's example |
| Scale | 0 to 8 bits per byte | 0 to 100% |
| Extra statistic | none | Chi-square probability |
| Output | PNG graph, optional JSON log | Log chart; --report JSON for the extraction |
Sources: binwalk wiki and src/entropy.rs (version 3.1.1), unblob User Guide, read 2026-11-12. Both tools are MIT-licensed.
How do you read an entropy graph?
Read it as a map of where to look, then confirm each region with a second signal:
| Pattern on the graph | Most likely content | Confirm with |
|---|---|---|
| Flat line at or near 0 | Padding: runs of 0x00, or 0xFF from erased flash | A hex view of the range |
| Low-to-moderate, jagged | Bootloader or kernel code, strings, configuration, uncompressed filesystems | strings, the signature scan |
| Near the ceiling, starting at a recognized signature | Compressed filesystem or kernel (SquashFS, UBIFS, JFFS2, gzip, LZMA, xz) | Extraction: if it unpacks, it was compression |
| Near the ceiling, no signature, very flat | Encrypted blob, or a compression or wrapper format the tool does not know | Vendor update-format docs, a header nearby, trial decompression |
| A sharp step in the middle of a region | Boundary between two components, or appended data | Compare the offset with the signature table |
The chi-square figure unblob prints is a check on how evenly bytes are spread. In the guide's own example of data copied from /dev/random, Shannon entropy sat at 99.98–99.99% across every block while the chi-square probability ranged from 3.17% to 97.88%, so expect that statistic to move around even on truly random input and read it across many blocks, not one.
How do you run an entropy pass step by step?
Run the signature scanwith binwalk firmware.binand keep the offset table.Run the entropy passwith binwalk -E --log=entropy.json firmware.bin; the PNG lands in the current directory.Extract with unblobusing unblob --report report.json firmware.bin, and note every.unknownfile and its offsets.Line up the three outputsEvery high-entropy range should match either a recognized signature that extracted cleanly or an unknown chunk. Record what stays unidentified— offset, size and entropy — as an explicit line in the SBOM review notes. Compare with a known-good imageof the same product and version, block range by block range.
What does a worked entropy reading look like?
Worked example — synthetic image and values, for illustration only. A 16 MiB router image gives binwalk 3.x blocks of 8 KiB (16 MiB ÷ 2,048).
| Offset range | Entropy | Signature scan | unblob result | Reading |
|---|---|---|---|---|
| 0x000000–0x03FFFF | low-moderate | U-Boot header | carved, identified | Bootloader code |
| 0x040000–0x23FFFF | near 8 | LZMA-compressed kernel | extracted | Compression |
| 0x240000–0xE3FFFF | near 8 | SquashFS superblock | extracted, root filesystem listed | Compression |
| 0xE40000–0xF7FFFF | near 8, very flat | none | .unknown chunk |
Unidentified; possibly an encrypted vendor partition |
| 0xF80000–0xFFFFFF | 0 | none | padding | Erased flash |
The first three rows feed the SBOM normally. The fourth becomes a recorded gap: the inventory states that 1.25 MiB could not be opened, rather than implying it holds nothing. If the previous release showed that range as low-moderate configuration data, the change itself is the finding to chase.
Why does entropy matter before an SBOM or vulnerability scan?
Entropy analysis is normally one of the first passes in a binary-analysis workflow, run before the deeper work of unpacking file systems, identifying components and matching them against known vulnerabilities — the process our firmware SBOM guide covers in more detail. A region that scores low-to-moderate entropy, with no encryption in the way, is a strong candidate for actually being unpacked, identified and carried into normal component and CVE matching. A region sitting at the entropy ceiling, with no compression signature a tool recognizes, most likely can't be unpacked further without a key nobody on the review has — the correct outcome there is to record it as an unidentified, encrypted region with a stated confidence level, not to silently drop it from the inventory or guess at its contents.
Entropy also has a second, security-specific use beyond inventory: spotting tampering. CISA, the NSA and the FBI's joint advisory on BlackTech threat actors hiding custom firmware in network edge devices recommends that defenders "periodically take snapshots of boot records and firmware and compare against known good images" specifically to catch unauthorized modification. An entropy map is a cheap way to do a coarse version of that comparison — a region that was low-entropy plaintext in a known-good baseline image and shows up high-entropy in a field image is worth investigating regardless of whether anything else about the firmware looks different, the same reasoning that applies to weak or unexpected cryptography more broadly in our weak cryptography in embedded firmware guide and to verifying what a device's secure boot and hardware root of trust actually protects. Signed and encrypted update packages, covered in the firmware OTA update security guide, are the most common legitimate reason a vendor image shows a large flat high-entropy region.
What are the common entropy-analysis pitfalls?
- Small secrets vanish in big blocks. In a 64 MiB image a binwalk 3.x block is 32 KiB, so a 256-byte key or certificate barely moves the curve; key hunting needs a
stringsand pattern search, as in our hard-coded credentials guide. - Comparing scales. binwalk reports 0–8, unblob reports percentages; convert before comparing.
- Calling every flat high region encrypted. An unknown compressor looks the same until someone recognizes its header.
- Comparing images of different sizes block by block. Block size depends on file size in binwalk 3.x, so compare offsets, not block numbers.
- Dropping unknown chunks from the record. What could not be opened is part of the result.
Where does AI help, and where does it not?
An entropy score is not an AI output. A Shannon-entropy calculation over fixed blocks is a deterministic statistic: the same firmware image produces the same numbers every time, with or without a model anywhere near the process. Where a model can help is in turning a long offset table into a short, readable summary, provided every sentence points back to an offset, a size and a value that a deterministic tool produced.
SoftWSP keeps to the same rule, and it is specific about what its firmware pipeline does. It is built on unblob extraction and syft component listing; the resulting CycloneDX 1.6 SBOM is matched against NVD, CISA KEV, FIRST EPSS and CISA CSAF ICS advisories, and an AI-drafted report cites the record behind each finding for an engineer to review. SoftWSP does not compute, graph or report entropy. A region that nothing could unpack simply contributes no components, which is why the steps above still belong in your own review before you rely on any SBOM; you can inspect the components that were found in the free SBOM viewer.
See device & firmware security services for how firmware SBOM extraction and CVE matching fit into a full review.
This guide draws on binwalk's documentation and source (ReFirmLabs, binwalk 3.1.1), the unblob User Guide, NIST SP 800-90B, Lyda and Hamrock's 2007 IEEE Security & Privacy paper on entropy analysis for malware, and CISA/NSA/FBI's joint advisory AA23-270A, read 2026-11-12.
Put this guide to work
Frequently asked questions
What does high byte entropy in a firmware image actually indicate?
Entropy here means Shannon entropy applied to raw bytes: how unpredictable each byte value is within a window of the file, on a scale that tops out at 8 bits per byte. NIST SP 800-90B — written for validating random-number-generator entropy sources, not firmware, but using the same mathematics — states the general rule directly: "the maximum possible value for the min-entropy of a random variable with k distinct values is log2 k, which is attained when the random variable has a uniform probability distribution." For a byte-valued source, k is 256, so log2(256) is exactly 8: a window hits that ceiling only when every byte value from 0–255 appears about equally often, which is what ciphertext and well-compressed data both look like, and what ordinary code, text or configuration data essentially never does on its own.
Can entropy analysis alone tell encryption apart from compression?
No. ReFirmLabs' binwalk documentation is direct about this: "Both compressed and encrypted data is, by nature, very random," so a high-entropy window can be either, and entropy analysis by itself cannot say which. Lyda and Hamrock's 2007 IEEE Security & Privacy paper, Using Entropy Analysis to Find Encrypted and Packed Malware, showed the same ambiguity at malware-analysis scale: entropy reliably flags packed and encrypted executables as statistical outliers against a reference population of ordinary code, but the number alone doesn't say which of several causes produced the outlier. Telling them apart takes a second signal — a recognizable compression header or magic byte sequence that signature scanning can match, or simply attempting to decompress the region and checking whether valid structure comes out the other side.
What tools actually compute entropy for a firmware image?
binwalk is the common one: its -E (or --entropy) option splits a file into blocks, calculates the Shannon entropy of each block, and plots the result as a graph by file offset; in binwalk 3.x that entropy pass runs on its own, so a reviewer compares it with a normal signature scan to see entropy spikes line up — or not — with whatever file-type signatures were found at the same offsets. Binwalk's Quick Start Guide notes the value of that pairing: "Entropy analysis can help identify interesting sections of data inside a firmware image" when signature matching, which depends on recognizing a known header, reports nothing.
Does a high-entropy region always mean something is hidden or malicious?
No — plenty of legitimate firmware is high-entropy by design. A SquashFS, UBIFS or JFFS2 root filesystem (see our firmware SBOM guide for how these get unpacked) is compressed and will score near the entropy ceiling, as will an embedded JPEG, a TLS certificate or a vendor-issued per-device key. High entropy is a reason to look closer, not a verdict on its own. It's also exactly the kind of change a tampering check should catch: CISA, the NSA and the FBI's joint advisory on BlackTech actors hiding in router firmware recommends that defenders "periodically take snapshots of boot records and firmware and compare against known good images" — an entropy map is one cheap, fast way to notice that a region which used to be low-entropy plaintext in a known-good image is now a high-entropy blob in the image you're reviewing.
How does entropy analysis fit into a firmware SBOM or vulnerability workflow?
As an early triage step, usually run alongside or just before unpacking. A region that scores low-to-moderate entropy is very likely something a binary-analysis pass can actually unpack and identify — code, scripts, configuration — and can proceed into normal component matching for an SBOM. A region that sits at or near the entropy ceiling, with no compression signature a tool recognizes, most likely cannot be unpacked further without a key you don't have; the correct outcome there is to record it as an unidentified, encrypted region with a stated confidence level rather than silently dropping it or guessing at its contents, the same transparency principle our firmware SBOM guide applies to binary analysis generally.
Sources
- ReFirmLabs binwalk wiki: Generating Entropy Graphs
- NIST SP 800-90B: Recommendation for the Entropy Sources Used for Random Bit Generation
- R. Lyda and J. Hamrock, "Using Entropy Analysis to Find Encrypted and Packed Malware," IEEE Security & Privacy, vol. 5, no. 2, 2007
- CISA/NSA/FBI: People's Republic of China-Linked Cyber Actors Hide in Router Firmware (AA23-270A)
- ReFirmLabs binwalk wiki: Quick Start Guide (entropy analysis)
- ReFirmLabs binwalk wiki: JSON Analysis Results (per-block entropy log)
- ReFirmLabs binwalk source: src/entropy.rs (block calculation, binwalk 3.x)
- unblob User Guide: randomness calculation and command line options
About this guide
SoftWSP Firmware Security Desk
Covers the Firmware vulnerabilities & fixes cluster: 135 guides.

In this cluster
Questions about this page?
