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
magrazia edited this page May 24, 2016
·
1 revision
This phase applies a number of assembly transformations to simplify each ROP trace by removing the connections between gadgets and merging the content of consecutive gadgets in a single basic block. This step is also responsible to remove immediate values from the stack and assign them to the corresponding registers.
In the example, it is shown how to invoke the unchain plugin, how its output looks like and what it contains.
emdel -> time python vol.py unchain -f ../rop_dumps/0/rkrop_pmem_raw_0x00.ram --profile Linuxubuntu-serverx64x64 -B /tmp/prova.bin -i 25-04-16_part1_0-78100_hwcontext.json -S 1 -G 10 --dtb=62967808
Volatility Foundation Volatility Framework 2.3.1
[+] From gadget: 1
[+] To gadget: 10
[+] Getting 25-04-16_part1_0-78100_hwcontext.json
[+] Creating /tmp/prova.bin
[INPUT] 1) ret
[INPUT] 2) pop rax
[OUTPUT] mov rax, 0xffff88001bc00000
[INPUT] 3) ret
[INPUT] 4) mov qword ptr [rax], rdx
[OUTPUT] mov rdx, 0x0
...
it generates /tmp/prova.bin that is a binary blob containing the new version of the chain.
Under the hood, in the /tmp directory we have the ropmemu directory containing the assembly code used by nasm and the generated binary blobs as shown below:
This directory and consequently all the files can be removed with the -C flag (clean).
To speedup the performance, and to try to reduce the number of calls to nasm you can use and load the so called opcode db. To dump the opcodes in the opcode db use the -D flag (e.g., -D /tmp/db) as shown below:
emdel -> time python vol.py unchain -f ../rop_dumps/0/rkrop_pmem_raw_0x00.ram --profile Linuxubuntu-serverx64x64 -B /tmp/prova.bin -i 25-04-16_part1_0-78100_hwcontext.json -S 1 -G 10 -D /tmp/db --dtb=62967808
...
[INPUT] 14) pop rdx
[OUTPUT] mov rdx, 0xffffffff81626b6e
[INPUT] 15) ret
[INPUT] 16) add rsp, 0x10
[OUTPUT] add rsp, 0x10
[INPUT] 17) ret
[+] Dumping /tmp/db_dechain_10.json
real 0m27.059s
user 0m25.148s
sys 0m1.880s