I successfully figured out how to run a program using angr, starting with the state defined by a core dump (see How to run program using angr after loading with the elfcore backend?) but now I am wondering this:
How can I malloc memory in the program's SimulationState?
The starting state I am running the program from is the beginning of a function which takes a pointer and a length. I want to be able to malloc memory fresh with arbitrary lengths, and pass this pointer (and the appropriate length) instead into the function.
I found that there is what I believe is a plugin class, angr.state_plugins.heap.heap_libc.SimHeapLibc
(documentation) which has a malloc
method, but how do I use this plugin, and is it in fact what I need?