Skip to main content

Firmware Reverse Engineering 1 (¬‿¬) (day 31)


Image result for firmware meme

I'm having so much fun doing reverse engineering on the software side but today I think I have to step furthermore. In this post, I'm going to show you how to do firmware reverse engineering.

note: this is only a gentle introduction to this field, the purpose of this post is only based on curiosity

Pick a target:


for this post, I just pick a random firmware from google and I think this should be a pretty decent product to start with it.

I download it and we got some zip file


okay inside the zip file we have two files and as we can see the home file is a u-boot image that may contain the structure of the firmware whereas home_y18m is just plain data.


okay, let's do a binwalk to see what's inside the boot image.


hmmm, interesting so we have 2 part inside the boot image first is just a header that takes up first 64 bytes and second part is the actual filesystem which uses the JFFS filesystem

you can check the entropy of the file by using binwalk again just to see if the file is compressed or not.






let's do a quick check for the home_y18m file if it contains any interesting section.


well the binwalk cannot find anything so we are going to ignore this file

Okay let's try to extract the filesystem using dd command


cool we able to separate the filesystem from the boot image, but it's still in binary format so how do we able to extract filesystem?

luckily, there is already a tool that able to do the task for us:

link: https://github.com/sviehb/jefferson


awesome we are able to extract all the filesystem and put it into the cam_dir



hmmm looks like all of the binary inside the filesystem is using ARM instructions

ok, let's try to poke around the file inside the directory, just to get the overall knowledge on each binary.


notice there is a binary called crypt_file and by just doing string analysis we can see that the binary is using AES encryption.


that's all for the crypt_file since I'm not yet fluent reading the ARM instructions


using bash script I try to do string analysis more just to check if the firmware contains any default password. I try to execute it and didn't find anything interesting

Hope this helpful Enjoy :D

source:

https://www.youtube.com/watch?v=oqk3cU7ekag


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

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