Telegram Desktop: one-click account takeover via IPC injection
Telegram Desktop's single-instance socket did not escape the semicolon separator, so a crafted tg:// link could inject extra commands. One injected command reached the internal interpret: scheme, which read an attacker-placed instruction file and sent arbitrary local files to an attacker-controlled chat, allowing theft of the encrypted session data and account takeover.
beaksec.github.io
Published on beaksec.github.io
Someone adds you to a Telegram group. A link shows up in the chat.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The single-instance socket serialised commands with an unescaped semicolon separator, and the internal interpret: scheme performed a privileged file-read-and-send action without any authorisation check.
Impact
An attacker could read arbitrary local files and exfiltrate them to a chat they control; with no local passcode set, stealing three tdata files was enough to take over the victim's account, though the browser may ask for confirmation before launching Telegram.
What the attacker needed
Telegram Desktop through 7.2.8; Victim added to an attacker's group; Victim clicks an https link; No local passcode set
The fix
It was fixed in 7.2.9 by removing the interpret:// scheme and InterpretSendPath entirely and by escaping the record separator on the single-instance socket.
How it was found
- The attacker creates a supergroup and adds the victim to it.
- The attacker posts three instruction text files in the group, each naming the attacker's own group as the destination.
- The attacker sends an innocuous https link into the chat.
- The victim clicks it; the browser follows a redirect to a crafted tg:// link carrying stacked commands.
- The operating system launches a second Telegram process, which forwards the URL over the socket; the unescaped semicolons split it and the injection fires.
- The three interpret: commands execute and the three files are uploaded to the attacker's group with no confirmation dialog.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Telegram Desktop uses a local socket to pass links to an already-running copy of the app. The format for that handover used semicolons to separate commands, but semicolons inside a link were not escaped, so an attacker could sneak extra commands in. One of those commands could read a file from disk and send it to a chat, and the files that hold your Telegram login could be stolen that way.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.