Developer knowledge network · moderated exchange

UnreliableCode қауымдастығы

Әзірлеушілерді зерттеу, кері инженерия және кодтау қауымдастығы

Knowledge indexТірі
4Categories
919Threads
2.8KЖазбалар
Guide

Calculating 64-bit RIP-Relative 5-Byte Direct vs 14-Byte Indirect Jumps in x64 [v2.4 Technical Discussion]

hook_doctor
Hooking Specialist
MEMBER
Өкіл: 181
Қосылу күні: Jul 2019
Хабарламалар: 21
Рахмет: 50
1 ай бұрын · Jul 7, 2026 3:07 AM
#1

Why 64-bit hooks fail when target functions are > 2GB away in virtual address space:

  1. 5-Byte JMP (E9 [disp32]):
    $$\text{disp32} = \text{TargetAddress} - (\text{HookAddress} + 5)$$
    Limited to $\pm 2\text{GB}$ range from instruction pointer.
  2. 14-Byte Absolute Indirect JMP:
ASM
   FF 25 00 00 00 00       ; jmp qword ptr [rip + 0]
   AA BB CC DD EE FF 00 11 ; 64-bit Target Absolute Pointer

Reaches any 64-bit address anywhere in virtual RAM without register clobbering!

vtable_slayer
Senior Reverser
MEMBER
Өкіл: 215
Қосылу күні: Mar 2018
Хабарламалар: 86
Рахмет: 61
1 ай бұрын · Jul 7, 2026 7:43 AM
#2

Using a 14-byte indirect jump eliminates the need to allocate trampolines within 2GB of the target module. Great explanation.

x64_assembler
Assembly Guru
MEMBER
Өкіл: 99
Қосылу күні: Sep 2022
Хабарламалар: 14
Рахмет: 16
1 ай бұрын · Jul 7, 2026 9:38 PM
#3

Clean assembly encoding breakdown.