Learn Reverse Engineering

This is the first of the series of posts I’ll be making on x86 binary exploitation. To start off binary exploitation, I recommend learning reverse engineering on the Linux x86 platform.

This post is intended for beginners that have no experience whatsoever in x86 reverse engineering.

Introduction

Knowledge of x86 Assembly is definitely necessary if you want to do x86 binary exploitation. Most of the time binaries are given without the source code, so without the ability to reverse engineer the binary there is no point learning anything else.

Reading Materials

I recommend finishing this playlist to learn the basics about 32-bit x86 assembly. The course will cover on the basics about the x86 Assembly language, the stack, and discuss the CMUBomb crackme challenge.

Maybe before starting we can have a look at this slides prepared by RPISEC for the MBE course. However, it is prepared to be used in their lectures so without demonstration some slides may be less intuitive.

Tools

In the playlist above, the instructor, Xeno demonstrated how to do reverse engineering with GDB. However, plain GDB is really hard to look at. There are some other better tools designed for doing binary analysis.

Binary analysis can be split into 2 different types. Static analysis refers to looking at the disassembly to find out what the program is doing. Dynamic analysis refers to looking at the program’s memory, such as the stack, heap or registers while running to have a clearer view of what is going on.

Neither is considered better, as you most of the time need to do static analysis first to have an overview of what the program is supposed to do, only after that you can try to have a clearer understanding of what the program is doing.

Static Analysis

Dynamic Analysis

There are so many choices, so which one should I use?

For me, I currently use radare2 for static analysis and GDB with PEDA for dynamic analysis. Will probably try out qira some time soon.

Challenges

After finishing the playlist, it’s time to test our skills on the following crackmes (sorted in the order I recommend).

MBE

After finishing the crackmes above, you should be able to understand x86 assembly pretty well already. So let’s set up the MBE VM which we will be using for the rest of this series.

The README contains pretty well documentation for setting up the VM so it won’t be covered here. Once you are done setting up, try to solve the crackmes in the Lab01 folder.

Final Notes

These should be sufficient practice to get yourself into x86 reverse engineering. Make sure that you fully understand x86 assembly so that the future parts are easier to grasp.