EZ LearnEZ Learn
Courses
EZ Board
Dashboard
All articles
Educationentropypackingstatic-analysis

Entropy Analysis

Shannon entropy as a packing and encryption detector: how to read per-section entropy values, what each range means, and why high entropy in the code section almost always means packed malware.

Ashish Revar12 May 202612 min read39 views
2 video lessons 1 EZ Byte 15:48 total
Sign in to track your progress

EZ Bytes · quick recaps

Entropy Analysis: Spotting Packed Malware

41s

Video lessons

What is Shannon Entropy?

Shannon entropy measures the randomness of data on a scale from 0 to 8:

  • 0: perfectly uniform data (a file full of identical bytes)
  • 8: perfectly random data (encrypted or compressed content)

The formula measures how unpredictable each byte is given the distribution of all bytes in the region. Structured data like English text or compiled code has patterns (repeated byte values, common sequences) giving lower entropy. Encrypted or compressed data has no patterns, approaching maximum entropy.

Entropy Ranges and Their Meaning

Entropy RangeContent TypeVerdict
0.0: 1.0Null bytes, repeated patternsPadding or sparse data
1.0: 5.0Text, configuration dataNormal uncompressed content
5.0: 6.5Compiled native code, data sectionsNormal for most PE sections
6.5 (7.0Borderline) investigate furtherMay indicate light compression
7.0: 8.0Encrypted or compressed contentAlmost certainly packed

Rule of thumb: entropy above 7.0 in the .text section means the code is packed. Stop static analysis and unpack first.

Where to Check Entropy

PEStudio: displays per-section entropy in the Sections tab. High entropy sections are highlighted automatically.

Detect It Easy (DIE): shows per-section entropy as a bar graph alongside packer detection. The visual makes it immediately obvious which sections are suspicious.

CFF Explorer: shows raw entropy values for each section in the Section Headers view.

Reading Per-Section Entropy

Not all high-entropy sections are equally suspicious. Context matters:

SectionHigh Entropy Meaning
.textAlmost certainly packed or encrypted. Code should not be random.
.dataSuspicious: may contain encrypted configuration or embedded payload.
.rsrcLess alarming: legitimate applications store compressed images in resources.
.rdataSuspicious: read-only data should not be encrypted in a normal binary.
Custom name (.UPX1, .packed)Confirmed packer section: proceed to unpacking.

The VirtualSize vs SizeOfRawData Trick

Packers reserve empty memory that the unpacking stub fills at runtime:

Section header shows:
  VirtualSize    = 0x00050000  (320 KB reserved in memory)
  SizeOfRawData  = 0x00000200  (512 bytes on disk)

The section is almost empty on disk but large in memory. The stub decompresses the packed code into this reserved space during execution. This is a reliable packer indicator even when entropy alone is ambiguous.

Entropy in Practice: Two Examples

Example 1: Normal executable

Section   Entropy
.text     5.82     ← Compiled code, normal
.rdata    4.21     ← Read-only data, normal
.data     3.15     ← Variables, normal
.rsrc     5.44     ← Resources, normal

No action needed: entropy is consistent with a clean, uncompressed binary.

Example 2: UPX-packed malware

Section   Entropy
UPX0      0.00     ← Empty on disk (VirtualSize >> SizeOfRawData)
UPX1      7.84     ← Packed payload, near-maximum entropy
UPX2      5.21     ← Unpacking stub

Immediate action: detect packer with DIE, unpack with upx -d or manually via ESP breakpoint technique (covered in Unit 5).

Entropy Is Not Proof

High entropy in .text is strong evidence of packing, but not proof of malice. Legitimate software uses packers for license protection (Themida, VMProtect on commercial applications) and compression (Installer packages). Always combine entropy analysis with other indicators: import table size, section names, string content, and behavioural analysis.

Refer to REMA eBook 2026, Figure 2.11 for the entropy comparison visualisation showing structured code vs packed data side by side.

Assessments

Unit Assessment

Fundamentals of Malware Analysis

20 questions30 minPass: 60%

Start exam →

Comprehensive Assessment

REMA: Complete Assessment

120 questions90 minPass: 60%

Start final exam →

Practice

Lock it in with a game

Ungraded practice for this topic. Clearing a game or lab for the first time earns EZ Board points when you are signed in.

Lab

PE Autopsy: Triage a Real Signed Windows Binary

15 tasks from this unit. Free to play. Earn 30 EZ Board points on your first clear.

Play

Lab

Packed and Unpacked: Defeat a Packer

13 tasks from this unit. Free to play. Earn 30 EZ Board points on your first clear.

Play

Crossword

Fundamentals of Malware Analysis

11 key terms from this unit. Free to play.

Play Leaderboard

Race

PE Pass

6 checkpoints from this unit. Free to play. Earn 30 EZ Board points on your first clear.

Play

Related to this topic

Continue learning

Listen

Malware Blueprints in Portable Executable Headers

A deep dive into the Portable Executable (PE) structure used by Windows binaries — how analysts decode executable metadata to uncover malicious intent, compiler behaviour, packing indicators, and execution flow.

Reference material

eBook

REMA — eBook

v1.0

Open resource

Cheatsheet

REMA — Cheatsheet

v1.0

Open resource

MCQ Bank

REMA — MCQ Bank

v1.0

Open resource

Question Bank

REMA — Question Bank

v1.0

Open resource

External references

PEStudio — PE Static Analysis Tool

Free PE analysis tool that displays per-section entropy, imports, strings, and indicators. Install in your analysis VM.

tool
Detect-It-Easy (DIE) — Packer and Compiler Identifier

Free tool that identifies packers, compilers, and protectors by signature matching. Displays entropy graphs per section.

tool
REMA eBook 2026 — Chapter 2, Entropy Analysis

Read the full entropy comparison figures and packing indicators table in the REMA eBook.

ebook

Discussion

Loading comments…
More articlesTest your knowledge
EZ MentorAI · Free

Entropy Analysis

Hi! I'm EZ Mentor

Your AI tutor for
Entropy Analysis

Sign in to ask, it's free.

EZ Mentor is AI-powered · Answers may not be perfect · 10 free questions / day

EZ LearnEZ Learn

Structured learning across Reverse Engineering, Cloud Security, and Research Methodology, plus games and practice tools in EZ Arena. Free, and open to anyone.

EZ Learn

  • Courses
  • EZ Articles
  • EZ Watch
  • EZ Talks
  • EZ Bytes
  • Cyber Hygiene

EZ Library

  • All Resources
  • eBooks & PDFs
  • Question Banks
  • MCQ Banks
  • Cheatsheets

EZ Exams

  • All Exams
  • REMA
  • Cloud Security
  • Research Methodology
  • Python for Cyber Security
  • Cyber Law & IPR
  • Community
  • EZ Board

EZ Arena

  • EZ Games
  • Live Quiz
  • ML Challenges
  • दिशा - Hygiene
  • सजग - Awareness
  • अभ्यास - Practice

Platform

  • About
  • Contact
  • Terms of Use
  • Disclaimer
  • Verify Certificate
  • Events

© 2026 EZ Learn by EpochZero. Educational content for learning purposes.

Platform Lead: Ashish Revar