diff options
author | Malfurious <m@lfurio.us> | 2023-03-15 17:12:32 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2023-03-15 17:49:22 -0400 |
commit | 873cf63768302bab81b06987803e9d108e3ceebb (patch) | |
tree | 614ef870ac32b995196b10cf95d54824bd15a392 /sploit.py | |
parent | c9f5d7113c6f977fb31fd7699bd2d5a5869954ad (diff) | |
download | sploit-873cf63768302bab81b06987803e9d108e3ceebb.tar.gz sploit-873cf63768302bab81b06987803e9d108e3ceebb.zip |
rev: Update rop gadget search functionality
Development on the rop chain builder has produced this upgrade to our
gadget search facility. The primary advantages in this version are
increased flexibility and runtime performance.
It is now easier to find specific 'stray' instructions (not immediately
followed by a ret) since we search from every position in the data
returned by r2. If you _do_ want a ret, just specify it in your input
regexes. For this reason, a dedicated function for locating a simple
'ret' gadget is no longer present - elf.gadget("ret") is the equivalent.
A major change in this version is that we now obtain and operate on r2's
JSON representation of the gadget data. We now only reach out to r2
once to get all information for a binary (which is cached) and the
actual 'search' is implemented in Python. This provides a significant
performance speedup in cases where we need many gadgets from one binary,
as r2 doesn't need to inspect the entire file each time. Additional
caching is done on specific search results, so that 100% redundant
searches are returned immediately. Access to the raw JSON data is made
available through a new function rop_json(), but is not exposed in the
ELF interface, since it seems like a niche need.
Search results are returned via Gadget objects (or a list thereof),
which contain regular expression Match objects for each assembly
instruction found in the gadget. This allows the caller to retrieve the
values contained in regular expression capture groups if present.
Also, anecdotally, the search functionality in r2 has seemed to return
false negatives for some queries in the past, whereas I haven't noticed
similar cases with this implementation yet.
Signed-off-by: Malfurious <m@lfurio.us>
Signed-off-by: dusoleil <howcansocksbereal@gmail.com>
Diffstat (limited to 'sploit.py')
0 files changed, 0 insertions, 0 deletions