Principle:0sec labs 0 Binary Ingestion Triage
| Knowledge Sources | |
|---|---|
| Domains | Binary_Analysis, Security |
| Last Updated | 2026-10-30 00:00 GMT |
Overview
Mechanism for classifying compiled binary files by format, architecture, and security mitigations from raw bytes alone, without external decompiler dependencies.
Description
Binary ingestion triage is the first stage of any binary analysis pipeline: it reads the raw bytes of a target file and determines its executable format (ELF, PE, Mach-O), CPU architecture (x86-64, ARM64, MIPS), bit width, endianness, and file kind (executable, shared library, kernel module). It also detects security mitigations — NX, PIE, RELRO, stack canary, CFG — by parsing program headers and section flags. This classification determines which decompiler backend, ABI resolver, and confirmation oracle can be used for the rest of the pipeline.
Usage
Use this principle when designing any binary vulnerability discovery system. It is the mandatory first step before decompilation, static analysis, or dynamic confirmation can proceed.
Theoretical Basis
Binary format detection relies on magic number comparison at fixed file offsets:
# Abstract algorithm (NOT real implementation)
magic = read_bytes(file, offset=0, length=4)
if magic == b"\x7fELF":
classify_elf(data)
elif magic[:2] == b"MZ":
classify_pe(data)
elif magic in MACH_O_MAGICS:
classify_macho(data)
Mitigation detection parses program headers (ELF PT_GNU_STACK for NX, PT_GNU_RELRO for RELRO, DT_FLAGS for PIE) and section attributes. Each mitigation's presence or absence constrains the exploitability of any vulnerability found downstream.