As is know to all, mordern 32-bit operating systems employe flat mode.That is, all segments such as the code segment, data segment and stack segment start from 0 and spans over 2^32 - 1 address space. But here is a task that requires to set a specific program's stack segment to a certain arrange. How can I achieve that? To be specific, the target platform is 32-bit Windows.
Asked
Active
Viewed 119 times
0
-
See parameter `dwStackSize` in call to [Win32: CreateThread function](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682453(v=vs.85).aspx) and read linked chapter [MSDN: Thread Stack Size](https://msdn.microsoft.com/en-us/library/windows/desktop/ms686774(v=vs.85).aspx) – xmojmr Aug 08 '15 at 05:47
-
You can't do that. What are you actually trying to achieve? – Harry Johnston Aug 08 '15 at 08:00
-
Some exploit will change the stack pointer so that esp points to heap rather than the stack. If I can set the stack base and limit of a process, any stack pivoting will fail due to stack fault exception – Matthewxie Aug 09 '15 at 05:49
-
I'm not familiar with the details, but I believe Microsoft have other mitigations available against stack pivoting. As far as I know, Windows does not permit you to manipulate the GDT. – Harry Johnston Aug 11 '15 at 07:47