Overview
This example demonstrates how to build a simple ROP chain that sets register values usingset_regs(). This is one of the most fundamental operations in ROP chain construction.
Basic Register Setting
Find gadgets
Search for ROP gadgets in the binary:This analyzes the binary and identifies useful ROP gadgets that can be chained together.
Complete Example
Expected Output
Understanding the Chain
-
First gadget (
0xf5e2): Pops values intorbx,r12, andrbp. We use this to setrbxto0x42424242. -
Second gadget (
0x812f): Pops a value intorsi. We use this to temporarily store0x41414141inrsi. -
Third gadget (
0x169dd): Moves the value fromrsiintorax, achieving our goal of settingraxto0x41414141.