Skip to main content

Posts

Showing posts with the label heap_overflow

Introduction to Heap Overflow part 2 (use-after-free) (ง'̀-'́)ง (day 75)

Hi guys back again with the introduction of Heap Overflow, this time we move to the third challenge of the heap protostar challenge "Heap 2" Static Analysis: Before we move into the exploitation, let's take a look at the source code first and do a little bit of analysis At the start of the main function, we immediately enter an infinite loop and then there is a fgets function that will be used to store your input into the "line" variable. Notice that fgets is a safe function since it has a size limitation that enables the program to allocate enough memory without getting the risk of buffer overflow  After accepting our input the program will compare the value with 4 string which is "auth ", "reset", "service" and "login". If we choose "auth " options it will allocate memory in the heap for "auth" struct with malloc and then fill the memory with a bunch of zeroes using memset(). Finally, the...

Introduction to Heap Overflow (ง'̀-'́)ง (day 73)

In the last couple of posts, We are already talking about how to develop buffer overflow and format string exploit to take control of the program execution. Those two attacks are really great to explore and both of them still persist in today's modern software https://blog.zimperium.com/whatsapp-buffer-overflow-vulnerability-reportedly-exploited-wild/ https://www.forbes.com/sites/daveywinder/2020/02/05/cisco-confirms-5-serious-security-threats-to-tens-of-millions-of-network-devices/ BUT! what if I told you that there is another even more powerful memory corruption attack in the world of software security Interested? Enter the realm of the Heap Exploitation PUN intended :) Before getting into heap exploitation, let's talk about what is heap and when is it used? (Keep in mind: When I'm talking about heap I'm not referring to a heap in the data structure algorithm but heap in memory allocation in OS) Basically, Heap is just a part of memory insid...