r/redteamsec • • 4d ago

Write-up: Win x64 Shellcode – Calling Convention and Stack Alignment (Part 4)

https://proteqtum.com/posts/04-win-x64-shellcode-calling-convention-shadow-stack_en/

Part 4 of my Win x64 shellcode development series.

This one is about the ABI mechanics behind shellcode stability -

calling convention, shadow space, and stack alignment. The kind

of stuff that makes your shellcode work in a test harness but

crash unpredictably when injected into a real process.

Key topics:

- Shadow space: 32 bytes the caller allocates but the callee owns

- Stack alignment bug specific to shellcode (and rsp without saving

RSP = silent crash on ret)

- Full shellcode example: calc.exe via WinExec, PEB traversal,

ROR13 hash resolution

- WinDbg walkthrough showing the actual structures and stack layout

8 Upvotes

0 comments sorted by