Run Program with Preloading Libraries without Using LD_PRELOAD Nov 1st 2021 Words: 133


Setting LD_PRELOAD variable can define custom libraries to load before running a program. This variable is used by utilities such as proxychains to hook up network related functions. However, some applications may refuses to run if LD_PRELOAD variable is presented, as an anti-hacking trick maybe.


Use ld-linux to load the program with preloading libraries without setting the environment variable. man page

LD_PRELOAD="" /lib64/ --preload /usr/lib/x86_64-linux-gnu/ /usr/bin/curl

Note that the process must be passed as a path.

proxychains example:

sudo proxychains bash -c 'LD_PRELOAD="" /lib64/ --preload /usr/lib/x86_64-linux-gnu/ /usr/bin/curl'