Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of invalid instructions when analyzed by ghidra and radrare2 #16

Open
DrmnSamoLiu opened this issue Aug 5, 2020 · 2 comments
Open

Comments

@DrmnSamoLiu
Copy link

First of all great project 馃憤 I can imagine this project will help tons of firmware researchers out there.

I've met a problem though.
I'm currently doing research on a network camera firmware. Although binwalk didn't really identified vmlinux.img in the firmware analysis, I managed to found the portion of raw binary that is supposed to be the kernel image for the camera.
The data portion can be successfully analyzed and convert into ELF file by your script. However when I tired to use Ghidra to analyze it, it produces a lot of "invalid instruction" error. (Same in radare2)

The camera is running on a MIPS processor and your script have no problem identifying it, so I'm not sure what the problem might be.
Other binaries from the same firmware file can be analyzed without problem when setting language as MIPS:LE:64:64-32addr:o32 in Ghidra.

The data portion I mentioned can be downloaded here : https://drive.google.com/file/d/15gWN5dsWeiSefHpzh9VzPfwiUEpg_GKL/view?usp=sharing

@marin-m
Copy link
Owner

marin-m commented Aug 5, 2020

Hello,

Thanks for your feedback. I have processed your sample kernel with the tool and the ELF file seems to be reconstructed fine. The offsets are calculated correctly and the functions decompile with Ghidra or disassemble from beginning of their prologues with IDA..

Maybe that the Ghidra warnings that your see are due to the fact that the unique .kernel ELF section produced by the tool mixes codes and non-code, which should not impair decompiling.

image

Regards,

@DrmnSamoLiu
Copy link
Author

@marin-m Thank you for your swift response! It's great to know that the output file has no problem. Now it's my job to figure out how to make ghidra analyze it properly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants