> For the complete documentation index, see [llms.txt](https://www.ctfrecipes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.ctfrecipes.com/pwn/protections/relro.md).

# RELRO

**Rel**ocation **R**ead-**O**nly (or **RELRO**) is a security measure against [GOT overwrite](/pwn/stack-exploitation/arbitrary-code-execution/code-reuse-attack/got-overwrite.md).

There are two RELRO "modes": partial and full.

## Partial RELRO <a href="#partial-relro" id="partial-relro"></a>

{% hint style="info" %}
Partial RELRO is the default setting in GCC.
{% endhint %}

Partial RELRO offers little additional protection, aside from ensuring that the [Global Offset Table (GOT) ](/pwn/general-knowledge/plt-and-got.md)is located in memory before the BSS (Block Started by Symbol) section. This eliminates the risk of a [buffer overflow](/pwn/stack-exploitation/stack-buffer-overflow.md) on a global variable overwriting GOT entries.

## Full RELRO <a href="#full-relro" id="full-relro"></a>

Full RELRO makes the entire GOT read-only which removes the ability to perform a "[GOT overwrite](/pwn/stack-exploitation/arbitrary-code-execution/code-reuse-attack/got-overwrite.md)" attack.

{% hint style="info" %}
Full RELRO is not a default compiler setting as it can greatly increase program startup time since all symbols must be resolved before the program is started. In large programs with thousands of symbols that need to be linked, this could cause a noticable delay in startup time.
{% endhint %}
