UPX

{{Short description|Executable packer software}}

{{for|the rail link service with the reporting mark UPX|Union Pearson Express}}

{{primary sources|date=February 2015}}

{{infobox software

| name =

| logo = frameless

| screenshot =

| caption =

| collapsible =

| author =

| developer =

| released = {{Start date and age|1998|05|26}}

| latest release version = 5.0.1

| latest release date = {{Start date and age|2025|05|06}}

| latest preview version =

| latest preview date =

| programming language = C++, Assembly

| operating system = Microsoft Windows, Linux, macOS, DOS, Atari TOS

| platform = i386, MIPS, AMD64, ARM, PowerPC, m68k

| language = English

| genre = Executable compression

| license = GPL with exception for compressed executables,{{Cite web|url=https://upx.github.io/upx-license.html|title=UPX License Agreement|access-date=2016-09-14|archive-date=2016-03-12|archive-url=https://web.archive.org/web/20160312122415/http://upx.sourceforge.net/upx-license.html|url-status=live}} proprietary for compression algorithm in binary distributions

| website = {{url|upx.github.io}}

}}

UPX (Ultimate Packer for eXecutables) is a free and open source executable packer supporting a number of file formats from different operating systems.{{cite book

| title = Windows Malware Analysis Essentials

| last = Marak

| first = Victor

| page = 188

| isbn = 978-1-78528-151-8

| publisher = Packt Publishing

| date = 2015

| url = https://books.google.com/books?id=4-F5CgAAQBAJ&q=Ultimate+Packer+for+Executables&pg=PA188

| quote = Packers such as Ultimate Packer for Executables (UPX) are more of executable compressors as size reduction is the primary goal, not obfuscation, which can be a byproduct ...

| access-date = November 22, 2015

| archive-date = May 14, 2022

| archive-url = https://web.archive.org/web/20220514090514/https://books.google.com/books?id=4-F5CgAAQBAJ&q=Ultimate+Packer+for+Executables&pg=PA188

| url-status = live

}}{{cite book

| title = The Rootkit Arsenal

| edition = Second

| last = Blunden

| first = Bill

| pages = 353–355

| isbn = 978-1-4496-2636-5

| publisher = Jones & Bartlett Learning

| date = 2013

| url = https://books.google.com/books?id=GAsuwHTquhEC&q=Ultimate+Packer+for+Executables&pg=PA780

| quote = One of the most prolific executable packers is UPX (the Ultimate Packer for executables). Not only does it handle dozens of different executable formats, but also its source code is available online.

| access-date = November 22, 2015

| archive-date = May 14, 2022

| archive-url = https://web.archive.org/web/20220514090514/https://books.google.com/books?id=GAsuwHTquhEC&q=Ultimate+Packer+for+Executables&pg=PA780

| url-status = live

}}

Compression

UPX uses a data compression algorithm called UCL,{{cite web|author=Markus Oberhumer|title=UCL data compression library|url=https://www.oberhumer.com/opensource/ucl/|website=oberhumer.com|access-date=2022-01-11|archive-date=2024-06-28|archive-url=https://web.archive.org/web/20240628163818/https://www.oberhumer.com/opensource/ucl/|url-status=live}} which is an open-source implementation of portions of the proprietary NRV (Not Really Vanished){{cite web|author=Markus Oberhumer|title=NRV Compression Library|url=https://www.oberhumer.com/products/nrv/|archive-url=https://archive.today/20120909151357/http://www.oberhumer.com/products/nrv/|archive-date=September 9, 2012}} algorithm.{{cite web|title=The UPX Hacker's Guide|url=https://github.com/upx/upx/blob/master/README.SRC|website=GitHub|date=19 February 2022|access-date=14 September 2016|archive-date=14 May 2022|archive-url=https://web.archive.org/web/20220514090514/https://github.com/upx/upx/blob/master/README.SRC|url-status=live}}

UCL has been designed to be simple enough that a decompressor can be implemented in just a few hundred bytes of code. UCL requires no additional memory to be allocated for decompression, a considerable advantage that means that a UPX packed executable usually requires no additional memory.

UPX (since 2.90 beta) can use LZMA on most platforms; however, this is disabled by default for 16-bit due to slow decompression speed on older computers (use --lzma to force it on).

Starting with version 3.91, UPX also supports 64-Bit (x64) PE files on the Windows platform.{{Cite web |url=https://upx.github.io/upx-news.txt |title=UPX News |access-date=2016-09-14 |archive-date=2018-01-04 |archive-url=https://web.archive.org/web/20180104064454/https://upx.github.io/upx-news.txt |url-status=live }} This feature is currently declared as experimental.

Decompression

UPX supports two mechanisms for decompression: an in-place technique and extraction to temporary file.

The in-place technique, which decompresses the executable into memory, is not possible on all supported platforms. It has the advantage of being more efficient in terms of memory, and that the environment set up by the OS remains correct.

The rest uses extraction to temporary file. This procedure involves additional overhead and other disadvantages; however, it allows any executable file format to be packed. The extraction to temporary file method has several disadvantages:

  • Special permissions are ignored, such as suid.
  • argv[0] will not be meaningful.
  • Multiple running instances of the executable are unable to share common segments.

Unmodified UPX packing is often detected and unpacked by antivirus software scanners. UPX also has a built-in feature for unpacking unmodified executables packed with itself.

Supported formats

UPX supports the following formats:{{man|1|upx|ManKier}}

UPX does not currently support PE files containing CIL code intended to run on the .NET Framework.

Notes

{{Reflist|group="nb"|refs=

The facility to compress DOS .COM-style files can be utilized also to compress other binary executable files. Some FreeDOS and EDR-DOS kernel files are known to be UPX-compressible this way.

The facility to compress DOS .COM-style files can be utilized also to compress non-executable binary data files, if the driver/application using these files has been enhanced to detect UPX-compressed files and jump to the decompressor embedded in the file. FreeDOS is known to utilize this for .CPX files, UPX-compressed .CPI font files.

For the DOS targets, UPX supports a special option -8086 in order to force the embedded decompressor to become compatible with 8088/8086 processors, so that the compressed files can be executed and decompressed even on the earliest PCs running DOS.

}}

References

{{reflist}}