Developer knowledge network ยท moderated exchange

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Knowledge indexLive
4Categories
919Threads
2.8KPosts
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
Rep: 181
Join Date: Jul 2019
Posts: 21
Thanks: 50
1 months ago ยท 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
Rep: 215
Join Date: Mar 2018
Posts: 86
Thanks: 61
1 months ago ยท 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
Rep: 99
Join Date: Sep 2022
Posts: 14
Thanks: 16
1 months ago ยท Jul 7, 2026 9:38 PM
#3

Clean assembly encoding breakdown.