Skip to content

Commit 21a7194

Browse files
committed
Generalised memory protection revert to reuse protection originally met after locating shellcode for the first time.
1 parent c1b026e commit 21a7194

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ShellcodeFluctuation/header.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct FluctuationMetadata
3131
SIZE_T shellcodeSize;
3232
bool currentlyEncrypted;
3333
DWORD encodeKey;
34+
DWORD protect;
3435
};
3536

3637
struct HookedSleep

ShellcodeFluctuation/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void shellcodeEncryptDecrypt(LPVOID callerAddress)
291291
g_fluctuationData.shellcodeAddr,
292292
g_fluctuationData.shellcodeSize,
293293
PAGE_READWRITE,
294-
&oldProt
294+
&g_fluctuationData.protect
295295
);
296296

297297
log("[>] Flipped to RW.");
@@ -330,11 +330,11 @@ void shellcodeEncryptDecrypt(LPVOID callerAddress)
330330
::VirtualProtect(
331331
g_fluctuationData.shellcodeAddr,
332332
g_fluctuationData.shellcodeSize,
333-
Shellcode_Memory_Protection,
333+
g_fluctuationData.protect,
334334
&oldProt
335335
);
336336

337-
log("[<] Flipped to RX.\n");
337+
log("[<] Flipped back to RX/RWX.\n");
338338
}
339339

340340
g_fluctuationData.currentlyEncrypted = !g_fluctuationData.currentlyEncrypted;

0 commit comments

Comments
 (0)