Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:0sec labs 0 Binary Ingestion Triage

From Leeroopedia
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.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment