How to disassemble stripped binary
Disassemble stripped binary
A stripped binary is a program that is compiled with a strip flag that tells the compiler to discard these debugging symbols and compile to program
Simply, A binary with no debugging symbol
In GCC if we want strip a binary we can compile with -s option/parameter
In normal program debuggers like GDB disassembles a binary using those mechanisms
Debug Information: GDB relies on debug information that is often generated during the compilation of a program with debugging symbols enabled. These symbols provide a mapping between the source code and the corresponding machine code instructions.
Symbol Table: The debug information includes a symbol table that associates functions, variables, and other code elements with their memory addresses and data types. This information is crucial for GDB to understand the structure of the program.
So lets cut to the chase Here is how we disassemble stripped binary
I have created some c program for test purpose which is stripped.
Step-1:
Lets open the program in GDB
As we see, GDB says there is no symbol table to disassemble the binary
Honestly speaking, GDB says no sysbol table loaded even if the program is not stripped
Step-2:
Lets run the program and find out the entry point/address for the program
Step-3:
Lets set a break point at the entry point and forward 200 instruction from the entry point which we had set a break point.
We disassembled the binary now lets find out the password for the program
Step-4:
Lets see the disassembled code try to understand the program
In this section the program is trying to check the string length is equal to 12
specifically at 0x555555555234
Then it compare the input text to some unknown text at 0x55555555524d
If it equal or not equal it print some texts using puts function.
Step-5:
Lets set a break point at 0x55555555524d and run the program
So when we input a string with 12 length, It compares with "justpassword",if it is equal it must the output says "Welcome" else it says "Wrong password"









Comments
Post a Comment