From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "magic" |
|---|
| subject | "Format:ELF (Executable and Linkable Format)" |
|---|
| claim | "Every ELF file starts with the 16-byte e_ident: 7F 45 4C 46 ("\x7fELF"), EI_CLASS at 4 (1 = ELFCLASS32, 2 = ELFCLASS64), EI_DATA at 5 (1 = little endian, 2 = big endian, which every later multi-byte field follows), EI_VERSION at 6 (1), EI_OSABI at 7, EI_ABIVERSION at 8, then 7 zero bytes. A 64-bit little-endian file starts 7F 45 4C 46 02 01 01." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:ELF (Executable and Linkable Format)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | bytes | "7F 45 4C 46" |
|---|
| offset | "0" |
|---|
| meaning | "ELF file; bytes 4 (class), 5 (byte order) and 6 (version 1) follow, then OS ABI and ABI version" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "Elf_Ehdr.e_ident: Array(4, EI_MAG), EI_CLASS, EI_DATA, EI_VERSION, EI_OSABI, EI_ABIVERSION, Padding(7)" |
|---|
| repo | "https://github.com/eliben/pyelftools" |
|---|
| commit | "5a04389392e25d8128e1acb59828a0a85be791b1" |
|---|
| path | "elftools/elf/structs.py" |
|---|
| lines | "166-176" |
|---|
|
| type | "source" |
|---|
| detail | "ENUM_EI_CLASS (NONE 0, 32 1, 64 2), ENUM_EI_DATA (NONE 0, LSB 1, MSB 2)" |
|---|
| repo | "https://github.com/eliben/pyelftools" |
|---|
| commit | "5a04389392e25d8128e1acb59828a0a85be791b1" |
|---|
| path | "elftools/elf/enums.py" |
|---|
| lines | "25-36" |
|---|
|
| type | "byte_pattern" |
|---|
| detail | "All 111 ELF files of pyelftools' test corpus start with 7F 45 4C 46 and have class 1 or 2 and data 1 or 2; exe_simple64.elf starts 7F 45 4C 46 02 01 01 00, aarch64_be_gnu_hash.so.elf 7F 45 4C 46 02 02 01 00, exe_simple32.elf 7F 45 4C 46 01 01 01 00" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "ELF magic and e_ident" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T13:25:16.778Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T17:15:10.763Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read pyelftools elftools/elf/structs.py _create_ehdr at the cited commit: e_ident = Array(4, EI_MAG), EI_CLASS, EI_DATA, EI_VERSION, EI_OSABI, EI_ABIVERSION, Padding(7) = 16 bytes with the offsets in the claim." |
|---|
|
|
|---|