ROP chain: calling a function with three arguments
The final goal is to call the bayroq_chiqar(R0, R1, R2) function (address 0x00404D86) with exactly R0=160, R1=167, R2=31. This time there are more distractors in the gadget table — choose carefully:
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 needed the third from R2 (in the real x86-64 System V ABI this happens via rdi, rsi, rdx — the idea is the same, the names are simplified).
| Address | Instruction (gadget) |
|---|---|
0x00402960 | POP R3; RET |
0x00401AC0 | POP R0; RET |
0x00401A38 | NOP; RET |
0x00401000 | POP R1; RET |
0x00402B88 | XOR R0, R0; RET |
0x00401160 | POP R2; RET |
0x004028F8 | POP R4; RET |
0x00402C68 | RET |
Chain: [gadget_R0, R0-qiymat, gadget_R1, R1-qiymat, gadget_R2, R2-qiymat, maqsad_manzil] — a total of 7 4-byte words, in sequence.
Submit the answer in the format BAYROQ{PWN_R3_<to'liq zanjir, uzluksiz hex satr>}.