Penetration Test Report (KudelskiSecurity-X41): X41 Kudelski Wire Security Review Android

WireSecurityReview–Phase2–AndroidClient
forWireSwissGmbH
FinalReport
2018-03-07
FORPUBLICRELEASE
Contents
1 Summary 2
2 AndroidClientReview 3
2.1 Privacy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4 Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.5 Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.6 CodeQuality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.7 ImplementationSecurityIssues . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3 About 33
1
1 Summary
This report is a review of Wire’s Android application security and privacy, describing
strengthsandlimitations,andhighlightinganumberofminorshortcomingsandpotential
improvements.Wealsoreportfivelow-severitysoftwarebugsandonehigh-severitybug.
Thesourcecodeauditotherwisereflectedadherencetosecuresoftwaredevelopment
principles.
As noted throughout the report, Wire has adequately addressed the security issues
reported.
ThemainWirerepositoriescoveredduringthereviewarewire-android,wire-android-
sync-engine,andwire-cryptobox-jni.
Thisreviewdoesnotcover:
• thecorecryptographycomponentProteus,previouslyreviewed1;
• thecallingmechanism,coveredinaseparatereview;
• codeofthird-partydependencies.
The work was performed between March and November 2017, by Jean-Philippe
Aumasson(KudelskiSecurity)andMarkusVervier(X41D-SecGmbH),withsupportfrom
YolanRomailler(KudelskiSecurity).Atotalof9person-dayswerespent.Itreflectsthe
codebaseasprovidedduringthetimeofreview.
1https://www.x41-dsec.de/reports/Kudelski-X41-Wire-Report-phase1-20170208.pdf
2
2 Android Client Review
WereviewedsecurityandprivacyfeaturesoftheWireAndroidclient,mainlybasedon
thesourcecodereview, aswellasondynamicanalysisoftheofficialWireAPKusing
deviceemulators,arooteddevice,andtestdevices.
The following sections illustrates how the Wire Android application protects against
various technical risks, highlighting potential issues and providing mitigation
recommendations.
Severalobservationsweremadeonolderversionsoftheapplications(asofMarch2017),
butallobservationsreportedinthisversionofthereportapplytotheversionoftheapp
availablemidNovember2017:
• wire-android:revision4135eada49b6f8504822cef59bad808dee2da2e7;
• wire-android-sync-engine:565b72cb22fe315f79850ef728b3baa0ff516d77.
2.1 P
RIVACY
Thissectionsummarizesourreviewofpotentialprivacyleaks.
2.1.1 LogcatLeaks
Wedidnotfindprivacyleaksinthelogsgeneratedbythereleasedapplication.
WhenfollowingtheinstructionsintheprovidedREADME.md1 file,nosensitivedatais
senttothelogs.However,usersbuildingtheappthemselvesshouldknowthatadefault
1https://github.com/wireapp/wire-android/blob/master/README.md
3
WireSecurityReview–Phase2–AndroidClient WireSwissGmbH
buildoftheappwillenableverbose-levellogs,whichwritevarioussensitiveinformation
totheAndroidlogcat.Examplesarecontentofmessages,emailaddressandpassword
lengthatlogin.
2.1.2 UninstallLeftovers
After installing the application, using it to send and receive a few messages, and
uninstallingit,wedidnotfindfilescreatedbytheinstallationortheusageoftheappthat
wouldrevealapreviousinstallationoftheapponthedevice,withtheexceptionoflogcat
andappusagelogs.
TheWireappwasfoundtohaveaminimalfootprintonthedevice,withdownloadedfiles
inthelocationsonemayexpectforthem.Notablypictureandaudiofilesarenotstored
inapubliclyaccessibleway.
Afteruninstalling,filesareremovedwiththeexceptionof:
• VideorecordingslocatedinthePictures/WIRE_MEDIAfolder.Failedrecordingsare
alsokept,whichshouldbeavoidedandfixed.(Toreproduce:beginrecording,stop
recordingandkillthewireappwhenofferedwiththe“Retry/Ok”.)
• DownloadedfilesarekeptintheDownloadfolder, withoutanymentionofWire,
hencedoesnotrevealtheuseofWire. However,PicturesaresstoredinaWire/
folder.
• Tracescanstillbefoundinthelogs(logcat,typically)andusagestatsoftheAndroid
system.
Regarding the persistence of video recordings, we recommend using the internal
Android file storage as often as possible instead of the external, world readable one.
Upon uninstalling, the internal storage is automatically wiped by Android. This can
howeverbeaproblemiflargevideosaretakensincethosecouldfilluptoomuchspace.
Themethodhandlingthemediacaptureisinthefilewire-android/app/src/main/java
/com/waz/zclient/pages/main/conversation/AssetIntentsManager.java, where
it’srequestingexternalstorageinsteadofinternalonetostorethevideofiles.
FORPUBLICRELEASE Page4of34
WireSecurityReview–Phase2–AndroidClient WireSwissGmbH
WirehasaddressedtheseissuesbyremovingreferencestoWirefordownloadedfiles
andpictures2,deletingfailedrecordings3andtemporaryvideofiles4.
2.1.3 TelemetryData
Localyticsisusedtoperformanalyticsbasedonuserusagedata.Userscanoptoutofthis
trackinginthesettings,butbydefaultdatasuchasthefollowingistracked:
• typeofconnection(WiFi,4G,etc.);
• thetime,size,andtypeofassetsexchanged(photo,audio,video,orotherfiles);
• calldurationandtype(audioorvideo),etc.
Suchdatacanobviouslyleakprivacy-sensitiveinformation, evenifthedataisshared
anonymously.WiremigratedtoMixpanelduringthereview.Thereviewedcodewasstill
usingLocalytics.
2.1.4 CrashReports
HockeyAppisusedtocollectandcrashreportsfromtheapplicationandsharethemwith
WireforQApurposes.
Thesereportsdonotseemtoincludeobvioussensitiveinformation,sincetheymainly
containJavastacktraces.Yetstacktracesandexceptionmessagescanrevealpotentially
sensitiveinformationsuchascontentURIs:
src/main/scala/com/waz/service/downloads/Downloader.scala
1
25:import com.waz.HockeyApp
2
165: HockeyApp.saveException(ex, s"video transcoding failed for uri: ${asset.uri}")
3
186: case cause: Throwable => HockeyApp.saveException(cause, s"audio encoding failed
4
for URI: $uri")
5
2Seehttps://github.com/wireapp/wire-android-sync-engine/pull/301/andhttps://github
.com/wireapp/wire-android/pull/1400
3Seehttps://github.com/wireapp/wire-android/pull/1414
4Seehttps://github.com/wireapp/wire-android-sync-engine/pull/308
FORPUBLICRELEASE Page5of34
WireSecurityReview–Phase2–AndroidClient WireSwissGmbH
Listing2.1:CrashReports
Thisspecificissueandothersimilaroneshavebeenfixedinthelatestversionoftheapp
(theassetURIisnotrecordedanymore).
WirehasaddressedthisissuebyremovingsensitivedatasuchasidentifiersandURIs
fromHockeyAppexceptiondescriptions5.Additionallyuserscanoptoutofthistracking
inthesettings.
2.1.5 ScreenCopies
The application attempts to detect and block remote screenshots of the Wire
conversationwindowwhenitincludestimedmessages,butnototherwise.Wetestedthis
featureonaNexus5X,butcan’tguaranteethatit’seffectiveonalldevicesandforall
Androidversions(itprobablyisn’t).
Locally,theAndroidappswitchershowsapreviewofthecurrentWirescreen,anddoes
notattempttohidesensitivedatasuchasconversationscontent. Werecommendto
createanopt-inconfigurablethatallowstoprotectagainstunwantedscreenshots.
2.1.6 FilesMetadata
Imagessentovertheapparestrippedoftheirmetadatasuchasforexamplegeotags.
Thisappliestophotostakenfromtheapporpicturesfromtheimagegallery.Videosare
notgeo-taggedwhentakenfromtheapp,butiftakenfromthegallerymetadataisnot
stripped.
Otherfilesuploadedareleftunchanged.Thisincludesofficedocuments,audiofiles,PDFs,
andotherdocuments.
5Seehttps://github.com/wireapp/wire-android-sync-engine/pull/269
FORPUBLICRELEASE Page6of34
WireSecurityReview–Phase2–AndroidClient WireSwissGmbH
2.1.7 URLPreviews
Previews of URLs are generated when an URL is entered, thereby generating a DNS
requestandsubsequentHTTPrequeststofetchthepreviewcontent.Thisbehaviorleaks
theaddressofthesendertotheURL’sservers,andrevealsthattheURLwassent.Itwas
notobservedonthereceiver’sside.
Unlike the iOS application, the Android application doesn’t allow users to disable
previews.
2.2 C
RYPTOGRAPHY
Thissectionreportsonthemaincryptographicthreatsagainstt