From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Library:Plthook" |
|---|
| claim | "plthook_replace on ELF enumerates the JUMP_SLOT relocations (DT_JMPREL) first and then the data relocations (GLOB_DAT; DT_RELA or DT_REL depending on architecture, only where the build defines R_GLOBAL_DATA), matches the first slot whose symbol name is the given name (exact or followed by '@version'), makes the page writable with mprotect if needed, stores the old pointer, writes the new one and returns: only that first matching slot is changed." |
|---|
| scope | | level | "library" |
|---|
| applies_to | "Library:Plthook" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "plthook_replace(plthook, funcname, funcaddr, &oldfunc)" |
|---|
| effect | "only calls from the opened module that go through the first matching slot are redirected; a second slot of the same name (e.g. a GLOB_DAT entry besides a JUMP_SLOT one) is left alone; protection is restored afterwards (the mprotect restore is unchecked)" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "plthook_replace read" |
|---|
| repo | "https://github.com/kubo/plthook" |
|---|
| commit | "24c69df003310fb91f9c2950b5a659ff70e9dfb9" |
|---|
| path | "plthook_elf.c" |
|---|
| lines | "862-906" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "ELF GOT slot replace" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-18T19:05:57.514Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:34:48.419Z" |
|---|
| result | "confirmed" |
|---|
| method | "Fetched plthook_elf.c at kubo/plthook 24c69df00331 and read plthook_enum_with_prot (JUMP_SLOT from DT_JMPREL first, then R_GLOBAL_DATA entries of DT_REL/DT_RELA) and all of plthook_replace (strncmp + '\0' or '@', mprotect if not writable, stores old, writes new, returns 0 at the first match, final mprotect restore unchecked). Note for readers: R_GLOBAL_DATA is R_*_GLOB_DAT on x86, ARM, AArch64 and PPC but R_RISCV_32/64 on RISC-V." |
|---|
| notes | "Minor nuance only; claim holds." |
|---|
|
|
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T04:02:36.618Z" |
|---|
| summary | "Narrowed: plthook_replace stops at the FIRST matching slot (JUMP_SLOT entries are enumerated before GLOB_DAT), the second table is DT_REL or DT_RELA by architecture and only scanned where…" |
|---|
| changed | |
|---|
|
|
|---|