4

I was trying to reverse engineer an apk built with flutter. I actually feel like reversing flutter built apps did not get much reverse writeups on the community. one of the tools for the task reflutter which I used in this case failed because the flutter version built with the apk is not supported by the reflutter. so the author provided docker image in which one allows to implement his own patches there is manual Flutter code change is supported using specially crafted Docker. but the environment variables passed there, included HASH_PATCH=[Snapshot_Hash] COMMIT=[Engine_commit]. in this case if I know the snapshot Hash from the apk how can I get the matching Engine commit for example in this case this is Engine SnapshotHash: adb4292f3ec25074ca70abcd2d5c7251, so how can I retrieve the matching Engine Commit?

4
  • I am facing the same problem (same snapshot hash), Digging in google i found a commit in github with the engine hash that matches our hash, but, after executing the docker command, it fails. I tried to execute it in a docker instance but it fails. Commit: github.com/jayluxferro/custom-flutter-engines/pull/72 The docker command i tried is: docker run -e WAIT=300 -e x64=0 -e arm=0 -e HASH_PATCH=adb4292f3ec25074ca70abcd2d5c7251 -e COMMIT=ada363ee93b17cfe31587b5102679885cb40837e --rm -iv$(pwd):/t ptswarm/reflutter I also tried to modify the source code of reflutter to force the program to Mar 23, 2023 at 11:53
  • ... "use that engine hash and i was able to generate the apk but i cant intercept traffic so i think it didn't work" would the above comment continue. It was posted as answer, when it clearly isn't one, though.
    – 0xC0000022L
    Mar 24, 2023 at 11:36
  • @MarioRuano do you still get any solution for this? I mean what was the error failure from the docker?
    – hanan
    Mar 24, 2023 at 13:23
  • @MarioRuano when I try to build the docker image it hangs at 1:23:48 time every time I tried to build it. the logs don't get update such time. are we seeing same?
    – hanan
    Mar 31, 2023 at 11:42

1 Answer 1

0
+50

Looks like https://github.com/Impact-I/reFlutter/blob/main/enginehash.csv is a definite source of these versions, Engine_commit and Snapshot_Hash

So from there

version Engine_commit Snapshot_Hash
3.7.12 1a65d409c7a1438a34d21b60bf30a6fd5db59314 adb4292f3ec25074ca70abcd2d5c7251

PS: https://github.com/ptswarm/reFlutter/ is archived and https://github.com/Impact-I/reFlutter is recently updated.

The snapshot hash is calculated by this script

The dart_revision mentioned here is a commit from dart/sdk

So to effectively know where does this hash belong to - we need to checkout different commits of https://github.com/dart-lang/sdk, generate the snapshot hash of each and check where was the commit referenced in https://github.com/flutter/engine/blob/main/DEPS

I see that this has been implemented in https://github.com/Impact-I/reFlutter/blob/main/scripts/gen_enginehash.py to generate the CSV linked above. It would make sense to read this script and see if it misses something.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.