Cyber security

GDBleed – Advanced Binary Instrumentation with GDB

GDBleed – Dynamic-Static binary instrumentation framework on top of GDB

GDBleed is a gdb wrapper exposing a set of commands for x86-64, ARM and MIPS (x86 and ARM thumb-mode in progress) architectures to perform binary instrumentation.

The objective was to exploit the hackish features of GDB python API, while ignoring the software performance attribute (for now). And in the end to have a user-friendly framework.

GDBleed focus is applicability, then we have efficiency. The more CPU archs it does suport the better it is.

Why?

  • “easy”-fast minimal static-dynamic code instrumentation supporting all main CPU archs
  • Framework based on tools with a strong community support: GDB, gcc, r2, keystone, LIEF, etc.
  • No control flow information is needed
  • ideal for IoT devices, why?
    • no binary instrumentation for MIPS
    • cross-compilation is boring (and if it works then it will break somewhere during the execution)
    • A lot of the new IoT devices still using old linux kernel versions not supporting EBPF

Usage

  • run gdb from the current folder
  • Start the process using start command or attach gdb to the debugged process
  • Run the command
source gdbleed.py
  • For more info take a look at the tests folder

Usage Of The Hooking functionalities

Req

  • Tested on ubuntu 20.04
  • Dep: keystone, LIEF

Installation

  • Install
# GEF gdb extension, ref https://github.com/hugsy/gef
sudo apt-get -y install unzip cmake binutils
  • Declare env vars
# python's version which your gdb intalled supports
export PYTHON_VER="python3"
sudo apt-get install ${PYTHON_VER}-distutils ${PYTHON_VER}-setuptools

# Choose module versions (i suggest not changing the major number version)
export KEYSTONE_VER="0.9.2"
export LIEF_VER="0.12.3"
  • From current folder run:
./setup.sh

Required for hooking/instrumentation also aka Inline GOT hooking

  • Install

export TARGET=arm-linux-gnueabi
sudo apt-get install -y binutils-${TARGET} gcc-${TARGET}

export TARGET=mips-linux-gnu
sudo apt-get install -y binutils-${TARGET} gcc-${TARGET}
  • add vim highlighting
augroup filetypedetect
  au! BufRead,BufNewFile *.c.bleed setfiletype c
augroup END
Varshini

Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies.

Recent Posts

Starship : Revolutionizing Terminal Experiences Across Shells

Starship is a powerful, minimal, and highly customizable cross-shell prompt designed to enhance the terminal…

21 hours ago

Lemmy : A Decentralized Link Aggregator And Forum For The Fediverse

Lemmy is an innovative, open-source platform designed for link aggregation and discussion, providing a decentralized…

21 hours ago

Massive UX Improvements, Custom Disassemblers, And MSVC Support In ImHex v1.37.0

The latest release of ImHex v1.37.0 introduces a host of exciting features and improvements, enhancing…

23 hours ago

Ghauri : A Powerful SQL Injection Detection And Exploitation Tool

Ghauri is a cutting-edge, cross-platform tool designed to automate the detection and exploitation of SQL…

1 day ago

Writing Tools : Revolutionizing The Art Of Writing

Writing tools have become indispensable for individuals looking to enhance their writing efficiency, accuracy, and…

1 day ago

PatchWerk : A Tool For Cleaning NTDLL Syscall Stubs

PatchWerk is a proof-of-concept (PoC) tool designed to clean NTDLL syscall stubs by patching syscall…

2 days ago