I Can’t Read and I Won’t Race You Either
A while back, Tavis showed us three ways to exploit flaws in glibc's dynamic linker involving LD_AUDIT. The first way involved opening a file descriptor and using fexecve to easily win a race with $ORIGIN. The problem was that this required having read permissions on the SUID executables. Tavis recommended a work around involving filling a pipe until it was full so that anything written to stderr would block. This race, however, was not always successful. The third thing he showed us was that LD_AUDIT would load any trusted library, and he pointed out that libpcprofile.so could be jiggered to create a world writable root owned file in any directory. One candidate would be to write something to a crontab. What if, however, you don't have cron installed? He then went on to explain a quite extensive search routine to find candidates for libraries to load. But why search, when you already can make a world writable root owned file in any directory you want? The easier way is to use libpcprofile.so to create such a file, and then fill that file with code you want to run. Then, run that code using the same trick.