Penetration Test Report (Cure53): pentest report briar

Dr.-Ing. Mario Heiderich, Cure53
Rudolf Reusch Str. 33
D 10367 Berlin
cure53.de · mario@cure53.de
Pentest-Report Briar Project App & Protocol 03.2017
Cure53, Dr.-Ing. M. Heiderich, Dipl.-Ing. A. Aranguren, Dipl.-Ing. A. Inführ,
BSc. F. Fäßler, MSc. C. Kean, N. Kobeissi
Index
Introduction
Scope
Cryptography Review
Identified Vulnerabilities
BRP-01-001 Mobile: Lack of screenshot protections (Medium)
BRP-01-004 Mobile: Panic app prompt bypass via Tapjacking (Medium)
BRP-01-005 Mobile: Arbitrary sign out via PanicResponderActivity (Low)
BRP-01-006 Mobile: DNS leak via RSS Import (High)
BRP-01-008 Mobile: User disruption via exposed activities (Medium)
BRP-01-009 Mobile: Possible Intent hijacking via PendingIntent (Medium)
Miscellaneous Issues
BRP-01-002 Mobile: Possible logcat leakage via SDK version (Info)
BRP-01-003 Mobile: Possible Information Leakage via Debuggable Flag (Info)
BRP-01-007 Mobile: App Crash via unsupported Intent (Info)
BRP-01-010 Crypto: DoS in StreamEncrypterImpl.java via paddingLength (Info)
BRP-01-011 Crypto: Password strength indicator seems useless (Info)
BRP-01-012 Crypto: Unnecessary combination of two CSPRNGs (Info)
Conclusions
Cure53, Berlin · 03/20/17 1/15
Dr.-Ing. Mario Heiderich, Cure53
Rudolf Reusch Str. 33
D 10367 Berlin
cure53.de · mario@cure53.de
Introduction
“Briar is a messaging app designed for activists, journalists, and anyone else who needs
a safe, easy and robust way to communicate. Unlike traditional messaging tools such as
email, Twitter or Telegram, Briar doesn't rely on a central server - messages are
synchronized directly between the users' devices. If the Internet's down, Briar can sync
via Bluetooth or Wi-Fi, keeping the information flowing in a crisis. If the Internet's up,
Briar can sync via the Tor network, protecting users and their relationships from
surveillance.”
From https://briarproject.org/how-it-works.html
This report documents the findings of a penetration test and source code audit carried
out by Cure53 against the Briar secure messenger application. The project was
completed in March 2017 and revealed the existence of twelve security-relevant issues.
Six Cure53 testers were involved in this assignment, the completion of which took a total
of thirteen days.
The core application in scope was the Briar messenger application for Android, which
was complemented with the review of the protocols specified and used by the Briar
product, notably BQP1, BSP2 and BTP. Methodology-wise, the assessment followed a
white-box approach, meaning that the testing team had access to the Android
application’s full sources and could take advantage of the provided debug builds. The
Briar team has further supplied the Cure53 testers with several APKs, specifically
tweaked to enable more efficiency within the testing process, especially for the scenarios
linked to the use of the Tor network. All components positioned in the scope of this test
have undergone thorough reviews and audit of the code, while respective
implementations were additionally examined when applicable.
The aforementioned total number of twelve different findings comprises six actual
security vulnerabilities and six additional general weaknesses. The great majority of
discoveries received a low-to-medium severity ranking, and some were documented for
the sake of completeness and informational value rather than as actual and current
risks.
Scope
• Briar Project Android App APK was shared
• Briar Project Android App Sources were shared
1 https://code.briarproject.org/akwizgran/briar-spec/blob/master/protocols/BQP.md
2 https://code.briarproject.org/akwizgran/briar-spec/blob/master/protocols/BSP.md
Cure53, Berlin · 03/20/17 2/15
Dr.-Ing. Mario Heiderich, Cure53
Rudolf Reusch Str. 33
D 10367 Berlin
cure53.de · mario@cure53.de
Cryptography Review
Three days were dedicated to a cryptography review of the Briar Android App. This
included a specification review for the BQP3, BSP4 and BTP5 protocols provided by the
Briar team. While BQP was quickly deemed to be specified in a sound manner, the BSP
and BTP specifications lacked details and required further communication with the Briar
team. Ultimately, all three specifications could be considered appropriate.
While a full review of the Briar cryptographic code was conducted, the actual series of
tasks began with the code located in the specific directory, notably bramble-
core/src/main/java/org/briarproject/bramble/crypto/. All function calls were then traced
from this location.
The code was found to be exceptionally clear and sound, with no vulnerabilities spotted
within the scope of this two-day review. However, minor discoveries pertaining to the
code have been noted and can be found as three miscellaneous issues documented in
this report under BRP-01-010, BRP-01-011 and BRP-01-012.
Identified Vulnerabilities
The following sections list both vulnerabilities and implementation issues spotted during
the testing period. Note that findings are listed in a chronological order rather than by
their degree of severity and impact. The aforementioned severity rank is simply given in
brackets following the title heading for each vulnerability. Each vulnerability is
additionally given a unique identifier (e.g. BRP-01-001) for the purpose of facilitating any
future follow-up correspondence.
BRP-01-001 Mobile: Lack of screenshot protections (Medium)
It was found that the Briar Android application currently fails to leverage the available
Android protections to avoid side-channel data leakage via screenshots. This allows
applications with either screen recording or root privileges to directly capture all
information that is being displayed by the Briar app. The issue can be verified as one
runs the following ADB Commands6 while the application is open.
ADB Commands:
adb shell screencap -p /mnt/sdcard/screenshot1.png
adb pull /mnt/sdcard/screenshot1.png
3 https://code.briarproject.org/akwizgran/briar-spec/blob/master/protocols/BQP.md
4 https://code.briarproject.org/akwizgran/briar-spec/blob/master/protocols/BSP.md
5 https://code.briarproject.org/akwizgran/briar-spec/blob/master/protocols/BTP.md
6 https://developer.android.com/studio/command-line/adb.html
Cure53, Berlin · 03/20/17 3/15
Dr.-Ing. Mario Heiderich, Cure53
Rudolf Reusch Str. 33
D 10367 Berlin
cure53.de · mario@cure53.de
The resulting screenshot displays the information on the screen, as depicted below:
Fig.: Information leak via the screenshot API
It is recommended to ensure that all WebViews have the Android FLAG_SECURE flag7
set. This will guarantee that even the applications running with root privileges are unable
to directly capture information displayed by the Briar application on screen.
BRP-01-004 Mobile: Panic app prompt bypass via Tapjacking (Medium)
It was found that the Briar Android app fails to mitigate tapjacking attacks. This allows
malicious apps to render an overlay, launch an instance of the Briar application in the
background, and, ultimately, fool a user into performing actions on the Briar app while
they can actually see something different altogether. Although all screens are affected, it
was confirmed that the malicious app can also set itself as the Panic app. This means
that it can set and trigger a panic event and effectively delete everything from the Briar
app.
Scenario 1: App is unlocked. The Panic app prompts a bypass
To demonstrate how the issue occurs, a custom exploit APK was created. A demo was
also recorded to highlight how the malicious app is set as the Panic app, then displaying
how all of the Panic button setup settings are altered, including the consequences of the
“Delete Account” action (which deletes all data), as well as “Uninstall Briar”. While this is
the main example, it has to be underscored that all other screens (i.e. chats, general
settings, Tor configuration, etc.) are also affected by this problem.
https://cure53.de/exchange/[PII_REDACTED]78/Tapjacking_PoC2.zip
Scenario 2: App is locked. The Delete button promp