exploiting-glibc-heap-vulnerabilities

Exploits glibc ptmalloc2 heap vulnerabilities using tcache poisoning, bin attacks, and leak primitives.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill exploiting-glibc-heap-vulnerabilities
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: exploiting-glibc-heap-vulnerabilities
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/binary-exploitation/exploiting-glibc-heap-vulnerabilities
Command: npx skills add https://github.com/xalgord/xalgorix --skill exploiting-glibc-heap-vulnerabilities

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

During authorized penetration tests and CTF-style binary exploitation, heap bugs like use-after-free and double-free are hard to convert into reliable arbitrary read/write because modern glibc mitigations (tcache key checks, safe-linking, hook removal) invalidate classic techniques. This Skill provides a version-aware methodology for turning heap corruption primitives into leaks and code execution.

Core Features & Use Cases

  • Version-aware technique selection: Fingerprints the target glibc version first, since tcache double-free detection (2.29+), safe-linking (2.32+), and malloc hook removal (2.34+) each change the exploitation strategy.
  • Bin-specific primitives: Covers tcache poisoning, fast-bin dup, unsorted/large-bin attacks, House of Botcake, and off-by-one size confusion, with pwntools code patterns for each.
  • Leak and mitigation handling: Explains how to obtain libc leaks from unsorted-bin fd/bk pointers and heap leaks needed to forge safe-linked next pointers.
  • Use Case: Given a binary with a UAF bug on glibc 2.35, follow the workflow to leak libc and heap bases, overlap chunks via House of Botcake, poison the tcache, and achieve arbitrary write over a FILE vtable for code execution.

Quick Start

Analyze the target binary with this skill to identify its heap bug class and glibc version, then build a working exploit chain from leak to arbitrary write.

Frequently Asked Questions about exploiting-glibc-heap-vulnerabilities

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I exploit a use-after-free in glibc heap?

First fingerprint the glibc version, then fill the tcache with 7 frees so the next free lands in the unsorted bin, and read its fd/bk to leak a libc address. Use the UAF write to poison a freed tcache chunk's next pointer so a later malloc returns your target address.

How to bypass safe-linking in glibc 2.32 tcache poisoning?

Safe-linking stores the next pointer as target XOR (chunk_address >> 12), so you need a heap leak to forge a valid pointer. Leak a freed tcache chunk's fd to recover the heap base, then compute the mangled pointer before overwriting.

Why does my double-free abort on modern glibc?

Since glibc 2.29, the tcache key field detects plain double-frees and aborts. Bypass it by freeing a different chunk in between on fastbins, or use House of Botcake to overlap chunks through unsorted-bin consolidation instead.

Can I overwrite __malloc_hook on glibc 2.34 or later?

No, __malloc_hook and __free_hook were removed in glibc 2.34. Modern targets require pivoting to overwriting an application code pointer or vtable, FSOP attacks on FILE structures, or setting up ROP after gaining arbitrary write.

What tools are needed for glibc heap exploitation?

Use gdb with pwndbg or GEF for heap inspection commands like heap, bins, and tcachebins, plus pwntools for scripting allocations and leak math. how2heap provides reference PoCs per glibc version, and libc-database identifies the exact libc from leaked symbols.