Skip to main content

Breaking code: Warm Up Windows Exploit and RE Challenge Examenes (▀̿Ĺ̯▀̿ ̿) (day 97) part II


This is the second write up of windows exploit challenge Examenes from https://github.com/naivenom/exploiting in this post we will finish the last two remaining challenge

I put the payload at my GitHub feel free to copy it:

https://github.com/sleepyowl-beep/exploit_development/tree/master/EXAMENES-Challenge
Without further ado! Let's Do This!

Challenge 6:

 
Just like the previous challenge the program open the file named "example.txt" using fopen() function, read the first 20 bytes of the content and move it again to a different variable using strcpy to be used as parameter for function EXAMEN_L.009A10D0. Let's try to generate a new example.txt file that contains 200 characters and follow the program flow


as we follow the called function, it turns out the function itself called another function named EXAMEN_L.009A1000


Inside the function, we can see there are a bunch of checks that we need to analyze. The first two red boxes show that our input is concatenated with another string using the "strcat" function and retrieve the length of it by using strlen.

after the get the length of the string the value is compared with "0xE5"(229) this is just a simple check if the string length is not equal as 229 it will exit the program. the last two red boxes used to check the two characters located at index 5 and 6 at the string to be equal to the character "I" and "P".

from this information we can create new example.txt like this:



Run the program again and as you can see we managed to bypass the three checks



continue the execution and we will go back to the previous function and there is the last comparison that basically check if our input does not exceed 200 bytes so as long as we input 200 bytes we are fine


There you go we pass the level

Challenge 7:

We finally reached the last stage and in this challenge, we need to overflow the stack to control the flow of the program

At first, I just try to create an example.txt file again but it contains 300 "A" characters



as you can see from the figure above our EIP is overflow with our input, let's try to figure out which location in the string that we need to change to control the EIP register.



using pattern exploit tools(https://github.com/Svenito/exploit-pattern) to generate the pattern. Load the new file again and you will see that we need to control the input at index 170

let's try to check one more time if we get the right input by supplying the following input:




cool! we all set to go know all we need to is to change the EIP register to contain address "0x004010aa" which contains the level pass banner




run the program one more time and we pass the last level, cool :)

That's all folks, I hope you enjoy this blog post and see you in the next breaking code series.

Comments

Popular posts from this blog

Having fun analyzing nginx log to find malicious attacker in the net (ง'̀-'́)ง (day 37)

  What makes you sleepless at night? is it because of a ghost or scary stories? is it because you have an important meeting tomorrow? or is it because you have an exam? For me, what keeps me up all night is that I keep thinking about what happens to a website that I just created, is it safe from an attacker (certainly not) or did I missing some security adjustments that lead to vulnerability? well I'm not the best secure programmer in the world, I'm still learning and there is a big possibility that I can make a mistake but for me, a mistake can be a valuable investment to myself or yourself to be better so from this idea, I want to know more about what attackers casually do when attacking a website. Here in this post, I'm going to show you how I analyzed attack to the website that I have permission to design and also some interesting findings that I could get from the analysis Background: All of this analysis comes from the traffic that is targeted to th

Utilize Pwntools for crafting ROP chain :') (day 69)

who doesn't like pwntools? it is a very versatile tool and can be customized according to our need using the python script but did you need to know that pwntools itself can help us to automatically craft a rop chain for us? so in this post, I will show you how to make rop chain less painful and make pwntools do all the heavy lifting. To demonstrate this I will use the binary challenge callme 64 bit from ropemporium link: https://ropemporium.com/challenge/callme.html Crashing the app: Like any other exploitation process, we need to crash the program by generating a long string pattern to determine the offset. based on the information from the above figure we can see that we required to provide 40 bytes of offset Fun stuff: now this where the fun stuff began write the following python script: as in the guideline of the challenged said we need to chain the function call by first to call the callme_one function, callme_two function and then callme_three funct

WriteUp PWN tarzan ROP UNICTF ಠ_ಠ (day 61)

So in this post, I'm going to talk about how to solve the Tarzan pwn challenge from UNICTF 2019. Back in the day when the competition is still going I couldn't finish it and don't have any clue to solve this but this time I was able to finish it :) Also in this post, we will be going to be heavily focused on how to utilize pwntools to construct a ROP chain. If you kinda confused about my explanation in this post you can refer to this following youtube video, link: https://www.youtube.com/watch?v=gWU2yOu0COk I build the python script based on this video Ok, let's get started! In this challenge, you will get two binary first go with tarzan and libc-2.29.so by providing .so file it tell us what version library that the target machine is using this could help us to do ROP chain. first, we run the Tarzan binary to get the basic idea of the program work and as you can see it just show you some text, newline and when you try to input something it doesn't gi