( BaT | 2020. 09. 29., k – 02:10 )

It is therefore possible to search for an opcode that alters control flow, most notably the return instruction (0xC3) and then look backwards in the binary for preceding bytes that form possibly useful instructions. These sets of instruction "gadgets" can then be chained by overwriting the return address, via a buffer overrun exploit, with the address of the first instruction of the first gadget. The first address of subsequent gadgets is then written successively onto the stack. At the conclusion of the first gadget, a return instruction will be executed, which will pop the address of the next gadget off the stack and jump to it.

Tehát egyrészt kell hozzá egy hagyományos memóriakorrupciós hiba, ami eleve számtalan lehetőséget ad az exploitálásra. Másrészt innentől a támadó oda ugrik a kódban ahová akar, még az se garantált, hogy a kódot az eredeti utasításoknak megfelelően fogja használni. Vagyis innentől a hajadra kenheted a függvényeidbe írt ellenőrzéseket, azokat a támadó simán elkerüli.

Az analógiádnál maradva, a támadó továbbra is a nyitva hagyott ajtón jön be, de a házban már a falon keresztül közlekedik.