muun / apollo

Muun Android wallet
https://muun.com
MIT License
255 stars 46 forks source link

46.10 Fails Verification #51

Closed marqusat closed 2 years ago

marqusat commented 2 years ago

I have successfully verified 46.7 running reproducible build on my machine. 46.10 has unfortunatelly badly failed verification. I have double checked I'm verifying against the correct source code commit (e4220f8462183bf2bfdda92356888b28cb29d431) and that downloaded apk is 46.10 (610 versionCode). Many files are not matching what's on Play Store, including library .so and compiled code .dex files:

Binary files /tmp/tmp.pdDcRlqqM6/to_verify/AndroidManifest.xml and /tmp/tmp.pdDcRlqqM6/baseline/AndroidManifest.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/classes2.dex and /tmp/tmp.pdDcRlqqM6/baseline/classes2.dex differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/classes.dex and /tmp/tmp.pdDcRlqqM6/baseline/classes.dex differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/lib/arm64-v8a/libgojni.so and /tmp/tmp.pdDcRlqqM6/baseline/lib/arm64-v8a/libgojni.so differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/lib/armeabi-v7a/libgojni.so and /tmp/tmp.pdDcRlqqM6/baseline/lib/armeabi-v7a/libgojni.so differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/lib/x86/libgojni.so and /tmp/tmp.pdDcRlqqM6/baseline/lib/x86/libgojni.so differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/lib/x86_64/libgojni.so and /tmp/tmp.pdDcRlqqM6/baseline/lib/x86_64/libgojni.so differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/drawable/$avd_hide_password__0.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/drawable/$avd_hide_password__0.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/drawable/$avd_hide_password__1.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/drawable/$avd_hide_password__1.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/drawable/$avd_show_password__0.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/drawable/$avd_show_password__0.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/drawable/$avd_show_password__1.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/drawable/$avd_show_password__1.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/drawable/design_ic_visibility.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/drawable/design_ic_visibility.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/accept_recovery_code_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/accept_recovery_code_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/activity_lnurl_intro.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/activity_lnurl_intro.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/activity_lnurl_withdraw_confirm.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/activity_lnurl_withdraw_confirm.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/activity_lnurl_withdraw.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/activity_lnurl_withdraw.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/activity_new_operation.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/activity_new_operation.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/activity_select_bitcoin_unit.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/activity_select_bitcoin_unit.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/activity_send.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/activity_send.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/dialog_welcome_to_muun.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/dialog_welcome_to_muun.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/dynamic_feature_install_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/dynamic_feature_install_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/edit_amount_item.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/edit_amount_item.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/edit_username_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/edit_username_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/error_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/error_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/expiration_time_item.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/expiration_time_item.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/feedback_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/feedback_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/first_on_muun_view.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/first_on_muun_view.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_ek_save.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_ek_save.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_export_keys_intro.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_export_keys_intro.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_home.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_home.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_rc_login_email_auth.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_rc_login_email_auth.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_rc_only_login.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_rc_only_login.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_recovery_tool.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_recovery_tool.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_security_center.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_security_center.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_settings.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_settings.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_setup_password_accept.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_setup_password_accept.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_setup_password_intro.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_setup_password_intro.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_setup_password_success.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_setup_password_success.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_show_qr_ln.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_show_qr_ln.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_show_qr.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_show_qr.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/fragment_verify_email.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/fragment_verify_email.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/home_operations_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/home_operations_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/landing_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/landing_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/lightning_settings_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/lightning_settings_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/login_email.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/login_email.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/manual_fee_input.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/manual_fee_input.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/manual_fee_selection_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/manual_fee_selection_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/mtrl_calendar_month_navigation.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/mtrl_calendar_month_navigation.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/mtrl_picker_actions.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/mtrl_picker_actions.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/mtrl_picker_header_fullscreen.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/mtrl_picker_header_fullscreen.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/muun_contact_list.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/muun_contact_list.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/muun_task_card.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/muun_task_card.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/muun_uri_input.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/muun_uri_input.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/muun_uri_paster.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/muun_uri_paster.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/new_operation_error_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/new_operation_error_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/old_password_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/old_password_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/operation_detail_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/operation_detail_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/priming_recovery_code_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/priming_recovery_code_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/recovery_code_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/recovery_code_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/scan_qr_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/scan_qr_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/security_logout_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/security_logout_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/set_up_pin_code.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/set_up_pin_code.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/show_recovery_code_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/show_recovery_code_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/signup_forgot_password_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/signup_forgot_password_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/signup_phone_number_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/signup_phone_number_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/signup_profile_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/signup_profile_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/signup_unlock_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/signup_unlock_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/signup_verification_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/signup_verification_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/signup_waiting_for_email_verification_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/signup_waiting_for_email_verification_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/sync_contacts_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/sync_contacts_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/verify_recovery_code_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/verify_recovery_code_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/view_muun_home_card.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/view_muun_home_card.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/view_new_home_tooltip.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/view_new_home_tooltip.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout/v_item_currency.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout/v_item_currency.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-land/fragment_settings.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-land/fragment_settings.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-land-v21/fragment_settings.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-land-v21/fragment_settings.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/activity_lnurl_intro.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/activity_lnurl_intro.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/activity_lnurl_withdraw_confirm.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/activity_lnurl_withdraw_confirm.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/error_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/error_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/first_on_muun_view.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/first_on_muun_view.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/fragment_security_center.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/fragment_security_center.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/fragment_settings.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/fragment_settings.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/new_operation_error_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/new_operation_error_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v21/signup_verification_fragment.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v21/signup_verification_fragment.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/layout-v22/muun_uri_input.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/layout-v22/muun_uri_input.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/menu/activity_show_qr.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/menu/activity_show_qr.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/menu/home_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/menu/home_activity.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/menu/menu_bottom_nav.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/menu/menu_bottom_nav.xml differ
Binary files /tmp/tmp.pdDcRlqqM6/to_verify/res/menu/select_currency_activity.xml and /tmp/tmp.pdDcRlqqM6/baseline/res/menu/select_currency_activity.xml differ
Verification failed :(
champo commented 2 years ago

Hi @marqusat, thanks for reporting this! I'll try to reproduce your results and get back to you on this ASAP.

In the meantime, I have a few questions just to make sure we're on the same page.

  1. How did you extract the APK to verify? What did device did you use?
  2. Did you use the script in the repo to verify it?
  3. What's your docker version?
marqusat commented 2 years ago

Thanks for the quick reply! Answers:

  1. db pull $(adb shell pm path io.muun.apollo | grep "/base.apk" | sed 's/^package://') apollo-play.apk (BUILD.md instructions)
  2. yes I used verify-apollo.sh
  3. Docker version 19.03.15, build 99e3ed8919

Not sure if I understand the second question in point 1. Do you mean my Android device? How that could be relevant considering you're not letting google to assemble and sign the apk but upload apk signed with your private key?

champo commented 2 years ago

That question is a bit of a strech 🤷 The changed files are quite odd. We haven't touched most of those files in some time. So I'm trying to understand if there's a possbility the device "optimized" the installed APK after verifying the signature.

I was just able to reproduce the build locally, with a newer version of docker. Can you trying running the build again with https://github.com/muun/apollo/commit/135ddc6a07a47c02959ec280271cd5e7985de9b0 ? It adds a flag when building that has fixed some issues in the past with some versions of docker.

marqusat commented 2 years ago

That output maybe perhaps more useful if you asking to check if the apk is matching what you uploaded to Play Store. Is the public key SHA-356 digest matching your private app signing key?

$apksigner verify --verbose --print-certs apollo-play.apk 
Verifies
Verified using v1 scheme (JAR signing): true
Verified using v2 scheme (APK Signature Scheme v2): true
Verified using v3 scheme (APK Signature Scheme v3): true
Verified using v4 scheme (APK Signature Scheme v4): false
Verified for SourceStamp: false
Number of signers: 1
Signer #1 certificate DN: CN=Patricio, OU=muun, O=muun, L=Buenos Aires, ST=Unknown, C=AR
Signer #1 certificate SHA-256 digest: 026ae0ac859cc32adf2d4e7aa909daf902f40db0b4fe6138358026fd62836ad1
Signer #1 certificate SHA-1 digest: 67f100fe596b4b0e4f40312e41e1e74e4274e615
Signer #1 certificate MD5 digest: a1ba5818239b79235741597e8dbd59ee
Signer #1 key algorithm: RSA
Signer #1 key size (bits): 2048
Signer #1 public key SHA-256 digest: 5c90f8c82d9cb371cc3e1d55fcf1ebafd2661b9e394c6dc6b0882accd98a1dca
Signer #1 public key SHA-1 digest: 089fce8ee59791b7986d80d72b58d1a443714075
Signer #1 public key MD5 digest: 686362c9baafe0eaa4d9f07e71d352f8

Actually sha256 will serve the same purpose to check if it's the right apk and will be quicker to check:

$ sha256sum apollo-play.apk 
e7504467c314b576f5f0c45eeb135396f4d771f976e886bc9b0e1111f1172ff8  apollo-play.apk
marqusat commented 2 years ago

if there's a possbility the device "optimized" the installed APK after verifying the signature

I don't think that's done on the level of apk. If the above key/hash match (?) then we will be able to confidently assume that I've got the right apk.

Running with DOCKER_BUILDKIT=1 added.

marqusat commented 2 years ago

Another person here: https://github.com/muun/apollo/issues/30 got the same sha256 of your app signing key.

marqusat commented 2 years ago

Verification success! thanks! I guess that issue should be closed when the buildkit change is merged so keeping it open.

champo commented 2 years ago

Glad that worked!

Thanks for keeping an eye open and helping us be safer for everyone!