Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 925

Return-Oriented Programming

What is Return-Oriented Programming?

Return-Oriented ProgrammingReturn-Oriented Programming (ROP) is a code-reuse exploit technique that chains short instruction sequences ending in RET to execute arbitrary computation without injecting new code.


Hovav Shacham introduced ROP in 2007 to bypass DEP/W^X mitigations. The attacker corrupts a stack and writes a chain of addresses, each pointing to a short gadget ending in RET. After each gadget runs, RET pops the next gadget address, producing a Turing-complete computation built only from existing executable bytes (libc, libraries, the program). Variants include JOP (jumps), COP (calls), and SROP (signal frames). ROP is the principal reason ASLR, CFI, stack canaries, shadow stacks, Intel CET and memory-safe languages were standardized; defenses target either gadget availability, control-flow integrity, or memory safety at the source.

Examples

  1. 01

    An exploit chaining pop-rdi/syscall gadgets in glibc to call execve("/bin/sh").

  2. 02

    A kernel exploit using kASLR-leak plus ROP into commit_creds(prepare_kernel_cred(0)).

Frequently asked questions

What is Return-Oriented Programming?

Return-Oriented Programming (ROP) is a code-reuse exploit technique that chains short instruction sequences ending in RET to execute arbitrary computation without injecting new code. It belongs to the Application Security category of cybersecurity.

What does Return-Oriented Programming mean?

Return-Oriented Programming (ROP) is a code-reuse exploit technique that chains short instruction sequences ending in RET to execute arbitrary computation without injecting new code.

How does Return-Oriented Programming work?

Hovav Shacham introduced ROP in 2007 to bypass DEP/W^X mitigations. The attacker corrupts a stack and writes a chain of addresses, each pointing to a short gadget ending in RET. After each gadget runs, RET pops the next gadget address, producing a Turing-complete computation built only from existing executable bytes (libc, libraries, the program). Variants include JOP (jumps), COP (calls), and SROP (signal frames). ROP is the principal reason ASLR, CFI, stack canaries, shadow stacks, Intel CET and memory-safe languages were standardized; defenses target either gadget availability, control-flow integrity, or memory safety at the source.

How do you defend against Return-Oriented Programming?

Defences for Return-Oriented Programming typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Return-Oriented Programming?

Common alternative names include: ROP, Code reuse attack, Return-to-libc.

Related terms

See also