Zap: Bitcoin Lightning Wallet

3 minute read

Published:

Wallet Logo

This relatively new app currently has more than 1000 downloads and the latest APK (version Varies with device) was from 2nd December 2019.

Our analysis was done on 30th December 2019 based on data found in their Playstore description and their website and their source repository. We discuss the issue with verification with the provider here. In our GitLab this app is discussed in Issue #90.

We found these ways of contacting the developers:

Help spread awareness for build verifiability

Please help us spread the word, asking Zap: Bitcoin Lightning Wallet to support verifiable builds via their Twitter!

Disclaimer

The following Analysis is not a full code review! We plan to make code reviews available in the future but even then it will never be a stamp of approval but rather a list of incidents and bad coding practice. We cannot find and tell you all the dark secrets the wallet providers might have.

Do your own research!

Try out searching for "lost bitcoins", "stole my money" or "scammers" together with the wallet's name, even if you think the wallet is generally trustworthy. For all the bigger wallets you will find accusations. Make sure you understand why they were made and if you are comfortable with the provider's reaction.

The Analysis

Their description

Manage your private keys, multiple wallets, and open channels, to get connected with peers on the Lightning Network and start transacting today.

sounds non-custodial.

On their website we find their GitHub repository and there a bit hidden, the build instructions.

So let’s try this without Android Studio, as we don’t want to automate clicking buttons in Android Studio …

For my phone Google Play offers to download version 0.2.11-alpha.

$ cd zap-android/
$ git tag | grep 0.2.11
v0.2.11-alpha
$ git checkout v0.2.11-alpha 
$ docker run --rm -it --volume=$PWD:/mnt --workdir /mnt mreichelt/android:latest bash
root@84c836f4577a:/mnt# ./gradlew bundleRelease
root@84c836f4577a:/mnt# mv app/build/outputs/apk/release/zap-android-0.2.11-alph* .
root@84c836f4577a:/mnt# exit
$ ls *.apk
'zap-android-0.2.11-alpha(17)-arm64-v8a-release-unsigned.apk'  'zap-android-0.2.11-alpha(17)-armeabi-v7a-release-unsigned.apk'

So … this is a problem. The version “Varies with device” as we already noticed on the Playstore description. App providers can publish a different app for you than they publish for me, so me verifying a build gives you not much of information. This is why we are also working on a tool to collect APKs that hopefully soon will detect which version you downloaded, check if it was already verified to match the published code and upload it to us if not.

Should we be able to verify the one APK but naturally not the other, this should be our top priority to work on.

$ apktool d -o fromBuild-arm64-v8a 'zap-android-0.2.11-alpha(17)-arm64-v8a-release-unsigned.apk'
$ apktool d -o fromBuild-armeabi-v7a 'zap-android-0.2.11-alpha(17)-armeabi-v7a-release-unsigned.apk'
$ apktool d -o fromPlay Zap\ 0.2.11-alpha\ \(zapsolutions.zap\).apk 
$ diff --brief --recursive fromPlay/ fromBuild-armeabi-v7a/
Files fromPlay/apktool.yml and fromBuild-armeabi-v7a/apktool.yml differ
Only in fromPlay/lib: arm64-v8a
Only in fromBuild-armeabi-v7a/lib: armeabi-v7a

… so my phone installed the arm64 version but as

$ diff --brief --recursive fromPlay/ fromBuild-arm64-v8a/
Files fromPlay/apktool.yml and fromBuild-arm64-v8a/apktool.yml differ
Files fromPlay/lib/arm64-v8a/libiconv.so and fromBuild-arm64-v8a/lib/arm64-v8a/libiconv.so differ
Files fromPlay/lib/arm64-v8a/libzbarjni.so and fromBuild-arm64-v8a/lib/arm64-v8a/libzbarjni.so differ
Only in fromPlay/original/META-INF: CERT.RSA
Only in fromPlay/original/META-INF: CERT.SF
Files fromPlay/original/META-INF/MANIFEST.MF and fromBuild-arm64-v8a/original/META-INF/MANIFEST.MF differ
Files fromPlay/res/drawable-hdpi/ic_icon_modal_on_chain.png and fromBuild-arm64-v8a/res/drawable-hdpi/ic_icon_modal_on_chain.png differ
Files fromPlay/res/drawable-ldpi/ic_icon_modal_on_chain.png and fromBuild-arm64-v8a/res/drawable-ldpi/ic_icon_modal_on_chain.png differ
Files fromPlay/res/drawable-mdpi/ic_icon_modal_on_chain.png and fromBuild-arm64-v8a/res/drawable-mdpi/ic_icon_modal_on_chain.png differ
Files fromPlay/res/drawable-xhdpi/ic_icon_modal_on_chain.png and fromBuild-arm64-v8a/res/drawable-xhdpi/ic_icon_modal_on_chain.png differ
Files fromPlay/res/drawable-xxhdpi/ic_icon_modal_on_chain.png and fromBuild-arm64-v8a/res/drawable-xxhdpi/ic_icon_modal_on_chain.png differ
Files fromPlay/res/drawable-xxxhdpi/ic_icon_modal_on_chain.png and fromBuild-arm64-v8a/res/drawable-xxxhdpi/ic_icon_modal_on_chain.png differ
Files fromPlay/res/raw/country_list.json and fromBuild-arm64-v8a/res/raw/country_list.json differ
Files fromPlay/res/raw/currency_list.json and fromBuild-arm64-v8a/res/raw/currency_list.json differ
Files fromPlay/smali/com/squareup/okhttp/internal/DiskLruCache$2.smali and fromBuild-arm64-v8a/smali/com/squareup/okhttp/internal/DiskLruCache$2.smali differ
Files fromPlay/smali/com/squareup/okhttp/internal/framed/FramedStream$FramedDataSource.smali and fromBuild-arm64-v8a/smali/com/squareup/okhttp/internal/framed/FramedStream$FramedDataSource.smali differ
Files fromPlay/smali_classes2/io/grpc/internal/DelayedStream$DelayedStreamListener.smali and fromBuild-arm64-v8a/smali_classes2/io/grpc/internal/DelayedStream$DelayedStreamListener.smali differ

contains more than the expected two to three files about the signature, this is not a clean reproducible build.

Our verdict: not verifiable.

Verdict Explained

Not verifiable: The provided Open Source Code could not be verified to match the app released on Google Play

This verdict means that the provider did share some source code but that we could not verify that this source code matches the released app. This might be due to the source being released later than the app or due to the provided instructions on how to compile the app not being sufficient or due to the provider excluding parts from the public source code. In any case, the result is a discrepancy between the app we can create and the app we can find on GooglePlay and any discrepancy might leak your backup to the server on purpose or by accident.

As we cannot verify that the source provided is the source the app was compiled from, this category is only slightly better than closed source but for now we have hope projects come around and fix verifiability issues.

The app cannot be independently verified. If the provider puts your funds at risk on purpose or by accident, you will probably not know about the issue before people start losing money. If the provider is more criminally inclined he might have collected all the backups of all the wallets, ready to be emptied at the press of a button. The app might have a formidable track record but out of distress or change in management turns out to be evil from some point on, with nobody outside ever knowing before it is too late.