WCU / Cybersecurity
~/CSC 472/Class 04/KP 08
Class 04 · KP 08 / 18

Reading the Example

  • Position-independent: the path is built on the stack at runtime and referenced through RSP — no fixed address.
  • Null-free-friendly: xor zeros registers, and mov al, 59 avoids a zero-padded immediate.
  • Why push a NULL first: execve needs a null-terminated path string in memory.
  • Little-endian: bytes for "/bin/sh" are stored reversed, which is why the constant looks scrambled.
Key Takeaway

Every design choice in real shellcode traces back to two constraints: run anywhere, contain no forbidden bytes.