Anti-AIClone

Log date · Thu

Does UPX packing protect your code?

UPX compresses executables; it does not provide code confidentiality. A lossless-compression comparison shows why, with release checks.

Does UPX packing protect code?

UPX packing should not be treated as code confidentiality. UPX is an executable compressor, and its own project describes testing and unpacking packed files. [4] We illustrated lossless compression with another tool: our 33,432-byte program became 1,198 and 1,002 bytes at two gzip levels. Both restored files matched the original byte for byte.

Results at a glance
QuestionFinding
Can the content be restored?Both gzip samples restored byte for byte.
How large were the variants?1,198 and 1,002 bytes.
What is UPX for?Executable compression; files can be tested and unpacked. [4]
What should a release check?Measure size, startup, function, signature and security-software results.

A compression comparison

On macOS 27.2 we compiled our own small quote program with Apple clang 21.0.0 and compressed it with Apple gzip 487.40.2 at two levels. It computes 3 × 120 − 17 and prints DEMO-QUOTE: 343. UPX was unavailable here: a gzip file is not directly runnable like a UPX-packed executable. This illustrates lossless compression; it is not a test of UPX 5.2.1, its compression ratio or compatibility.

Verbatim experiment output; sizes are bytes.
== compress at two levels ==
   33432 sample
    1198 sample-fast.gz
    1002 sample-best.gz
   35632 total
== check restored bytes and behavior ==
fast: byte-identical
fast: DEMO-QUOTE: 343
best: byte-identical
best: DEMO-QUOTE: 343

We produced the files with gzip -1 and -9, compared the restored bytes with cmp, then ran each restored program. The smaller file still contains enough information to restore the original. The difference between the levels is size, not access control. This small sample contains compressible padding, so its numbers should not be extrapolated to a release package.

UPX has a different delivery format from gzip: it targets executables, and the project describes packed programs as self-contained while providing list, test and unpack operations. [4] Changed bytes on disk do not make application logic secret. They also do not establish that UPX removes credentials, changes permissions or prevents runtime observation.

What the 5.2.1 release tells us

UPX 5.2.1 was released on 2026-08-27 at 14:01 UTC. NEWS lists bug fixes and points to milestone 24; the release page says the host builds are functionally equivalent and links security and VirusTotal information. [1][2] That does not mean every input binary and deployment environment has passed your tests.

Closed milestone items include an unpack checksum error, startup crashes for a particular linux/arm layout, random SIGSEGV in a Go binary packed with --best --lzma in a particular cloud environment, a Go PIE e_shstrtab packing error, and an off-by-one .shstrtab bounds fix. [3] These are specific reports and fixes, not evidence that every Go or ARM program fails.

Treat packing as a release-build transformation. Keep an unpacked baseline, record the tool version, options, architecture and build identity, compare the final distributed size, and exercise startup and critical flows on representative devices and environments. Repeat the checks after upgrading the packer; a successful packing command alone is not a release test.

Recommendations by goal

These are engineering recommendations, not benefits measured by our gzip comparison. First decide whether the goal is a smaller download, protection of an asset, or verification of file integrity.

Recommendations by goal
CaseRecommendation
Download size mattersCompare the final installer, not just one executable; omit packing if the saving is small.
Shared privileged secretKeep it on a server; use scoped, revocable client credentials.
Business logic must work offlineAssess exposure; compression itself is not a confidentiality boundary.
Release integritySign after transformations, verify the final file and retain the release record.

Signing and compression answer different questions. In a Windows release, finish packing before signing and verify the final file. Microsoft describes signature verification as checking for changes after signing and a trusted source. [6] Also check actual security-software results in target environments, document false positives and resolve them through the vendor’s process rather than disabling checks.

Check your own release build

For a program you are authorized to handle, keep an unpacked baseline in an isolated directory and create a candidate with the UPX version and options your project actually chose. Record both sizes and test that candidate, not just a development build. Replace the paths below; run signature verification in a Windows environment with SignTool configured.

Commands for your release; not executed here with UPX or Windows.
upx --version
upx -t path/to/packed.exe

# Windows, after packing and signing:
signtool verify /pa path\to\packed.exe

UPX documents that -t checks the part decompressed during execution, not the entire file, and is not a replacement for a virus check. [5] Run startup, critical-function and installation regression tests on the final signed artifact. Cover target architectures, operating systems, cloud environments and the compression options actually used. Record versions, hashes, results and failure logs so that a failure can be tied to the exact artifact.

When comparing size, measure the outer installer or distribution archive too. It may already compress its contents, so a smaller executable does not guarantee the same percentage reduction in download size. Use the same packaging pipeline for each candidate, retain the unpacked build as a fallback, and decide from the measured result.

Your checklist

  • Record the UPX version, options and build identity.
  • Compare the final installer size with the unpacked baseline.
  • Test startup and critical flows on target architectures and environments.
  • Sign after transformations and verify the final file.
  • Check security-software results and record any false positives.

Primary sources

All sources and reproduction status ↗