Skip to content

fix: detect real Flutter snapshot hash in elff() - #387

Open
4B3R4M4-607D wants to merge 1 commit into
Impact-I:mainfrom
4B3R4M4-607D:fix/elff-binary-scan
Open

4B3R4M4-607D wants to merge 1 commit into
Impact-I:mainfrom
4B3R4M4-607D:fix/elff-binary-scan

Conversation

@4B3R4M4-607D

Copy link
Copy Markdown

Why

elff() currently opens the target binary in text mode (errors="ignore"), which silently drops non-UTF8 bytes and then concatenates printable segments that were originally separated by binary bytes. When those concatenated segments happen to form a 32-character hex string, it is returned as the engine snapshot hash — even though it is not a real hash.

This makes reFlutter report This engine is currently not supported. for apps whose real snapshot hash is present in enginehash.csv. Any app whose binary layout triggers this false-positive string is wrongly rejected.

What Changed

  • elff() now reads the file as binary and collects only contiguous 32-hex ASCII runs.
  • It prefers a candidate that exists in enginehash.csv (cached module-wide) so the real snapshot hash wins even when other 32-hex runs appear earlier in the file.
  • Fallbacks: first non-low-entropy run, then first run (preserves old error behaviour when no known hash is found).

Verification

Reproduced on an iOS app (Flutter 3.24.0 engine):

Result
Before (upstream elff) fake 32-hex string — engine rejected
After (this fix) real snapshot hash — engine recognized, release.RE.ipa produced

The fix was independently confirmed by scanning both App.framework/App and Flutter.framework/Flutter for contiguous 32-hex runs, and matching the result against enginehash.csv.

The old elff() opened the binary in text mode with errors='ignore',
which dropped non-UTF8 bytes and concatenated printable segments that
were separated by binary bytes. This produced fake 32-hex strings that
are not real snapshot hashes, causing 'This engine is currently not
supported' even when the real hash exists in enginehash.csv.

Read the file as binary and collect contiguous 32-hex ASCII runs,
preferring candidates that appear in enginehash.csv.
@4B3R4M4-607D
4B3R4M4-607D marked this pull request as ready for review August 28, 2026 08:06
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

Successfully merging this pull request may close these issues.

1 participant