Penetration Test Report (FH-Munster): security audit report threema 2019

Executive Summary
Security Audit Report
Threema 2019
Fabian Ising, M.Sc.,
Damian Poddebniak, M.Sc.,
Prof. Dr. Sebastian Schinzel.
Date: 2019-03-28
1
Executive Summary
Table of Contents
Executive Summary
1. Introduction ----------------------------------------------------------------------------------------------------------- 4
2. Context and Scope -------------------------------------------------------------------------------------------------- 5
3. Findings ---------------------------------------------------------------------------------------------------------------- 6
Appendix A: Detailed Findings -------------------------------------------------------------------------------------- 7
Detailed Findings Android App 7
Detailed Findings iOS App 11
Detailed Findings Threema Safe 12
Appendix B: Applied Test Cases ---------------------------------------------------------------------------------- 13
Applied Test Cases Android App 13
Applied Test Cases iOS App 23
2
Executive Summary
Executive Summary
This report describes the results of a thorough independent code audit of the Threema apps for iOS
and Android that was performed by the IT Security group at Münster University of Applied Sciences
headed by Prof. Dr. Sebastian Schinzel. In the course of the code review, Threema provided full
access to the source code of the Android and iOS apps and supported the researchers in regular
meetings.
Both Threema apps and the Threema Safe feature successfully passed the assessment and the audit
revealed no deviations from the specifications published in the Threema Cryptography Whitepaper.
Overall, no high risk or critical vulnerabilities were discovered in Threema Android, iOS and Threema
Safe.
Several low to medium risk issues were identified by the examiners and Threema addressed them
quickly. They are no longer present in current versions of the apps.
In summary, Threema performs as specified in the published documentation and its security and
privacy features are intact and effective.
3
1. Introduction
1. Introduction
“Threema: The messenger that puts security and privacy first.”
Threema is an encrypted messenger produced by the Swiss company Threema GmbH. It offers end-
to-end encrypted chats, group chats and calls. Threema’s product line focuses on privacy: neither a
phone number nor an email address is required to register or use the apps. Furthermore, it claims
that it generates as little data on servers as possible and to delete messages from servers as soon
as they were picked up.
Threema GmbH has approached the IT security group at Münster University of Applied Sciences to
perform an independent review of the code and architecture of its apps and particularly evaluate the
security of its newly implemented Threema Safe cloud backup feature.
4
2. Context and Scope
2. Context and Scope
The goal of this audit was a thorough third-party examination of the source code of the Threema apps
on both iOS and Android for possible issues that could affect the security or the privacy of its users
and to check the validity of Threema’s public claims stated in the Threema Cryptography Whitepaper1.
The audit was performed during the period from October 2018 to January 2019 and took 22 person
days. Any live testing was done using the production Threema apps downloaded from the Google
and Apple app stores.
The scope of the audit was set to Threema Android version 3.54 and iOS version 3.0.9 and the An-
droid implementation of Threema Safe. The Threema server code was out of scope.
Threema provided remote access to an isolated computer within the Threema network that had cop-
ies of the Threema Android and iOS apps’ source code. The Threema Android source repository also
contains the code for Threema Safe on Android.
1 https://threema.ch/press-files/cryptography_whitepaper.pdf (last accessed on 2019-01-23).
5
3. Findings
3. Findings
The audit revealed no high risk or critical vulnerabilities in Threema Android, iOS and Threema Safe.
The appendix of this report lists an excerpt from the test cases that the ITS group applied, but that
did not reveal findings. This list and the fact that most findings were merely low risk issues or infor-
mational notes is a sign for the overall good quality and high security standard of the analyzed apps.
The Threema developers were very responsive and open to the suggestions of the ITS group and
mostly provided fixes within hours or a few days. All medium and low risk findings were fixed in
Threema Android version 3.62 and Threema iOS version 4.1.
The audit revealed two medium risk vulnerabilities: A malicious Android app could trick the Threema
app to send sensitive files such as the Threema private key to another Threema user. However, the
victim needs to explicitly choose the receiving Threema user, requiring a component of social engi-
neering to be practically exploited. Furthermore, parts of the Threema Safe password were written to
a log file specific to the Threema Android app. An attacker having access to this Threema-internal log
could learn parts of the password. While this log is not accessible to other applications, it poses a risk
to reveal the password to an attacker.
Most of the findings have low risk rating or are merely informational, leaving a good overall impression
of the code. The two identified medium risk vulnerabilities do not pose a directly exploitable risk to
users but should be fixed nevertheless.
Other than that, no findings with high or critical risk rating were discovered.
While no audit can prove the complete absence of any vulnerabilities in a software, this audit left the
impression that Threema takes the security and privacy of their users very seriously. Furthermore,
the audit revealed no deviations from the Threema Cryptography Whitepaper or the claims made by
the Threema website.
The findings revealed by this audit are outlined in Appendix A. Appendix B contains an overview of
the test cases applied by the IT Security group.
6
Appendix A: Detailed Findings
Appendix A: Detailed Findings
Detailed Findings Android App
Threema-2018-android-001 Private Data Leak via Share Intents (Medium)
Threema allows sharing media to Threema contacts from other applications using share intents (an-
droid.intent.action.SEND). Upon receiving such an intent, the contact list is opened to select a recip-
ient. These intents carry a file URI that defines which file should be sent.
We found that Threema can be tricked into sharing sensitive app data using crafted file URIs, for
example the cryptographic private key in the key.dat file. This can be done from any malicious app
on the smartphone. However, an attacker cannot influence who receives the sensitive data, as the
intent opens the sharing dialog where the victim needs to choose the recipient.
Proof-of-concept
A malicious app sends an intent to share the key.dat file to the Threema app:
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///data/data/ch.threema.app/key.dat"));
sharingIntent.setType("*/*");
this.startActivity(sharingIntent);
This prompts the victim to send this file to a Threema contact. The attacker needs to convince the
victim to send the file to the attacker. This can also be triggered by sending the same intent from the
adb shell:
$ am start -a "android.intent.action.SEND"
--eu "android.intent.extra.STREAM"
"file:///data/data/ch.threema.app/files/key.dat"
-t "/"
Recommendation
Threema should filter intent URIs to prevent leaking sensitive data.
Threema-2018-android-002 Leak of GUI elements when PIN lock is active (Low)
Threema allows the user to set an access PIN to access the Threema app. This prevents a malicious
user with access to the unlocked Android phone to access Threema. Users need to enter the PIN to
access the Threema app.
We found that when using a PIN lock for Threema, the last used activity containing GUI elements is
shown as a screenshot under recent activiti