I've been teaching myself to write exploits and shellcode recently and many of the guides/books make the claim that we can guess where the stack begins and thereby with a little work guess what address on the stack our shellcode starts at.
- Why is the address of the start of the stack predictable? Shouldn't the stack start at some random address in memory?
- If the address start of the stack is just some fixed offset in virtual address space then why does it differ from machine to machine?
- What is the margin of error between different platforms and the address of the start of the stack?
Related: "the stack begins with the same address for every program", Address woes from Hacking: The Art of Exploitation, Why does the stack address grow towards decreasing memory addresses?
EDIT For my tests Address Space Layout Randomization (ASLR) is turned off.