findSyscallNumber PROC xor rsi, rsi xor rdi, rdi mov rsi, 00B8D18B4Ch ; bytes at start of NTDLL stub to setup syscall in RAX mov edi, [rcx] ; RDI = first 4 bytes of NTDLL API syscall stub (mov r10,rcx;mov eax,<syscall#>) cmp rsi, rdi jne error ; if the bytes dont match then its prob hooked. Exit gracefully xor rax,rax ; clear RAX as it will hold the syscall mov ax, [rcx+4] ; The systemcall number ret ; return to caller findSyscallNumber ENDP
halosGateUp:向上获取SSN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
halosGateUp PROC xor rsi, rsi xor rdi, rdi mov rsi, 00B8D18B4Ch ; bytes at start of NTDLL stub to setup syscall in RAX xor rax, rax mov al, 20h ; 32 * Increment = Syscall Up mul dx ; RAX = RAX * RDX = 32 * Syscall Up add rcx, rax ; RCX = NTDLL.API +- Syscall Stub mov edi, [rcx] ; RDI = first 4 bytes of NTDLL API syscall stub, incremented Up by HalosGate (mov r10, rcx; mov eax, <syscall#>) cmp rsi, rdi jne error ; if the bytes dont match then its prob hooked. Exit gracefully xor rax,rax ; clear RAX as it will hold the syscall mov ax, [rcx+4] ; The systemcall number for the API close to the target ret ; return to caller halosGateUp ENDP
halosGateDown:向下获取SSN
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
halosGateDown PROC xor rsi, rsi xor rdi, rdi mov rsi, 00B8D18B4Ch ; bytes at start of NTDLL stub to setup syscall in RAX xor rax, rax mov al, 20h ; 32 * Increment = Syscall Down mul dx ; RAX = RAX * RDX = 32 * Syscall Down sub rcx, rax ; RCX = NTDLL.API - Syscall Stub mov edi, [rcx] ; RDI = first 4 bytes of NTDLL API syscall stub, incremented Down by HalosGate (mov r10, rcx; mov eax, <syscall#>) cmp rsi, rdi jne error ; if the bytes dont match then its prob hooked. Exit gracefully xor rax,rax ; clear RAX as it will hold the syscall mov ax, [rcx+4] ; The systemcall number for the API close to the target ret ; return to caller halosGateDown ENDP