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

Format:AppImage

From ReverseEngineering.wiki
Format
Magic 7F 45 4C 46 (ELF) and 41 49 02 at offset 8
Extensions .AppImage
License MIT (type2-runtime)
On this wiki Facts · Code · Notes · Topics

Linux single-file application bundle: a small static ELF runtime with the bytes 41 49 02 ("AI" 02, type 2) at file offset 8, followed by an appended SquashFS image that the runtime mounts with FUSE or extracts.

Identification

An AppImage is an ELF executable with a filesystem image appended (AppImageSpec draft: it MUST be a valid ELF and MUST have a filesystem appended that the ELF part can mount). Type 2 images carry the bytes 41 49 02 ("AI", 0x02) at file offset 8, inside the ELF e_ident padding. In AppImage/type2-runtime (commit 8f39b89e2a) this is done in two places: scripts/build-runtime.sh writes echo -ne 'AI\x02' | dd ... seek=8 after strip/objcopy, and src/runtime/data_sections.ld also defines a .appimage section holding BYTE 0x41, 0x49, 0x02 aligned to 0x400. A second marker, .static (the ASCII static), is described there as an undocumented marker for runtimes supporting TARGET_APPIMAGE.

Type 1 images are ISO 9660 files with Rock Ridge extensions (zisofs compression recommended) that are also valid ELF executables, and SHOULD contain 41 49 01 at offset 8; they MAY keep update information in the ISO Volume Descriptor field at offset 33651 (AppImageSpec draft.md, Type 1 image format, lines 109-123). Type 2 MUST contain 41 49 02 at offset 8 (line 137).

Reserved ELF sections

The linker script adds zero-filled sections the packaging tools later fill: .digest_md5 (16 bytes), .upd_info (1024 bytes, update information), .sha256_sig (1024 bytes, signature of the SHA-256 of the file with this section zeroed, per the spec) and .sig_key (8192 bytes, public key). They are placed after .data (the magic section after .interp).

Update information stored in .upd_info is one transport per image, fields separated by | (AppImageSpec draft.md lines 177-250): zsync|<URL of the .zsync file>; gh-releases-zsync|<user>|<repo>|<tag, e.g. latest>|<file pattern with * wildcard>; pling-v1-zsync|<product id>|<file pattern>. A set .sha256_sig holds a signature of the SHA-256 of the whole AppImage computed with that section filled with zero bytes (line 136), so recompute the hash with the section zeroed before comparing.

Finding the payload

The runtime computes the offset of the appended SquashFS as the end of the ELF file: section header table offset (e_shoff) plus section header size times count, i.e. the end of the last section header (runtime.c, appimage_get_elf_size). It then mounts with a squashfuse-style offset= option. Command-line options of the runtime (they work on any type-2 AppImage): --appimage-offset prints the byte offset of the SquashFS, --appimage-extract [pattern] extracts, --appimage-extract-and-run extracts to a temp directory and runs; env APPIMAGE_EXTRACT_AND_RUN does the same.

To analyze without running anything: read e_shoff, e_shentsize, e_shnum from the ELF header, compute the end of the section header table, and look for the SquashFS magic hsqs (Format:SquashFS) there; then unsquashfs -o <offset> file.AppImage. Inside, AppRun is the entry script or binary, plus a .desktop file and an icon at the root, and usr/bin, usr/lib.

Sources

AppImage/type2-runtime (MIT) and AppImage/AppImageSpec draft.md, read in a clone.

Code & repositories

  • https://github.com/AppImage/type2-runtime @ 8f39b89e2ac31e1640b3d3f7e9a5108e6ce805fa · license: MIT (read from LICENSE; GitHub's detector did not classify it)
    Runtime of type 2 AppImages: magic bytes, reserved ELF sections, --appimage-offset and extract options
    Tested on: source read, not run: not run, source read · checked 2026-10-18; last activity 2026-10-15
  • https://github.com/AppImage/AppImageSpec @ 5220f3e9da0b6368da23105f80b0aff02c66af87 · license: MIT (declared by the contributor for the files used; GitHub reports MIT (read from LICENSE; GitHub's API was busy) for the repository)
    AppImage specification draft: type 1 and 2 image formats, update information
    Tested on: source read, not run: documentation read, not run · checked 2026-10-19