print(
block.capstone
)
First, we locate the target function using its address.
Next, we examine its constituent Basic Blocks and display the assembly instructions.
This helps us gain a better understanding of the function's internal structure.
Note that the address 0x401120 is merely an example; you should replace it with the address obtained from your own file.
Determining the Purpose of Unknown Functions
Identifying the scope of a function is only the first step.
Subsequently, we must determine the specific purpose of the function.
To do this, we examine several key aspects:
Function Inputs
Observe the arguments the function receives.
In the System V ABI standard for the x86-64 architecture, the first six arguments (whether integers or pointers) are typically passed via the following registers:
rdi rsi rdx rcx r8 r9Function Output Examine the value returned by the function. In the System V ABI standard for x86-64, the return value is generally placed in the
rax register.
Calls to Other Functions
If a function frequently calls routines such as malloc, free, memcpy, or strcmp, these calls can provide significant clues regarding the function's purpose.
Memory Access
Analyze what data the function reads from or modifies within memory.
For instance, it might interact with buffers, arrays, data structures, or strings.
By synthesizing these indicators, we can arrive at a logical interpretation of the function's behavior.
An important caveat: function identification is not always definitive.
In compiled programs, one may encounter scenarios where identification... These factors make analyzing functions more difficult:
Examples include:
Function inlining by the compiler
Tail Call Optimization
The use of function pointers
Self-modifying code
Indirect jumps
Insufficient information to determine function boundaries
For instance, when a function is inlined, its code may be placed directly inside another function, meaning it no longer exists as a distinct, independent entity.
Consequently, the output from tools like angr should be viewed as the result of an analysis rather than an absolute, definitive truth.
In this section, we explored the concept of "stripped binaries" and saw how the removal of symbols complicates the analysis of executable files.
We also examined how to identify functions using CFGFast in angr. By analyzing assembly code—including arguments, return values, and internal calls—we were able to gain a solid understanding of each function's purpose.
@reverseengine02 دسامبر, 16:27

