Skip to main content

Breaking code: Exploit Bypass SEH windows Free MP3 CD Ripper (▀̿Ĺ̯▀̿ ̿) (day 50)


Disclaimer: This post only for education only ! not to cause any destruction on any living system. Be smart!

The last post in "breaking code" series we are talking about how to bypass SEH protection in windows program but I think that's not quite satisfied me yet because I only doing it once and I want to make sure I get the concept right

Ok so in this post again we are going to take over a program equipped with SEH protection, this time I picked "Free MP3 CD Ripper 2.8" software and again this is not originally come from me I only recreated the exploit and documented in detail manner.

But at the end of the post, I will show you something interesting that will make you more careful when designing software. Stay tuned until the end :)

This post is inspired by this thread in "packetstorm" security (https://packetstormsecurity.com/files/155440/Free-MP3-CD-Ripper-2.8-Buffer-Overflow.html)

Ok first we need to install the software in our windows virtual machine, note: you need an internet connection to complete the setup of the installation.



The program itself is just a converter for a music file. Alright! after you done with the installation open the software in the immunity debugger



After this, you can check the SEH check location with an immunity debugger. Go to the "view" > "SEH chain"

Like from the previous post, we need to craft an "evil" payload to crash the program.I'm skipping the whole creating padding with "A" shenanigans and just straight to creating a pattern so I don't waste my time


So here using python pattern exploit script I generate 5000 random patterns and feed it into "evil.mp3" file


Download the evil.mp3 file and load it inside the program by choosing the "convert"  button that has a gear logo on it (in order for the panel to notice your file you need to change the file of type to "Any file")


Once you loaded it go to your immunity debugger again and as you can see we successfully overwrite the EIP


Now we need to find how many offsets we need to overwrite the SEH chain and redirect it to our shellcode. Type "!mona findmsp"


So we got the pattern "0x46326846" before we translate this into ASCII you guys need to be aware that the value needs to be reversed since it is still in little-endian.


"0x46326846" => "0x46683246" => "Fh2f"

and we got 4116 bytes of offset to need to overwrite the SEH check.

next, you can create script to check the offset right or not like below:



cool we overwrite the SEH check and now all we have to is to use the immunity debugger to find a Ropgadget to be used as a replacement for our SEH chain. Type "!mona seh"


So we got a bunch of results that we can use for the replacement, my tips for you guys is to choose the ROPgadget that have a connection with known .dll this is advantageous to your exploit since it can be used in many versions of windows.


You can check the rest of the SEH entry in "seh" file in immunity debugger folder inside your computer c:/ directory

combine with our script like below and we are able to take control of the program SEH chain.



next, we just need to update the next_seh variable to be "\xeb\x06\x90\x90" since this equivalent to jump 8 bytes and with this instruction, it can reach our payload.

Note: in the middle of analysis I try to use shellcode that open reverse shell connection to my host but due to the problem of the bad character I could not execute my shell and addition I still don't have necessary knowledge to build my own shellcode so I just use shellcode that open a calculator for the POC

update our code to be like this:



run the python script and load the generated file to the program and as you can see it open a calculator program


Here is the catch:

as I promised in the introduction I will show you something that makes you think twice when implementing secure coding. Ok ! so take a look again at the mona log when show EIP, SEH offset

mona log for FREE MP3 CD ripper:


can you spot something wrong?

yeah the EIP is located before the SEH chain not after the SEH chain different from the previous post where SEH chain is located before EIP (DVD X player)

mona log for DVD X player:


so what this is means? the SEH is completely useless lol since we already able to overwrite the EIP before SEH catch exception we can just redirect the program execution to the shellcode

if we try to generate the file using this script:


note: I got the EIP variable value from executing "mona jmp -r esp" like in the first tutorial of breaking code

and load it into the program and also check the stack we can see it is true:


Update the previous script like this and we got the program to call the calculator :D




Lol :D I hope you enjoy this post

the last part is entirely based on my analysis if you think there is a mistake let me know

thank you

Comments

  1. hello sir, can you provide the link for Free MP3 CD Ripper 2.8 you tested? Many thanks.

    ReplyDelete
    Replies
    1. https://www.exploit-db.com/apps/64215b82be8bb2e749f95fec5b51d3e4-FMCRSetup-2.6.exe

      Delete

Post a Comment

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...

Bypassing stack canaries protection :') (day 51)

In my previous blogs, I show you guys how to bypass some common protection usually used in Linux binary such as NX and ASLR but this time we are going to take it to the next level we are going to talk about protection employ in the modern Linux OS which is "The Canaries" and how to bypass it. note: this post was not originally mined it was inspired by the following resources https://ctf-wiki.github.io/ctf-wiki/pwn/linux/mitigation/canary/ (Credit goes to the author) we are going to start this post about what is stack canaries and types of different implementation of it then move to the implementation about how to bypass this protection. We are going to focus on "leak canaries" technique What is stack canary: In layman terms, canaries are just another protection mechanism to prevent stack overflow implemented by appending 4/8 bytes value (depend on the architecture) into the stack when a function is entered. When the function is at the end of its exec...