Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Why entropy can't see XOR-obfuscated code (and what to measure instead)

Most packer and obfuscation detectors threshold on Shannon entropy. Above ~7.0 means "compressed or encrypted", below means "probably fine". That heuristic has a blind spot big enough to drive a truck through, and it is the most common obfuscation there is. The measurement that doesn't move XOR is a bijection. It maps each byte value to exactly one other byte value, one-to-one. Shannon entropy is…

Traditional packer and obfuscation detectors assess entropy levels to determine if code is compressed or encrypted. The common heuristic considers entropy values above ~7.0 as "compressed or encrypted," while lower values suggest normal code. However, this approach has a significant blind spot: it fails to detect XOR-obfuscated code.

The more reliable metric that doesn't fail to identify XOR-obfuscation is a bijection, which maps each byte value to exactly one other byte value, preserving byte frequencies and entropy. Shannon entropy is calculated based on byte frequencies, and a bijection does not alter the counts, meaning XOR-encrypted data retains the same entropy as the original code.

This property holds true for any key k, making it an exact identity rather than an approximation. Measurements of entropy and disassembly coverage reveal that XOR-obfuscated code has the same entropy as original code, but the decoder cannot form valid instructions, resulting in a coverage of 0.00%. A simple detector measuring coverage (by counting valid instruction bytes) can identify undecodable code due to XOR-obfuscation without needing any key, unpacking, or execution.

Once the tool measures coverage, recovering a single-byte XOR key becomes straightforward - trying all 255 possibilities and keeping the one that produces a valid decoder. In practice, applying this technique to a real DLL restored the file to its original state, with SHA256 and SSDEEP verification confirming the authenticity. Initial tests on established PE packer detectors, entropystrip and packerscope, showed no difference in the output between original and XOR-obfuscated files, highlighting the limitations of entropy-based detection methods.

However, the proposed solution addresses the issue by measuring code decoding capability rather than relying solely on entropy. This approach is not foolproof - it does not cover multi-byte XOR, block ciphers, virtualized code or malicious obfuscation, as the key search does not scale. The detector also emphasizes that failing to load a file due to reasons other than single-byte XOR, such as broken import tables or missing dependencies, will result in normal coverage readings and a false negative result.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

A Better Way to Model Color Filters in Shopify: Options, Metafields, and Metaobjects

Hey everyone! One interesting challenge when working with large Shopify catalogs is keeping product data consistent. Let's take color filtering as an example.

  • Product options ideal when customers select product variants like size or material.
  • Metafields extend resources with structured data, e.g., custom.maincolor for color.
  • Metaobjects create reusable color values for consistent data across products.

Enforce SQL Formatting with pre-commit and GitHub Actions

SQL style drift rarely comes from one bad decision. It comes from a hundred small ones: one developer's editor inserts two spaces after SELECT , another aligns joins differently, and a third commits a…

  • Consistent SQL formatting crucial for code quality
  • SQLFluff, pre-commit, and GitHub Actions solution
  • Format failures separated from lint failures

How to write a freelance proposal that gets accepted (template included)

Most freelance proposals do not get rejected because the price was too high. They get rejected because the client could not tell what they were getting, or because the scope was vague enough that they…

  • Reiterate client's requirements using their exact terminology
  • List distinct deliverables with clear exclusions
  • Include timeline, precise pricing, and single next step

Framer Animations: A Practical Guide for Real Sites

Originally published on pzhydkykh.com . Framer animations can make a site feel premium - or make the site feel like a toy.

  • Framer animations set site tone but require restraint
  • Use transform and opacity changes for premium motion
  • Layer micro-interactions, hero entrances, and scroll reveals

More from Sunday, 29 November 2026 →