This is to improve my PWN toolbox for CTF.
Sometimes I get an executable file with included libc.so.6
and ld-linux-x86-64.so.2
. Supposed to run in a docker container.
But it would be nicer to run gdb
etc on my host machine. The problem with the current .exe
is, that if I am in the directory with the libraries, then I can’t even run ls
– As ls has issues with the included libraries.
Is there any way I can run gdb
with os libs – and launch the executable in a different directory – setting the current directory for that exe -and thus have that exe
use the shared libraries in its home directory?
I can’t find .
anywhere in /etc/ld.so.conf.d/*
And can gdb
use one set of libraries, and the app another? Or is this impossible? It seems like gdb
runs executables in its own address space and GOT.
I can run the file in Docker. Things are pretty bad if I have exe and libs in same dir – disturbs my bash – even ls does not work. exe will not run without the included libs.
If I move libs to ./libs
and cd ./libs; ../chall
then the application will run interactive. Thus it can run in its own context.
But I want gdb to control it.
I tried set env LD_LIBRARY_PATH /mnt/c/Users/xyz/Downloads/metaforge/libs` before run inside `gdb
. Segfaults, so does not work.