Skip to content
XSS Write-up Intermediate

Vulnerability That Allowed Hackers to Take Over WhatsApp and Telegram Accounts

WhatsApp Web and Telegram Web allowed attackers to upload malicious HTML files disguised as images or videos, bypassing client-side MIME type restrictions. When a victim opened the file, the attacker could steal local storage data and take over the victim's account.

blog.checkpoint.com

Published on blog.checkpoint.com

One of the most concerning revelations arising from the recent WikiLeaks publication is the possibility that government organizations can compromise WhatsApp, Telegram and other end-to-end encrypted chat applications. While this has yet to be proven, many end-users are concerned as WhatsApp and Telegram use end-to-end…

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 client-side MIME type restriction could be bypassed because the file was encrypted before being sent to the server, so the server could not validate the content.

Impact

An attacker could take over the victim's account, access conversations, photos, files and contacts, send messages on their behalf, and spread the attack to their contacts; both companies deployed a fix.

What the attacker needed

Victim uses WhatsApp Web or Telegram Web; attacker sends a malicious file; victim opens the file

The fix

The vulnerability was fixed by validating content before encryption, allowing WhatsApp and Telegram to block malicious files.

How it was found

  1. The attacker crafts a malicious HTML file with a preview image or video.
  2. The attacker modifies the client-side MIME type variable to allow the HTML file to be uploaded.
  3. The client encrypts the file and uploads it to the server.
  4. The attacker sends the file to the victim.
  5. The victim clicks to open the file (WhatsApp) or opens it in a new tab (Telegram).
  6. The malicious HTML runs under the web app's origin and sends the victim's local storage to the attacker.

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.

WhatsApp Web and Telegram Web are browser versions of the messaging apps. They store your login session in the browser's local storage. The apps let you send files, but they only checked the file type on your own computer, not on the server. An attacker could send a file that looked like a picture but was actually a web page. When you opened it, that web page could read your local storage and send it to the attacker, letting them log in as you.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.