GEF (GDB Enhanced Features)

Plugin GDB pour les développeurs d'exploits et les rétro-ingénieurs, ajoutant des vues de contexte riches, l'analyse de heap et la recherche de pattern par-dessus le GDB standard. GDB plugin for exploit developers and reverse engineers, adding rich context views, heap analysis, and pattern search on top of stock GDB.

↗ https://github.com/hugsy/gef

Overview

GEF is a Python-based GDB extension purpose-built for exploit development, malware analysis, and CTF work. It replaces GDB’s bare-bones output with a live context view (registers, stack, disassembly, threads) on every stop, and adds commands for heap inspection, ASLR/PIE-aware address resolution, and cyclic pattern generation — all without needing a separate GUI.

Common Usage

Install (drops into ~/.gdbinit)

bash -c "$(curl -fsSL https://gef.blah.cat/sh)"

Launch a binary under GEF

gdb ./vulnerable_binary

Show current context (registers, stack, code, threads)

gef> context

Generate a De Bruijn cyclic pattern to find offset

gef> pattern create 200

Find the offset of a crashing value in the pattern

gef> pattern search $rsp

Heap & Memory Analysis

Summarize the glibc heap state

gef> heap chunks

Inspect a specific chunk

gef> heap chunk 0x55d3a1a2b000

Show bins (tcache/fastbin/unsorted)

gef> heap bins

Find useful ROP gadgets in the binary

gef> rop --grep "pop rdi"

Search memory for a pattern (string/bytes)

gef> search-pattern "/bin/sh"

Show memory mappings with permissions

gef> vmmap

Tips

  • checksec inside GEF prints NX/PIE/RELRO/Canary status instantly — first thing to run on a new binary
  • gef config lets you tune context sections (disable ones you don’t need for speed)
  • Works well alongside pwntools — GEF handles interactive debugging while pwntools scripts the exploit
  • xinfo <addr> resolves an address to its section/permissions/nearest symbol in one shot
Help / Man page
GEF - GDB Enhanced Features

Core commands:
  context             Display the current execution context
  checksec            Show binary security mitigations (NX, PIE, RELRO, Canary)
  vmmap               Show process memory mappings
  xinfo <addr>        Show detailed info about an address
  pattern create <n>  Generate a cyclic pattern of length n
  pattern search <v>  Find offset of value within a generated pattern
  search-pattern <p>  Search memory for a byte pattern or string
  heap chunks         List heap chunks
  heap bins           Show tcache/fastbin/unsorted bin state
  rop --grep <str>    Search for ROP gadgets matching string
  format-string-helper  Detect format string vulnerabilities at runtime

Config:
  gef config          Show/set GEF configuration options
  gef save            Persist current config to ~/.gef.rc

Vue d’ensemble

GEF est une extension GDB écrite en Python conçue spécifiquement pour le développement d’exploits, l’analyse de malware et les CTF. Elle remplace la sortie minimaliste de GDB par une vue de contexte en direct (registres, pile, désassemblage, threads) à chaque arrêt, et ajoute des commandes pour l’inspection du heap, la résolution d’adresses consciente de l’ASLR/PIE, et la génération de patterns cycliques, le tout sans avoir besoin d’une GUI séparée.

Utilisation courante

# Installer (se place dans ~/.gdbinit)
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"

# Lancer un binaire sous GEF
gdb ./vulnerable_binary
# Afficher le contexte actuel (registres, pile, code, threads)
gef> context
# Générer un pattern cyclique de De Bruijn pour trouver l'offset
gef> pattern create 200
# Trouver l'offset d'une valeur de crash dans le pattern
gef> pattern search $rsp

Analyse du heap et de la mémoire

# Résumer l'état du heap glibc
gef> heap chunks

# Inspecter un chunk spécifique
gef> heap chunk 0x55d3a1a2b000

# Afficher les bins (tcache/fastbin/unsorted)
gef> heap bins

# Trouver des gadgets ROP utiles dans le binaire
gef> rop --grep "pop rdi"

# Rechercher un pattern en mémoire (chaîne/octets)
gef> search-pattern "/bin/sh"

# Afficher les mappings mémoire avec leurs permissions
gef> vmmap

Conseils

  • checksec dans GEF affiche instantanément le statut NX/PIE/RELRO/Canary : la première chose à lancer sur un nouveau binaire
  • gef config permet d’ajuster les sections de contexte (désactiver celles dont on n’a pas besoin pour aller plus vite)
  • Fonctionne bien avec pwntools : GEF gère le débogage interactif pendant que les scripts pwntools scriptent l’exploit
  • xinfo <addr> résout une adresse vers sa section/ses permissions/le symbole le plus proche en une seule commande
Aide / Page de manuel
GEF - GDB Enhanced Features

Core commands:
  context             Display the current execution context
  checksec            Show binary security mitigations (NX, PIE, RELRO, Canary)
  vmmap               Show process memory mappings
  xinfo <addr>        Show detailed info about an address
  pattern create <n>  Generate a cyclic pattern of length n
  pattern search <v>  Find offset of value within a generated pattern
  search-pattern <p>  Search memory for a byte pattern or string
  heap chunks         List heap chunks
  heap bins           Show tcache/fastbin/unsorted bin state
  rop --grep <str>    Search for ROP gadgets matching string
  format-string-helper  Detect format string vulnerabilities at runtime

Config:
  gef config          Show/set GEF configuration options
  gef save            Persist current config to ~/.gef.rc