mandiant / VM-Packages

Chocolatey packages supporting the analysis environment projects FLARE-VM & Commando VM.
Apache License 2.0
147 stars 67 forks source link

Package proposal: ida.plugin.flare.vm #1032

Closed Ana06 closed 6 months ago

Ana06 commented 6 months ago

Details

Several people have told me that they find the plugins shellcode_hashes_search_plugin.py and apply_callee_type_plugin.py from https://github.com/mandiant/flare-ida useful. As proposed by @thejoelpatrol in https://github.com/mandiant/flare-vm/issues/593#issuecomment-2098665900, add a ida.plugin.flare.vm package that copies https://github.com/mandiant/flare-ida/tree/master/plugins to the plugins directory. We can't use the issue template + automation because it requires a more complicated installation. I'll explore how difficult it is to do it!

Ana06 commented 6 months ago

I have been exploring installing the plugins in https://github.com/mandiant/flare-ida/tree/master/plugins:

So I am going to create a ida.plugin.flare.vm package that:

I am going to use the latest hash commit, which means no updates would be done automatically. A better future-proof solution, would be that https://github.com/mandiant/flare-ida proves a release with the following structure: plugins files (in the root) and the flare module folder (including the DB as proposed above). This would allow us to use our function helpers to install the plugins (even if new ones would added in the future) and automatically update to new releases using our bot. But it seems the repository hasn't been updated much recently, so not sure if this is worthwhile. @mandiant/flare-vm @jhsmith @mr-tz opinions?

emtuls commented 6 months ago

In regards to shellcode_hashes_search_plugin.py and the necessary .db file that has to be generated, I think there is a better alternative that exists and is much simpler. OALabs has made a similar plugin without the headache of needing to run extra scripts to generate hashes and it also has many more hash options in it's database: https://github.com/OALabs/hashdb (IDA Plugin: https://github.com/OALabs/hashdb-ida)

It even references the fact that the idea comes from our shellcode_hashes and aims to improve it's usability: https://github.com/OALabs/hashdb?tab=readme-ov-file#standing-on-the-shoulders-of-giants

I've used it many times and I know a few others on the team have as well. The only thing that I see that the shellcode_hashes_search_plugin.py does that HashDB doesn't do is that it can create a struct automatically with a list of functions that are matched, if they are found consecutively in the IDB. This is cool, but also can be done without much extra effort manually and/or via a script. I'm sure we could also get that feature added to HashDB if we wanted to go that route.

Ana06 commented 6 months ago

I have already created the package (it is the flare_ida branch of my fork). But I think @emtuls is right and we should use https://github.com/OALabs/hashdb-ida) instead. @thejoelpatrol @mr-tz what do you think about this option?

I think we should still add apply_callee_type_plugin.py. But in this case, I think it is not worth to add the whole flare directory as I think we only need the following three files: apply_callee_type.py, apply_callee_type_widget.py, and jayutils.py. It would be ideal if the apply_callee_type_plugin.py was released including the code needed from the other three files so that we could install it as a single file as most IDA plugins do.

mr-tz commented 6 months ago

I suggest to keep it simple and your research and work look great. The repository is a bit dated and not structured/released for easy automatic setup.

Ana06 commented 6 months ago

I have added ida.plugin.hashdb.vm in #1037. But while testing the plugin, I have noticed that because it relies on a server for the signatures, it can't be used without internet connection. I think I would like to have shellcode_hashes_search_plugin as well. I am going to add it to #1036 and rename the package to ida.plugin.flare.vm (as it will include two flare packages).