Book Image

Penetration Testing with the Bash shell

By : Keith Harald Esrick Makan
Book Image

Penetration Testing with the Bash shell

By: Keith Harald Esrick Makan

Overview of this book

Table of Contents (13 chapters)

Debugging binaries for dynamic analysis


Tools such as Objdump are great for getting a look at the code in an executable while it's not executing. However, if you'd like to actually observe an executable in execution and find out more about how it processes information as well as how its internal data structures are altered by its execution, you will need something called a debugger. One such tool is called the GNU Debugger (GDB). In this section, we will cover the basic usage of GDB, and you will also get to know some of the tasks it allows us to pull off during a binary's execution.

Getting started with GDB

To start off with, let's load up a binary and run it in GDB using the following command:

gdb [binary]

For our current example, this command would look like the following:

gdb ./bash

What GDB does here is prepare to attach itself to the binary during its execution—this means it places the binary in a special environment that allows it to observe detailed information during its execution...