This book teaches x86-64 assembly language through the lens of offensive security. You will write shellcode by hand, exploit stack and heap vulnerabilities, build ROP chains that defeat modern mitigations, craft position-independent implants that resolve APIs at runtime, evade analysis environments, exploit kernel drivers, analyze firmware boot processes, and instrument binaries with inline hooks — all at the lowest level of abstraction the processor offers.
Every technique is demonstrated against Vectron Systems, a fictional defense-adjacent embedded systems firm, in one continuous authorized engagement. The lab runs on commodity hardware. The targets are vulnerable by design. The twenty CTF flags hidden across the engagement confirm you executed each phase correctly.
Assembly is not a convenience language. You will work harder for every capability than you would in Python or Nim. What you gain is total control — over every register, every byte on the stack, every instruction the processor decodes. When higher-level tools fail, when EDR hooks every API, when DEP and ASLR conspire against your payload — assembly is what remains.
Conventions
Code blocks are labelled by syntax:
- `{lang="asm"}` — NASM x86-64 assembly (Intel syntax)
- `{lang="python"}` — Python 3 helper scripts and exploit code
- `{lang="c"}` — Vulnerable target programs and kernel modules
- `{lang="bash"}` — Shell commands and build recipes
Findings follow the format `F01`, `F02`, etc., with CVSS 3.1 base scores.
CTF flags use the format `VECTRON{...}` and appear at key milestones.
Registers are written in lowercase (`rax`, `rsp`, `rdi`) following NASM convention.
Addresses and byte sequences are in hexadecimal (`0x41414141`, `\x31\xc0`).
Disclaimer
All techniques in this book are demonstrated within an isolated lab environment against intentionally vulnerable targets. The fictional engagement with Vectron Systems operates under explicit rules of engagement. These techniques are presented for authorized penetration testing, red team operations, and CTF competitions. Unauthorized use against systems you do not own or have explicit written permission to test is illegal and unethical.