ROP introduction: setting an argument with one gadget
ROP (Return-Oriented Programming) is a technique of sequentially "calling" and using small pieces of code already present within the program ("gadgets", usually ending with RET) by controlling the stack. Given the address of each gadget, you place the gadget addresses and operands onto the stack in the correct order, forcing the program to perform the action you want.
The "function calling convention" in this challenge is a simple model invented for educational purposes: the function takes its first argument from the R0 register, the second from R1, and if necessary the third from R2 (in the real x86-64 System V ABI this is done via rdi, rsi, rdx — the concept is the same, but the names are simplified).
Below is the table of found gadgets:
| Address | Instruction (gadget) |
|---|---|
0x00401D90 | POP R1; RET |
0x00401330 | POP R0; RET |
0x00401230 | POP R2; RET |
0x00401840 | XOR R0, R0; RET |
0x00401CE0 | RET |
0x00401160 | POP R3; RET |
You need to set the first argument of the target function (i.e., the R0 register) to a value of your choice. Which ONE of the gadgets in the table serves this purpose?
Send the answer in the format BAYROQ{PWN_GADGET_<manzil, 0x'siz, katta hex>}.