Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Technique:Identifying Linux and macOS package containers

From ReverseEngineering.wiki
Technique
On this wiki Facts · Code · Notes · Topics

Lookup table from the first bytes of a Linux or macOS software download (deb, rpm, AppImage, Snap, Flatpak, dmg, flat pkg) to the container and the steps that reach the binaries inside.

Magic table

Bytes Where Container Next step
21 3C 61 72 63 68 3E 0A 0 Format:Ar archive; with a first member debian-binary it is a Format:Debian package list members, unpack data.tar.*
ED AB EE DB 0 Format:RPM package skip lead, signature and header, unpack the cpio payload
7F 45 4C 46 and 41 49 02 0 and 8 Format:AppImage find the SquashFS after the ELF section headers
68 73 71 73 (hsqs) 0 Format:SquashFS. a .snap file is a bare SquashFS image (snapd checks only for hsqs) with meta/snap.yaml inside, see Format:Snap package unsquashfs
78 61 72 21 0 Format:XAR archive (macOS flat .pkg) extract, then Payload (gzip cpio)
6B 6F 6C 79 file size minus 512 Format:Apple Disk Image (UDIF) read the plist, join blkx runs, mount HFS+

Notes

  • Flatpak applications normally live in an OSTree repository; a single-file .flatpak bundle has no magic and is a GVariant of the OSTree static delta superblock type, see Format:Flatpak bundle. Unverified: the app is under files/ and runtime libraries in separate runtimes. Search the repository of the app for files/bin/.
  • The compression inside deb, rpm and Snap is identified by the member magic: gzip 1F 8B, xz FD 37 7A 58 5A 00, zstd 28 B5 2F FD, bzip2 BZh.
  • The binaries inside are ELF on Linux (Format:ELF (Executable and Linkable Format)) and Format:Mach-O on macOS.