/
syscalls.asm
28 lines (23 loc) · 923 Bytes
/
syscalls.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
.data
jumpAddress dq 0
.code
PUBLIC NtProtectVirtualMemory
PUBLIC NtWriteVirtualMemory
PUBLIC SetJumpAddress ; Function to set jumpAddress
SetJumpAddress proc
mov [jumpAddress], rcx ; Assume the new address is passed in RCX
ret
SetJumpAddress endp
NtProtectVirtualMemory proc
mov r11, [jumpAddress] ; Load indirect syscall address into R11 register
mov eax, [rsp+30h] ; Move syscall ID into RAX register
mov r10, rcx
jmp r11 ; Indirect syscall via jump to address stored in R11
NtProtectVirtualMemory endp
NtWriteVirtualMemory proc
mov r11, [jumpAddress] ; Load indirect syscall address into R11 register
mov eax, [rsp+30h] ; Move syscall ID into RAX register
mov r10, rcx
jmp r11 ; Indirect syscall via jump to address stored in R11
NtWriteVirtualMemory endp
end