Binary Exploitation Deep Analysis

pwn binary-exploitation buffer-overflow stack heap assembly

Computer Architecture Fundamentals

Binary Exploitation - something about those two words intrigues me profoundly.

The Language of Machines

“Binary” - those two bits (0 and 1) form the foundation of all computation. It’s fascinating that this simple representation:

  • Comprises all machine code computers understand
  • Forms the basis of every digital device
  • Represents the fundamental “language” of technology

Just as humans communicate through languages, computers speak in binary.

The Art of Exploitation

“Exploitation” represents the most fundamental attack vector:

“To truly break a system, target its core components”

Without 0s and 1s, there is no:

  • Operating systems
  • Applications
  • Digital infrastructure

Bridging the Gap

As humans, we needed ways to interface with this binary world:

  1. Machine Code: Direct binary representation
  2. Assembly Language: Human-readable low-level abstraction
  3. Higher-Level Languages: Further abstractions (C, Rust, etc.)

Pioneers like John von Neumann developed these crucial abstraction layers that make exploitation possible.

Why This Matters

The ability to exploit binaries represents:

  • A deep understanding of system fundamentals
  • The power to manipulate systems at their core
  • An underappreciated skillset in modern cybersecurity

Now, The Best Part!

We need to cover essential computer architecture concepts, focusing on Central Processing Unit(CPU), memory, then registers, and then lastly execution flow.

1. CPU Basics

The CPU executes instructions stored in the memory, key concepts:

  • Instruction Set Architecture(ISA): Defines how the CPU works(x86, ARM, MIPS, etc).
  • Register “I have been waiting for this one 😅”, A register is just a fast storage locations inside the CPU.
  • Execution Flow Simply, how the CPU fetches, Decodes and Execute.

Common CPU Architectures in Exploitation

Architecture Bitness Common Use Endianess(N.B)
x86 32-bit Legacy systems, embedded Little-Endian
x86-64 64-bit Modern PCs, servers Little-Endian
ARM 32/64-bit Mobile, IoT devices Bi-Endian
MIPS 32/64-bit Routers, embedded systems Big/Little-Endian