worawit / blutter

Flutter Mobile Application Reverse Engineering Tool
MIT License
760 stars 128 forks source link

IDA decompiled code is incorrect #8

Closed coderjingluo closed 9 months ago

coderjingluo commented 9 months ago

image

When using IDA to decompile into c code, it seems that because it is written in dart, a function is decompiled to incorrect code in many places。Do you have a way to get ida to decompile the correct c code from the dart stack? https://www.guardsquare.com/blog/obstacles-in-dart-decompilation-and-the-impact-on-flutter-app-security

worawit commented 9 months ago

IDA cannot decompile correctly because Dart use its own call convention, register usages, ... In the link, they patch Stack pointer, manually set call arguments for functions, manually create struct for Dart objects to get the nice result. But you have to understand Dart call convention and objects to do it.

In my opinion, reading the assembly with comment is easier than wrong decompiled code.

Note: The code analysis feature is still developing. When finished, more information will be shown in the assembly. Then code should be easier to read.