ROP

From The iPhone Wiki
Jump to: navigation, search

ROP is a form of exploitation where you search for gadgets in memory (instructions bascially) and use memory's own code instead of using your code. In evasi0n, this ROP gadget is used

 STR R1, [R2];BX LR

So evasi0n looks for that in memory using memmem(), here's the function in planetbeing's patchfinder.

 int32_t find_str_r1_r2_bx_lr(uint32_t region, uint8_t* kdata, size_t ksize)
 {
   const uint8_t search[] = {0x11, 0x60, 0x70, 0x47};
   void* ptr = memmem(kdata, ksize, search, sizeof(search)) + 1;
   if(!ptr)
       return 0;
      return ((uintptr_t)ptr) - ((uintptr_t)kdata);
 }

Once you've figured out all your ROP gadgets, that's your payload and that's how you will exploit whatever vulnerability you found.