People often ask me "How did you learn how to hack?" The answer: by reading. This page is a collection of the blog posts and other articles that I have accumulated over the years of my journey. Enjoy!
ld) will find and load shared object libraries needs by the program. The dynamic loader is extremely security sensitive since it runs with whatever permissions of the binary, such as setuid permissions. Finding a vulnerability in this leads to catastrophic consequences. __tunables_init() is called; this processes the GLIBC_TUNABLES environment variable. For each variable that it finds, the program will make a copy of the variable, parse it, sanitize it and edit the original inline. The goal of the parsing is to remove all dangerous tunables out of it.tunable1=aaa:tunable2=bbb. However, there is bad input validation on the validity of the format. Providing a value of tunable1=tunable2=AAA will cause some major problems. tunable1) instead of the next tunable in the list (tunable2). Finally, the second iteration will strcpy into the same buffer, leading to a buffer overflow on the inline write of the variable.mmap() to get memory. So, the authors had to find a way to exploit this by corrupting the mmaped pages. The read-write ELF section makes for an interesting target but the authors could not find a way to get their allocation behind it for the overflow.tunables_strdup() function. mmap is a top-down allocator. So, by creating a tunable without corrupting then performing the overflow in a second variable, it is possible to overflow the first variable. This ended up not being very fruitful though.link_map structure, they noticed that not all members are initialized to zero. Additionally, unlike regular malloc, the minimal malloc with calloc() does not initialize to zero. With this, it is possible to control the pointers of the structure! This completely breaks the logic of ld.so in favor of the attacker.