Conversation

that's no stack spoofing whatsoever, thats an invalid unwind. you can achieve the same with a tweetable piece of code: `*(void**)_AddressOfReturnAddress() = CreateFileW;`
4
15
You're writing a leaf function into return address which, by the way, may never call into other functions. Leaf functions' are unwound by considering next word as return address, so this goes on until you end up with a very invalid rip.
1
8
for reference, here is how proper stack spoofing would look like. Here i hid main()'s frame. as you can see, the stack correctly unwinds to RtlUserThreadStart, rather than abruptly ending like in your screenshot
Image
2
10
Yeah I get that. Actually I didn't bother on getting the technique much more complex just to deliver properly unwound, spoofed stack. My main goal was to hide from automated scanners that could pick up on thread's call stack and reference return addresses back to allocations.
1
but if that's your point, then it's much easier to use my tweetable version. The effect is same as on your screenshot. Depending on how many qwords from your return address you overwrite, you get as many broken frames. I can make an std::fill version and it'd still be tweetable.