Part 1 Insights from First APK Analysis - December 2022
This is Part 1 of a 2 parts analysis of the Telegram App. This first analysis was conducted in December 2022. The second part was conducted 25 Jan 2023. Latest Results for Telegram are in Part 2 below.
This blog has been taken from Malcore’s analysis results. The points below are not an exhaustive list. For a full view of Malcore’s static analysis of the Telegram App APK view it on Malcore.
Try Malcore for Free!
First 5 scans are free on registration
Discovered Trackers
Huawei Mobile Services (HMS) Core
Google Firebase Analytics
High severity warnings from code analysis
Files may contain hardcoded sensitive information like usernames, passwords, keys etc.
The App uses an insecure Random Number Generator.
This App has capabilities to prevent against Screenshots from Recent Task History / Now On Tap etc.
Insecure Implementation of SSL. Trusting all the certificates or accepting self signed certificates is a critical Security Hole. This application is vulnerable to MITM attacks.
Insecure WebView Implementation. WebView ignores SSL Certificate errors and accept any SSL Certificate. This application is vulnerable to MITM attacks.
App uses SQLite Database and execute raw SQL query. Untrusted user input in raw SQL queries can cause SQL Injection. Also sensitive information should be encrypted and written to the database.
App creates temp file. Sensitive information should never be written into a temp file.
Suspicious severity warnings from code analysis
Application attempts to discover build version of device.
Dangerous Labelled permissions from Android
Android Dangerous labelled permissions as Dangerous from this library https://developer.android.com/reference/android/Manifest.permission.
Name: WRITE_SETTINGS
Description: Allows an application to modify the system's settings data. Malicious applications can corrupt your system's configuration.
Name: READ_PHONE_NUMBERS
Description: Allows read access to the device's phone number(s).
Name: ACCESS_COARSE_LOCATION
Description: Access coarse location sources, such as the mobile network database, to determine an approximate phone location, where available. Malicious applications can use this to determine approximately where you are.
Name: BLUETOOTH
Description: Allows an application to view configuration of the local Bluetooth phone and to make and accept connections with paired devices.
Name: CAMERA
Description: Allows application to take pictures and videos with the camera. This allows the application to collect images that the camera is seeing at any time.
Name: ACCESS_FINE_LOCATION
Description: Access fine location sources, such as the Global Positioning System on the phone, where available. Malicious applications can use this to determine where you are and may consume additional battery power.
Name: READ_SETTINGS
Description: Allows applications to read the global setting of the device it is running on.
Name: ACCESS_NETWORK_STATE
Description: Allows an application to view the status of all networks.
Name: READ_CALL_LOG
Description: Allows an application to read the user's call log.
Name: ACCESS_BACKGROUND_LOCATION
Description: Allows an app to access location in the background.
Name: WRITE_EXTERNAL_STORAGE
Description: Allows an application to write to the SD card.
Name: MANAGE_ACCOUNTS
Description: Allows an application to perform operations like adding and removing accounts and deleting their password.
Name: READ_EXTERNAL_STORAGE
Description: Allows an application to read from SD Card.
Name: WRITE_SYNC_SETTINGS
Description: Allows an application to modify the sync settings, such as whether sync is enabled for Contacts.
Name: AUTHENTICATE_ACCOUNTS
Description: Allows an application to use the account authenticator capabilities of the Account Manager, including creating accounts as well as obtaining and setting their passwords.
Name: CALL_PHONE
Description: Allows the application to call phone numbers without your intervention. Malicious applications may cause unexpected calls on your phone bill. Note that this does not allow the application to call emergency numbers.
Name: READ_PHONE_STATE
Description: Allows the application to access the phone features of the device. An application with this permission can determine the phone number and serial number of this phone, whether a call is active, the number that call is connected to and so on.
Name: WRITE_CONTACTS
Description: Allows an application to modify the contact (address) data stored on your phone. Malicious applications can use this to erase or modify your contact data.
Name: SYSTEM_ALERT_WINDOW
Description: Allows an application to show system-alert windows. Malicious applications can take over the entire screen of the phone.
Name: WAKE_LOCK
Description: Allows an application to prevent the phone from going to sleep.
Name: CHANGE_WIFI_STATE
Description: Allows an application to connect to and disconnect from Wi-Fi access points and to make changes to configured Wi-Fi networks.
Name: RECORD_AUDIO
Description: Allows application to access the audio record path.
Name: READ_CONTACTS
Description: Allows an application to read all of the contact (address) data stored on your phone. Malicious applications can use this to send your data to other people.
Name: MODIFY_AUDIO_SETTINGS
Description: Allows application to modify global audio settings, such as volume and routing.
Name: READ_PROFILE
Description: Allows an application to read the user's personal profile data.
Part 2 Update- Telegram score reduces to 12.7 still part of Huawei Data Ecosystem
Part 2 Update - 25 Jan 2023
Telegram score reduces to 12.7 but still part of Huawei Data Ecosystem
After publishing our blog on 23 Jan 2023 Telegram wrote to Malcore stating that Huawei “mobile services are exclusively contained in the version of Telegram distributed through the Huawei App Gallery, and are used as a replacement for Google Play Services that are not available on those devices”. They requested a second version be analyzed and the blog updated.
We are very happy about this because it shows the utility of Malcore and the openness of Telegram’s PR team. We analyzed a different version of Telegram this time on request.
The results of this second APK analysis can be viewed here:
Based on this request from Telegram, Malcore Team downloaded a second version of their app. This time from the Google play store in the USA and pulled the app from a Samsung Galaxy S9 on 24 Jan 2023- all requested by Telegram. This version, analyzing Telegram for a second time, was Telegram APK v9.3.3. Malcore Team also conducted some dynamic analysis and manual code review and observed that Telegram determines which store the app is downloaded from before installing either Huawei Mobile Services or Google Firebase Analytics, see Figure 1.
Figure 1. Image from Manual Code Review. Telegram APK v9.3.3 from US Google Play Store
It is common for software applications to offer different versions based on location or other characteristics of the consumer. As can be seen from figure 1, taken from the code review of the US Google Play Store version, Telegram determines build type in the string
public static Boolean isHuaweiStoreBuild() {return applicationLoaderInstance. isHuaweiBuild
and based on this installs either maps data from Huawei or Google.
In summary if you have a Huawei phone or are running apps from the Huawei store you will be linked to Huawei Mobile Services not Google regardless of your location.
Lastly, this second analysis of Telegram, which is a newer version, scored 12.7 which is a lower score and so we committed to reducing the score in the industry overview and this blog.
To view how these results compare within industry see our analysis:
To view how these scores are created visit our transparency post where we published a description of our phone application threat scoring algorithm.