Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reconstruct type and data structure in disassembled C/C++ program?

I have made a binary executable file disassembled using disassembler like IDA Pro. Now, I plan to recognize type and data structure information as much as possible. Is there any resource reference or ideas to help me finish the task?

Thank you!~

EDIT:

Thanks very much for tips below. Besides type and data structure information, any ideas about class object recognition?

like image 383
Jason Avatar asked Feb 24 '23 13:02

Jason


2 Answers

The already mentioned Reversing: Secrets of Reverse engineering by Eldad Eilam has some nice descriptions of how various control flow and data structures look in the assembly. However, since you specifically mention classes, I would like to plug my article on Visual C++ implementation. A lot of it applies to other compilers as well.

BTW, I would recommend starting with small functions/classes and identifying them in the binary. If you are using Visual C++ and compile your code with debug info (Debug build or /Zi on command line), IDA (at least recent versions) will detect and offer to load the PDB symbols. That will make identification of your code easier.

like image 106
Igor Skochinsky Avatar answered Apr 08 '23 03:04

Igor Skochinsky


This is practically impossible; adequate information simply does not exist in the file after compilation.

You need to walk through the disassembly by hand at run-time and try to decipher the numbers yourself.

like image 34
user541686 Avatar answered Apr 08 '23 01:04

user541686