4 ms·
The linker is a convenient way to get your code to run in the right place, but the linker runs in userspace, and your code can do anything the linker does. E.g.
by singron 2y ago
The linker is a convenient way to get your code to run in the right place, but the linker runs in userspace, and your code can do anything the linker does. E.g. you can scan function tables, remap pages r/w, and interpose functions.
The OpenBSD folks have some good ideas against these issues, although they are targeted at things like ROP exploits. E.g. pledge, which disables certain syscalls, and immutable memory maps (https://marc.info/?l=openbsd-tech&m=166203784715942 https://marc.info/?l=openbsd-tech&m=166203784715942).
A really scary version of the xz backdoor is if it had an entire implementation of openssh in its own ctor function. Then it wouldn't even need to interpose anything. It's way harder to get rid of ctors.
- marcosdumay 2y ago> E.g. you can scan function tables, remap pages r/w, and interpose functions. Your code doesn't start doing those things without notice due to external interference. But a linker will add them, on your behalf, without raising any flags.