ROP chain: calling a function with 2 arguments
Now more than one gadget is needed: you must call the daraja_tekshir(R0, R1) function (address 0x00403F52) with exactly the values R0 = 217, R1 = 126 — the function will output the flag only with these values.
The "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 needed, the third from R2 (in the real x86-64 System V ABI this is done via rdi, rsi, rdx — the idea is the same, the names are simplified).
Found gadgets:
| Address | Instruction (gadget) |
|---|---|
0x00401EB8 | POP R3; RET |
0x00401DC8 | RET |
0x004013A0 | POP R1; RET |
0x00401B80 | XOR R0, R0; RET |
0x00401FD0 | POP R2; RET |
0x004011E8 | POP R0; RET |
The ROP chain is placed on the stack in the following order: [gadget_R0, qiymat_R0, gadget_R1, qiymat_R1, maqsad_manzil] — each element is 4 bytes, little-endian. Each POP Rn; RET gadget takes one value from the stack into that register, then "returns" (RET) to the next element.
Submit the answer in the format BAYROQ{PWN_ROP_<to'liq zanjir, uzluksiz hex satr>}.