[Blackhat 2011] Post Memory Corruption Memory Analysis
Résumé
In this article, we introduce a new exploitation methodology of invalid memory reads and writes, based on daaflow analysis after a memory corruption bug has ocurred inside a running process. We will expose a methodology which shall help writing a reliable exploit out of a PoC triggering an in- valid memory write, in presence of modern security defense mechanism such ascompiler enhancements (such as SSP...), lib protections (eg: safe heap unlinking), linking and dynamic linking enhancements (full read only GOT and relocations) or kernel anti exploitation features (ASLR, NX...). In particular, we will demonstrate how to : finnd all the function pointers inside a running process, how to determine which ones would have been dereferenced after the Segmentation fault if the process had kept executing, which ones are truncatable (in parti ular with 0x00000000). In case all of the above fail, we will demonstrate how to test for overwrites in specific locations in order to indirectly trigger a second vulnerability allowing greater control and eventually full control flow hijacking. All of the above without needing the source code of the application debugged. In the case of invalid memory reads, we will show how to indirectly influence the control flow of exe- cution by reading arbitrary values, how to trace all the unaligned memory access and how to test if an invalid read an be turned into an invalid write or at least used to infer the mapping of the binary. We will also introduce a new debugging technique which allows for very effective dynamic testing of all of the above by forcing the debugged process to fork(). All those steps are realized automatically and provide a rating of the best read/write location based on probabilities of mapping addresses (in the hope to defeat ASLR). These techniques were implemented in the form of a proof of concept tool running under GNU/Linux and Intel architectures : pmcma.