Skip to content

Commit

Permalink
Merge pull request #3 from RaMMicHaeL/patch1
Browse files Browse the repository at this point in the history
CreateBootstrap: take "shadow space" into account
  • Loading branch information
dismantl committed Jun 28, 2016
2 parents 058b176 + 133e5ab commit 823e30c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions inject/src/LoadLibraryR.c
Expand Up @@ -466,6 +466,10 @@ static DWORD CreateBootstrap(
MoveMemory(lpBuffer + i, &nUserdataLen, sizeof(nUserdataLen));
i += sizeof(nUserdataLen);

// sub rsp, 20
MoveMemory(lpBuffer + i, "\x48\x83\xec\x20", 4);
i += 4;

// move rax, <address of reflective loader>
MoveMemory(lpBuffer + i, "\x48\xc7\xc0", 3);
i += 3;
Expand Down Expand Up @@ -503,6 +507,10 @@ static DWORD CreateBootstrap(
MoveMemory(lpBuffer + i, &nUserdataLen, sizeof(nUserdataLen));
i += sizeof(nUserdataLen);

// sub rsp, 20
MoveMemory(lpBuffer + i, "\x48\x83\xec\x20", 4);
i += 4;

// move rax, <address of reflective loader>
MoveMemory(lpBuffer + i, "\x48\xb8", 2);
i += 2;
Expand Down

0 comments on commit 823e30c

Please sign in to comment.