IT lexicon › Security › RETGUARD

RETGUARD

Security På svenska → Updated: 2026-11-08

OpenBSD's compiler mitigation that scrambles every function's return address with a secret random value, making ROP chains hard to assemble.

Introduced in 2018, written mostly by Todd Mortimer, and compiled in by OpenBSD's Clang. On function entry the return address is XORed with a secret cookie unique to that function; just before ret the operation is reversed and the result checked. A mismatch kills the program. The cookies are filled with random data when the program is loaded.

The point is that the short code fragments ROP depends on stop working in isolation: an attacker who jumps into the middle of a function lands on a check that fails. It is a heavier intervention than a stack canary, which guards one buffer at a time, but the performance cost turned out small enough to enable across the whole base system.

← Back to the lexicon