Skip to content

Commit

Permalink
Generalised memory protection revert to reuse protection originally m…
Browse files Browse the repository at this point in the history
…et after locating shellcode for the first time.
  • Loading branch information
mgeeky committed Oct 7, 2021
1 parent c1b026e commit 21a7194
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions ShellcodeFluctuation/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct FluctuationMetadata
SIZE_T shellcodeSize;
bool currentlyEncrypted;
DWORD encodeKey;
DWORD protect;
};

struct HookedSleep
Expand Down
6 changes: 3 additions & 3 deletions ShellcodeFluctuation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void shellcodeEncryptDecrypt(LPVOID callerAddress)
g_fluctuationData.shellcodeAddr,
g_fluctuationData.shellcodeSize,
PAGE_READWRITE,
&oldProt
&g_fluctuationData.protect
);

log("[>] Flipped to RW.");
Expand Down Expand Up @@ -330,11 +330,11 @@ void shellcodeEncryptDecrypt(LPVOID callerAddress)
::VirtualProtect(
g_fluctuationData.shellcodeAddr,
g_fluctuationData.shellcodeSize,
Shellcode_Memory_Protection,
g_fluctuationData.protect,
&oldProt
);

log("[<] Flipped to RX.\n");
log("[<] Flipped back to RX/RWX.\n");
}

g_fluctuationData.currentlyEncrypted = !g_fluctuationData.currentlyEncrypted;
Expand Down

0 comments on commit 21a7194

Please sign in to comment.