Technique:DOS executable packers and extenders
| On this wiki | Facts · Code · Notes · Topics |
|---|
How to tell what a DOS .EXE is before loading it into a disassembler: plain MZ, packed (EXEPACK, LZEXE, PKLITE, DIET and others), an extender stub (DOS/4GW, DJGPP, Phar Lap) or a self-extracting archive, using the header fields and entry-point bytes that open unpackers rely on.
Order of checks
- Read the MZ header (Format:DOS MZ executable) and compute the image size; anything after it is an overlay (appended data, or a New/Linear Executable if e_lfanew at 0x3C points to NE, LE, LX or PE).
- If a dword at 0x3C points to
LE/LX, the file is a 32-bit extender program (Format:LE and LX (Linear Executable)); if it starts a COFF header after the MZ image it is Tool:DJGPP;P3/MP/MQsignatures mean Phar Lap (Format:Phar Lap executables). - Look at the entry point CS:IP and the relocation count: the packers below leave tell-tale values.
| Packer | Indicators |
|---|---|
| Format:EXEPACK | no MZ relocations, IP 16/18/20, RB just before the entry point
|
| Format:LZEXE | known decoder bytes at the entry point; LZ91 at MZ offset 28 in ARJ SFX
|
| Format:PKLITE | version word at MZ offset 28, IP 0x100 and CS -16 |
| DIET | CS 0, IP 0 or 3, at most one relocation, the byte pattern 8E DB 8E C0 33 F6 33 FF B9 08 00 F3 A5 4B 48 4A at entry+20, +40 or +45
|
| WWPACK | no relocations, DOS code starts at 32, entry differs from it, entry bytes B8 ?? ?? 8C CA 03 D0 8C C9 81 C1
|
| COMPACK | no relocations, DOS code starts at 32 and the entry point is at it, bytes BD ?? ?? 50 06 8C CB 03 DD 8C D2 4B 8E DB BE
|
| RNC PROPACK | entry bytes 8C D3 8E C3 8C CA 8E DA 8B 0E 08 00 8B F1 83 EE, optionally after a 0E
|
All patterns are the ones deark's detection code uses (fmtutil-exe.c); ?? matches any byte.
Unpacking
Open tools: deark (modules exepack, lzexe, pklite, diet, mscompress), UNP and similar. A debugger run to the final far jump also works; Unverified: this is the generic technique and was not tested here. Self-extracting archives (ARJ, LHARK, ARC, ZIP, Zoo) keep their payload in the overlay behind the MZ image, which is why the overlay position matters.
See also Technique:Executable packing.
Code & repositories
- https://github.com/jsummers/deark @
8997059c4f32af79978fb6c83be7c1c26c259afa· license: MIT (declared by the contributor for the files used; GitHub reports MIT (read from COPYING; GitHub's API was busy) for the repository)
Deark (MIT): modules exepack, lzexe, pklite, diet, mscompress and the shared EXE detection in src/fmtutil-exe.c are the most complete open documentation of DOS packer recognition, MZ size computation and header layouts.
Tested on: source read, not run: Read the cited files at this commit; nothing built or run. · checked 2026-10-19