Adversarial interoperability for Whatsapp

by Martin Monperrus

WhatsApp is a widely popular application with zero interoperability. The WhatsApp do not provide APIs and documentation to build alternative clients.

We have to go for Adversarial interoperability. In this post, I describe a working solution to use WhatsApp on a laptop, without running it on a mobile phone. It is based on anbox.

Background

Whatsapp uses powerful crypto, taken from Signal. In short, only your phone can decrypt the messages you receive, and the keys are only located in the phone.

Whatsapp provides two APIs:

Physically, you have “WhatsAppWeb <-> WhatsAppWeb server <-> your phone <-> WhatsApp server <-> your recipient”

Cryptographically, you have “WhatsAppWeb <-> your phone <-> your recipient”

In this post I explain how to replace your phone by a standard Linux server.

Prerequisites

Actions

  1. install Whatsapp on your rooted Android phone, register your phone number. This creates the phone Whatsapp cryptographic keys
  2. connect your browser with your phone, by visiting https://web.whatsapp.com/ and scanning the QR code. This creates the browser Whatsapp cryptographic keys, to talk to your phone. The keys are stored both in the browser and in the phone.
  3. close Whatsapp on your phone
  4. save the full whatsapp configuration folder /data/data/com.whatsapp in whatsapp.zip
  5. transfer whatsapp.zip to your server, for Anbox. Unzip it on the server on /var/lib/anbox/rootfs/data/data. This transfers both the keys to discuss with the Whatsapp server, and the keys to discuss with your browser.
  6. start whatsapp on Anbox
  7. use https://web.whatsapp.com/ without any phone in the loop.

See also

Open questions

Yowsup: It is possible to receive messages with yowsup, by transferring the info from keystore.xml. How to register a WhatsappWeb client with YowSup?

Troubleshooting

If your server does not have a monitor, you need to run anbox in a fake X server, for instance, Xvnc from TigerVNC. In this case, note that anbox only uses touch events and not mouse events, which means that the XVnc client does not support anbox, you have to use the xdb shell input commands, eg input tap 280 280.

Tagged as: