Statically linked executables are executables that are a stand-alone executable, with everything being self-contained within this file.
The PLT/GOT tables are used in order to make it possible to dynamically generate references to libraries. However, these are essentially function pointers that have to be resolved. Hence, these functions pointers can be overwritten for malicious purposes.
Because of the above issue, a mitigation was put in place: Relocation Read-Only (RELRO). This resolves the PLT/GOT table entries at startup in order to make the section read only.
This is where things gets weird... One would think that a statically linked executable would not use GOT/PLT tables, right? Well, they do. The tables are still used for optimization purposes.
Does RELRO still apply to statically linked executables? This is the best part about the article: no. The Read Only setting is turned on by the dynamic linker, which is not used with a static executable. Hence, a statically linked executable does not have RELRO protections.
Fact: RELRO also protects items such as .init_array/.fini_array, .jcr and the dynamic section. In a statically liked executable, the .init_array/.fini_array sections no longer work (removing this as an attacker surface).
From the ASLR standpoint, there are also issues with statically linked executables. ASLR is incompatible with statically linked executables.
The author of this article creates two new tools for statically linked executables: RelroS and static_to_dym. The first tool alters the executables to make the PLT/GOT section read only by doing some ELF black magic. The second mitigation is to turn an executable into a dynamic executable, but only for the purpose of ASLR to work.
There were two implementations of randomizing the code segment: PIE and
RANDEXEC, where PIE won the battle.
Overall, this was a fantastic article that dove into the nitty-gritty of exploit mitigations.