Sometimes if we want to replace a legit library, we need to add its symbols and version information too. We need to get the symbols and version from the original via
A good hijack that is meant for more than a quick privesc keeps the original libraries functionality intact. For example for a program that uses geteuid (e.g. cp ):
Specify a custom library to load (use one that the binary already uses and define a custom path for it that leads to your custom lib). Sudo will automatically ignore LD_PRELOAD though.