-2

I've been learning how to write exploits using stack-based buffer overflows and, the one thing I cannot comprehend is just how the code (I believe "Machine Code") is interpreted and used. What I am talking about is the "/x3b/x09..." used in the actual injection of arbitrary code. I would like some clarification on how a simple "Hello World" program can be turned into what looks like hexadecimal, and that if the usage of this as a payload would be platform-specific. Any clarification would be greatly appreciated, thanks.

Nooble
  • 562
  • 7
  • 17

1 Answers1

0

It's interpreted by the CPU. That is the binary machine code that the CPU actually processes, just like the code that's created when you compile a program in C or C++.

Yes, it's platform-specific, just like compilers have to generate code for a specific platform.

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • So If I were to run the machine code into the processor instead of clicking on an executable, it would output the same result? For example if I were to compile a program that prints a message in a shell, would running the machine code equivalent of the code also open a shell and print the same message? – Nooble Jul 29 '14 at 01:56
  • When you compile a program, it creates a file containing the machine code. That's what compiling IS. – Barmar Jul 29 '14 at 02:09