summaryrefslogtreecommitdiff
path: root/sysmap/src/mapper
diff options
context:
space:
mode:
authorauth12 <[email protected]>2021-07-04 01:24:58 +0100
committerauth12 <[email protected]>2021-07-04 01:24:58 +0100
commit38f13aadc420a4ed16aa65c092df211432fb83cf (patch)
treebf68e53a44cac84b41b96089caaa9b0dcd186c67 /sysmap/src/mapper
parentinitial commit (diff)
downloadarchived-sysmap-38f13aadc420a4ed16aa65c092df211432fb83cf.tar.xz
archived-sysmap-38f13aadc420a4ed16aa65c092df211432fb83cf.zip
replaced CreateRemoteThread
Diffstat (limited to 'sysmap/src/mapper')
-rw-r--r--sysmap/src/mapper/process.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/sysmap/src/mapper/process.h b/sysmap/src/mapper/process.h
index 77f7185..9d6da35 100644
--- a/sysmap/src/mapper/process.h
+++ b/sysmap/src/mapper/process.h
@@ -154,7 +154,19 @@ namespace process {
return ret;
}
- NTSTATUS close(HANDLE handle) {
+ NTSTATUS create_thread(uintptr_t start, HANDLE *out) {
+ static auto nt_create = g_syscalls.get<decltype(&NtCreateThreadEx)>("NtCreateThreadEx");
+
+ return nt_create(out, THREAD_ALL_ACCESS, nullptr, handle, reinterpret_cast<LPTHREAD_START_ROUTINE>(start), 0, 0x4, 0, 0, 0, 0);
+ }
+
+ NTSTATUS wait(HANDLE h) {
+ static auto nt_wait = g_syscalls.get<decltype(&NtWaitForSingleObject)>("NtWaitForSingleObject");
+
+ return nt_wait(h, false, nullptr);
+ }
+
+ static NTSTATUS close(HANDLE handle) {
static auto nt_close = g_syscalls.get<decltype(&NtClose)>("NtClose");
auto ret = nt_close(handle);
@@ -448,7 +460,9 @@ namespace process {
write(shellcode_base, shellcode.data(), shellcode.size());
- CreateRemoteThread(handle, 0, 0, (LPTHREAD_START_ROUTINE)shellcode_base, 0, 0, 0);
+ HANDLE thread_handle;
+ create_thread(shellcode_base, &thread_handle);
+ wait(thread_handle);
io::log<log_lvl::info>("mapped target image");