4

Assuming you have access to another person's device, set up a SOCKS5 proxy, install a root certificate to parse the SSL traffic, and take a screenshot of the private key of a private chat.

Is it now possible to use the proxy to record a message and manually decrypt it with the private key?

EDIT: You can display the encryption key inside a private chat. Here is a screenshot.

Is this the private key used to encrypt and decrypt the messages? On Telegram FAQ, you can read "this is not the key itself, of course!"

If not, is it possible to derive the encryption key from it? Or is the private key only stored deep in the app?

Anders
  • 64,406
  • 24
  • 178
  • 215
Manni
  • 141
  • 1
  • 4

3 Answers3

1

The data is encrypted using a random AES key. The AES key is then encrypted using the receiver's public key.

The encrypted data along with the encrypted key is transmitted to the user, who uses their private key to decrypt the AES key, which in return is used to decrypt the encrypted text.

Is it now possible to use the proxy to record a message and manually decrypt it with the private key?

Since the private key is never transmitted during the communication process it is not possible to sniff them using a socks proxy with a root certificate in place on the device.

I think it's a good idea to get a better understanding of how asymmetric encryption works. The following link breaks it down quite nicely using a simple way of explaining it: https://hackernoon.com/asymmetric-encryption-explained-using-chocolate-boxes-5a329ea6813e

Jeroen
  • 5,783
  • 2
  • 18
  • 26
0

You are purporting an scenario where:

  1. An attacker has full access to another person's device
  2. He then wants do decrypt a later-received message

However, assuming that the attacker got complete control (ie. root) of the device

  1. He could extract the key of the private chat, that is stored in the app storage.
  2. Or, even more easy, replace the Telegram app with an evil Telegram which works as the legit one but additionally sends the attacker a decrypted copy of all messages.
Ángel
  • 17,578
  • 3
  • 25
  • 60
  • Thanks for your answer! I'm interested in possibilities on a not-rooted iPhone. To my knowledge, it is not possible to extract the key or replace the app with a separate variant. – Manni Aug 20 '19 at 07:09
0

Some thoughts:

  1. The screenshot shows the fingerprint of the key exchange between both users, not the key itself. It is therefore not usable for any attack.
  2. Telegram clients connect to hardcoded IP address lists and ports, and immediately want to speak MTproto, the internal Telegram protocol, so a SOCKS proxy won´t help you much, except you switch on proxy in the device (which is perfectly possible when you got access to the device)
  3. Upon connecting to the server the Telegram app will check the server messages against a cert signature - as long as you do not have the private server key of the MTproto conversation you won´t be able to fool the app or sniff the conversation in clear - and that´s even before the secret chat protocol begins.
  4. If iOS warrants App safety so that just a plain access to the device without breaking it apart will not allow access to the App data storage in plain, you cannot exfiltrate the private user key.

I doubt it will ever possible to break this open, especially without the user´s attention. Means you need to "borrow" the device for an unlimited amount of time until your attack is successful. Nothing to gain from 5 minutes sniffing on the device.

flohack
  • 547
  • 3
  • 8