skills/binary-exploitation/common-exploiting-problems-unsafe-relocation-fixups/SKILL.md
Analyze and exploit unsafe relocation fixup vulnerabilities in asset loaders. Use this skill when investigating binary vulnerabilities in game engines, asset parsers, or any software that applies relocation tables to loaded data. Trigger when the user mentions relocation tables, asset loaders, heap corruption, pointer fixups, section arrays, or similar binary exploitation concepts. Make sure to use this skill whenever analyzing asset loading code, relocation handlers, or when the user is researching heap-based exploitation techniques in legacy software.
npx skillsauth add abelrguezr/hacktricks-skills unsafe-relocation-exploitationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A skill for analyzing and exploiting unsafe relocation fixup vulnerabilities in asset loaders and binary parsers.
Unsafe relocation fixups occur when asset loaders blindly trust attacker-controlled metadata to patch pointers within loaded data. This creates arbitrary read/write primitives that can be weaponized for RCE.
The classic unsafe relocation handler:
int *GrannyGRNFixUp_0(DWORD RelocationCount,
Relocation *PointerFixupArray,
int *SectionArray,
char *destination)
{
while (RelocationCount--) {
int target_base = SectionArray[PointerFixupArray->SectionNumber]; // UNCHECKED
int *patch_site = (int *)(destination + PointerFixupArray->SectionOffset); // UNCHECKED
*patch_site = target_base;
if (target_base)
*patch_site = target_base + PointerFixupArray->Offset;
++PointerFixupArray;
}
return SectionArray;
}
Critical flaws:
SectionNumber index is never bounds-checkedSectionOffset is never validated against section sizeGoal: Use negative offsets to corrupt the section pointer array itself.
Key insight: Custom allocators prepend headers to allocations. By calculating the exact distance between:
You can craft relocations that write into the pointer array.
Calculation example:
0x20 (header) + 0x20 (section descriptors)
+ n * 1 (section types) + n * 1 (flags)
+ n * 4 (pointer table) = 0x4000
Solving for n gives the number of sections needed to position metadata at a specific offset.
Windows 10 NT Heap behavior:
Strategy:
When investigating potential unsafe relocation vulnerabilities:
testing
How to perform a House of Lore (small bin attack) heap exploitation. Use this skill whenever the user mentions heap exploitation, small bin attacks, fake chunks, glibc heap vulnerabilities, or needs to insert fake chunks into small bins for arbitrary read/write. Trigger for CTF challenges involving heap corruption, glibc 2.31+ exploitation, or when the user needs to bypass malloc sanity checks using fake chunk linking.
testing
How to perform House of Force heap exploitation attacks. Use this skill whenever the user mentions heap exploitation, House of Force, top chunk manipulation, arbitrary memory allocation, malloc manipulation, or wants to allocate chunks at specific addresses. Also trigger for CTF challenges involving heap overflows, top chunk size overwrites, or when the user needs to calculate evil_size for heap attacks. Make sure to use this skill for any binary exploitation task involving glibc heap manipulation, even if they don't explicitly say "House of Force".
tools
How to perform House of Einherjar heap exploitation to allocate memory at arbitrary addresses. Use this skill whenever the user mentions heap exploitation, glibc heap attacks, arbitrary memory allocation, off-by-one overflow exploitation, tcache poisoning, fast bin attacks, or any CTF challenge involving heap manipulation. This is essential for binary exploitation tasks where you need to control malloc() return addresses.
testing
How to identify, analyze, and exploit heap overflow vulnerabilities in binary exploitation challenges and real-world scenarios. Use this skill whenever the user mentions heap overflows, memory corruption, heap grooming, tcache poisoning, fast-bin attacks, or any heap-related vulnerability in CTF challenges, binary analysis, or security research. This skill covers heap overflow fundamentals, exploitation techniques, heap grooming strategies, and real-world CVE analysis.