Skip to content
All tools
Binary exploitationRuns locallyNo account

ROP gadget finder

Search a binary for return-oriented programming gadgets, filter by the registers they touch, and exclude ones containing bad bytes.

Open in ctfpal

NX makes injected code non-executable, so ROP reuses code that is already there. A gadget is any short instruction sequence ending in ret; chaining them lets you compute arbitrary things using only code the program already contains.

The gadgets you actually need

For the common case - calling a function with controlled arguments on x86-64 - you need very little. The System V calling convention passes the first six integer arguments in RDI, RSI, RDX, RCX, R8, R9, so a pop rdi ; ret and a pop rsi ; ret cover most single- and double-argument calls.

GadgetPurpose
pop rdi ; retFirst argument - the one every ret2libc needs
pop rsi ; retSecond argument
pop rdx ; retThird - often scarce, which is why execve chains are harder
retStack alignment before a libc call
syscall ; retDirect syscalls without libc
leave ; retStack pivot to a buffer you control

Part of a module

10. Binary exploitation

Read a binary’s protections, find an overflow offset in one crash, and build a ROP chain when the stack is not executable.

Practise on real challenges

Go deeper

Related tools