I am trying to execute a 32bit binary and use a custom libc with it. So, I used LD_PRELOAD
environment variable to set the path.
export LD_PRELOAD='./libc.so.6'
After this, a simple ls
shows this error -
ERROR: ld.so: object './libc.so.6' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
I am currently trying this on a Ubuntu 20.04 64bit machine and I receive this error. This technique used to work fine on the same machine with Ubuntu 18.04. Why is this happening and is there a workaround for this?
Context: I am trying a CTF challenge and using LD_PRELOAD
is a common technique used when the challenge also provides a custom libc
. I tried running scripts that use this approach and used to work fine on Ubuntu 18.04 but they throw the same error.
Edit:
The ls
command works fine but also prints the error message. Any command executed will work correctly and also show this error. Major issue is that why doesn't this work on Ubuntu 20.04 whereas it worked perfectly on 18.