Reversing : The Hacker's Guide to Reverse Engineering

(ff) #1

High-Level Perspectives


Let’s review some basic software development concepts as they are viewed
from the perspective of conventional software engineers. Even though this
view is quite different from the one we get while reversing, it still makes sense
to revisit these topics just to make sure they are fresh in your mind before
entering into the discussion of low-level software.
The following sections provide a quick overview of fundamental software
engineering concepts such as program structure (procedures, objects, and the
like), data management concepts (such as typical data structures, the role of
variables, and so on), and basic control flow constructs. Finally, we briefly com-
pare the most popular high-level programming languages and evaluate their
“reversibility.” If you are a professional software developer and feel that these
topics are perfectly clear to you, feel free to skip ahead to the section titled
“Low-Level Perspectives” later in this chapter. In any case, please note that
this is an ultra-condensed overview of material that could fill quite a few books.
This section was not written as an introduction to software development—
such an introduction is beyond the scope of this book.

Program Structure


When I was a kid, my first programming attempts were usually long chunks
of BASIC code that just ran sequentially and contained the occasional goto
commands that would go back and forth between different sections of the pro-
gram. That was before I had discovered the miracle of program structure. Pro-
gram structure is the thing that makes software, an inherently large and
complex thing, manageable by humans. We break the monster into small
chunks where each chunk represents a “unit” in the program in order to con-
veniently create a mental image of the program in our minds. The same
process takes place during reverse engineering. Reversers must try and recon-
struct this map of the various components that together make up a program.
Unfortunately, that is not always easy.
The problem is that machines don’t really need program structure as much
as we do. We humans can’t deal with the concept of working on and under-
standing one big complicated thing—objects or concepts need to be broken up
into manageable chunks. These chunks are good for dividing the work among
various people and also for creating a mental division of the work within one’s
mind. This is really a generic concept about human thinking—when faced
with large tasks we’re naturally inclined to try to break them down into a
bunch of smaller tasks that together make up the whole.
Machines on the other hand often have a conflicting need for eliminating
some of these structural elements. For example, think of how the process of
compiling and linking a program eliminates program structure: individual

26 Chapter 2

Free download pdf