Placing the stack canary correctly
Stack canary — a random control value placed between the buffer and the return address. Before the function returns, the program checks this value: if it has changed — the program stops immediately (overflow detected). Therefore, a simple overflow will not work: you must know the canary value and rewrite it EXACTLY in its place.
Real canaries always end with a 0x00 (NUL) byte — this prevents accidental leakage through string functions like strcpy/puts (which stop at a NUL byte).
Through another vulnerability (for example, a format-string leak), you have already discovered the canary value: [228, 17, 209, 0] (4 bytes, in order).
| Offset | Content | Size (bytes) |
|---|---|---|
0 | buffer | 20 |
20 | STACK CANARY (nazorat qiymati) | 4 |
24 | saqlangan registr | 4 |
28 | qaytish manzili | 4 |
Target address: 0x00402CEE. Build the full exploitation payload: buffer to'ldiruvchi + canary (aynan berilgan tartibda) + saqlangan registr uchun ixtiyoriy 4 bayt + maqsad manzil (kichik-endian).
Submit the answer in the format BAYROQ{PWN_CANARY_<to'liq payload, hex>}.