You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two theories.
One: the symbolic state magic is not properly handling the multi register pop instructions, and that only the first instance is noted.
Two: the symbolic state functions see that r3 is being overwritten with (ldr r3, [r3]) so it assumes it can be ignored.
Both would account for only r0 and r11 (fp) showing up as popped registers, but not r3.
This issue should be addressed by #63
The root cause is that currently angrop assumes that the address of symbolic memory access has to come from register control, which is wrong according to the example.
The fix is to track stack control as well. as represented by memaccess.addr_stack_controllers
Description
When searching for gadgets, some valid gadgets are skipped due to not passing some of the gadget analyzer tests.
Steps to reproduce the bug
I have following function in a test binary:
built with the following:
Example python script:
When running the above code, the example gadget is not found by find_gadgets(). Additionally, when we manually search, example_gadget == None.
I found that this is due to this line (https://github.com/angr/angrop/blob/master/angrop/gadget_analyzer.py#L141). None is returned for this example gadget.
If the return here (https://github.com/angr/angrop/blob/master/angrop/gadget_analyzer.py#L143) is commented out, the gadget now returns.
When printed out, it shows as follows:
And when used in a chain, it works as expected:
chain += p32(0x105d8) # pop {r0, r3}; ldr r3, [r3]; pop {fp, pc}
It looks like the gadget fails both checks on (https://github.com/angr/angrop/blob/master/angrop/gadget_analyzer.py#L141).
Two theories.
One: the symbolic state magic is not properly handling the multi register pop instructions, and that only the first instance is noted.
Two: the symbolic state functions see that r3 is being overwritten with (ldr r3, [r3]) so it assumes it can be ignored.
Both would account for only r0 and r11 (fp) showing up as popped registers, but not r3.
What I have tried already:
removing the "angr.options.AVOID_MULTIVALUED_READS" options here (https://github.com/angr/angrop/blob/master/angrop/rop_utils.py#L161).
added opt_level=0 to the options here (https://github.com/angr/angrop/blob/master/angrop/rop_utils.py#L213)
No observable change
Environment
GCC version: arm-linux-gnueabi-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Additional context
No response
The text was updated successfully, but these errors were encountered: