# Run with root user
wget -q https://raw.githubusercontent.com/bata24/gef/dev/install.sh -O- | sh
python3 /root/.gdbinit-gef.py --upgrade
rm -f /root/.gdbinit-gef.py /root/.gef.rc
All of these features are experimental. Tested on Ubuntu 18.04 / 20.04 / Debian 10.x.
- It works with qemu-system installed via apt, but qemu-6.x is recommended.
qreg
: prints register values from qemu-monitor (allows to get like$cs
even under qemu 2.x).sysreg
: pretty prints system registers.msr
: prints MSR (Model Specific Registers) values by embedding/executing dynamic assembly.pagewalk
: prints pagetables from scanning of physical memory.xp
: is a shortcut for physical memory dump.ksymaddr-remote
: prints kallsyms informations from scanning of kernel memory (heuristic).ksymaddr-remote-apply
: applies kallsyms informations obtained withksymaddr-remote
to gdb.slab
: dumps slab free-list (heuristic).- Original code: https://github.com/PaoloMonti42/salt
- Supported on x64/x86/ARM64/ARM + SLUB.
- Unsupported: SLAB, SLOB.
- Supported on both kASLR is enabled or not.
- Supported on both
CONFIG_SLAB_FREELIST_HARDENED
isy
orn
. - Supported on both the vmlinux symbol exists or not.
uefi-ovmf-info
: displays addresses of some important structures in each boot phase of UEFI when OVMF is used (heuristic).
partition-alloc-dump
: dumps partition-alloc free-list (heuristic).- It will try heuristic search if binary has no symbol.
- This command is reserved for the implementation of latest stable version of chromium.
- Currently tested: v94.0.4606.0 / 911494
- https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Linux_x64/911494/
- See also: https://omahaproxy.appspot.com/
- Structure: https://source.chromium.org/chromium/chromium/src/+/main:base/allocator/partition_allocator/partition_root.h;l=151;drc=d1c14fc2a67b849f03030d0295a054eae409a6eb
- Supported on x64 only (maybe it works on x86/ARM/ARM64, but not tested).
- Currently tested: v94.0.4606.0 / 911494
partition-alloc-dump-old1
: dumps partition-alloc free-list (heuristic).- For the implementation in 2021 Jul (tested on
Google CTF 2021 - fullchain
). - Not maintained for a while.
- For the implementation in 2021 Jul (tested on
partition-alloc-dump-old2
: dumps partition-alloc free-list (heuristic).- For the implementation in 2020 Jun (tested on
0CTF 2020 - chromium fullchain
). - Not maintained for a while.
- For the implementation in 2020 Jun (tested on
tcmalloc-dump
: dumps tcmalloc free-list (heuristic).- For tcmalloc, there are 3 major versions.
- tcmalloc that is a part of gperftools published in 2005: supported.
- tcmalloc that is included in chromium: supported. (For the implementation in 2020 Jun. Tested on
0CTF 2020 - chromium fullchain
). - tcmalloc that is maintained in Google Inc. published in 2020: unsupported.
- Not maintained for a while.
- For tcmalloc, there are 3 major versions.
musl-dump
: dumps musl-libc unused chunks (heuristic).
- Glibc heap commands are improved.
- Thread arena is supported for all heap commands.
- Use
-a
option.
- Use
- They print info if the chunk is in free-list.
find-fake-fast
: searches for a memory with a size-like value that can be linked to the fastbin free-list.visual-heap
: is colorized heap viewer.extract-heap-addr
: analyzes tcache-protected-fd introduced from glibc-2.32.
- Thread arena is supported for all heap commands.
vmmap
: is improved.registers
: is improved.context
: is improved.- It supports automatic display of system call arguments when calling a system call.
- It supports automatic display of address and value when accessing memory.
- It supports smart symbol printing for cpp function.
- ex:
std::map<int, std::map<int, int>>
will be replaced bystd::map<...>
. - command:
gef config context.smart_cpp_function_name true
orsmart-cpp-function-name
(later is used to toggle).
- ex:
telescope
: is improved.procinfo
: is improved.elf-info
: is improved.checksec
: is improved.got
: improved.canary
: is improved.edit-flags
: is improved.unicorn-emulate
: is improved.- It reads and writes correctly to the address pointed to by
$fs
/$gs
.
- It reads and writes correctly to the address pointed to by
ropper
: is improved.- It does not reset autocomplete settings after calling imported ropper.
hexdump
: is improved.- It supports physical memory if under qemu-system.
- It will retry with adjusting read size when failed reading memory.
patch
: is improved.- It supports physical memory if under qemu-system.
search-pattern
: is improved.
pid
: prints pid.filename
: prints filename.auxv
: pretty prints ELF auxiliary vector.argv
: pretty prints argv.envp
: pretty prints envp.gdtinfo
: pretty prints GDT sample.tls
: pretty prints$fs
base /$gs
base.magic
: is useful addresses resolver in gilbc.libc
/ld
/heapbase
/codebase
: prints each of the base address.mmx
/sse
/avx
/fpu
: pretty prints MMX/SSE/AVX/FPU registers.exec-until
: executes until specific operation.- Supported on x64/x86/ARM64/ARM for call/jmp/syscall/ret/mem-access/specific-keyword.
- Please note that this command temporarily closes stdin and stderr on gdb.
exec-next
: executes until next address.- This is useful for the operation with
rep
prefix.
- This is useful for the operation with
add-symbol-temporary
: adds symbol information from command-line.errno
: prints errno list or specific errno.u2d
: is cast/transformation u64 <-> double.hash-memory
: calculations hash.memcmp
: compares the contents of address A and B, whether virtual or physical.is-mem-zero
: checks the contents of address range is all 0x00 or 0xff or not.byteswap
: is transformation little-endian <-> big-endian.pdisas
: is a shortcut forcs-dis $pc LENGTH=50 OPCODES
.ii
: is a shortcut forx/50i $pc
.version
: shows software version that gef used.follow
: changesfollow-fork-mode
setting.smart-cpp-function-name
: togglescontext.smart_cpp_function_name
setting.seccomp-tools
: invokesseccomp-tools
.onegadget
: invokesone_gadget
.ls
/cat
: invokesls
/cat
directly.constgrep
: invokesgrep
under/usr/include
.rp
: invokesrp++
with commonly used options.
- Replace the unicode character to ASCII.
- I don't want to use double-byte characters.
- ex: ➤ to
>
. - ex: ✓ to
OK
.
- The category is introduced in
gef help
. - Combined into one file (from gef-extra).
peek-pointers
,current-stack-frame
,xref-telescope
,bytearray
,bincompare
, andftrace
are moved from gef-extras.- This is because a single file is more attractive than ease of maintenance.
- The system-call table used by
syscall-args
is moved from gef-extras.- It was updated up to linux kernel 5.14-rc2 (only x64/x86/ARM64/ARM).
- Since there are many exceptions at system calls for each architecture, arguments information of system call was picked up manually.
- Removed some features I don't use.
ida-interact
,gef-remote
,pie
andpcustom
.
- Many bugs fix / formatting / made it easy for me to use.