
Decrypt WhatsApp encrypted media files - ColinWright
https://github.com/ddz/whatsapp-media-decrypt
======
natch
The article (the readme on github) takes the following quote wildly out of
context:

> A recent high-profile forensic investigation reported that “due to end-to-
> end encryption employed by WhatsApp, it is virtually impossible to decrypt
> the contents of the downloader [.enc file]

This quote clearly means it is virtually impossible without the key. OF COURSE
if you have full access to the device as a logged in user, then you can get
access to the key and decrypt things that cannot be decrypted by others who do
not have the key. Nothing to see here.

At least to the author’s credit the FAQ answers below clarify this, but not
after the lead in, which is all most people read, has already done the damage
of dramatically planting the incorrect impression that someone has figured out
how to break WhatsApp encryption.

~~~
varispeed
I think the "end-to-end" statement is also misleading as you don't really know
whether the communication is indeed encrypted end to end. If you want true end
to end ecryption you can grab a tool that will generate public and private key
pair, send public key to your contact and ask them for their public key. Then
use tool to encrypt your following messages with your private key and received
messages with your contact's public key. Then it doesn't matter whether
underlying transport is encrypted or not. Things like Whatsapp give false
sense of security. I am pretty sure the messaging can be accessed but nobody
will ever admit it. You can make it less obvious that you are sending
encrypted messages by using two way binary to English text transcoder, so your
messages will appear like an English conversation (although easy to pick as
gibberish by a censor)

~~~
maxerickson
It's entirely possible to examine the compiled app and understand whether it
sends the private key or unencrypted messages off the device, there's no need
to treat the behavior or Whatsapp like a mystery.

~~~
rndgermandude
The crux of the matter is verifying that the public key you're told is the
public key of the other person, is actually the public key of the other
person. If you do not verify this out-of-band, then the server can generate a
new keypair for each recipient and it would go like this:

\- Alice encrypts message using FAKE public key of Bob (she was told is Bob's
key by the server), sends it to whatseverapp server so it can be delivered to
Bob when he sign on.

\- Whatseverapp server has FAKE private key for Bob (it generated that one
itself, after all), decrypts message and notifies the corporate
overlords/government/Russians/AdSevers/Illuminati of contents.

\- Whatseverapp server encrypt message using REAL public key of Bob, sends it
to Bob

\- Bob decrypts the message using his REAL public key, reads it.

This out-of-ban verification is nothing you can automate or do once-for-all,
like analyzing the binary for bad stuff. Each user has to verify the key of
the other users. Which very few people actually do.

Also, you make it sound so easy to analyze an app binary. You can relatively
easily prove it does certain things; but to prove a negative, namely that it
does NOT do certain things is far more difficult at least and outright
infeasible or even impossible in other cases (compare with halting problem).
This is why security vulnerabilities happen, and a backdoor is more or less
just a security vulnerability that didn't happen by accident or incompetence
but deliberately - which may mean whoever put it there might have spent some
time to obfuscate it even further to make it harder to find.

------
Funes-
TL;DR: This program decrypts encrypted media files _you yourself_ have
received through WhatsApp, "in the same way that the WhatsApp app does to
display it on the screen." It doesn't decrypt other people's media files, as
the title could suggest.

~~~
ajphdiv
> It doesn't decrypt other people's media files, as the title could suggest.

It can be used to decrypt other's files as long as there is physical access to
the device and the user's passcode. This was published as a result of the
Bezo's phone examination report, where the author stated it was impossible to
decrypt the media file. A claim that was largely refuted by the digital
forensics community.

~~~
enitihas
If you have those, you anyways have access to the messages via WhatsApp,
right? Can't you simply export any chat you are interested in then?

~~~
stmL
This does not completely contradict what you are saying but you can only
export limited number of messages (10k or 40k can't remember the amount
correctly).

------
ignoramous
Not just media, one could extract WhatsApp's cipher-key and message-db (not
sure if it works on current versions) without requiring root:
[https://forum.xda-developers.com/showthread.php?t=2770982](https://forum.xda-
developers.com/showthread.php?t=2770982) (2016).

And here's a desktop viewer to search through decrypted files:
[https://forum.xda-developers.com/showthread.php?t=1583021](https://forum.xda-
developers.com/showthread.php?t=1583021) (last updated: 2018).

------
sloshnmosh
There is an app on the google play store that claims to be an
“antivirus/cleaner” app that abused Androids accessibility API’s to access
WhatsApps media files. The developer called it a “WhatsApp cleaner”. The app
was removed from the Play store for several weeks but was allowed to return.
The developers now claim to PROTECT unauthorized access to WhatsApp’s media
files. App is affiliated with China’s Qihoo that was booted long ago from the
Play store for hijacking users WebView with fake virus warnings to boost
installs. As this app has been doing every day since 2013.

------
smashah
As maintainer of [https://github.com/open-wa/wa-automate-
nodejs](https://github.com/open-wa/wa-automate-nodejs)

Every needs to be incredibly careful of being phished of their WhatsApp web
logins.

Also, WhatsApp does not respect message integrity regardless of e2e
encryption. They WILL mutate your message if required.

------
stunt
How some of surveillance tools can access or extract the key just by
installing a SPY APP? I thought IOS creates a sandbox for each APP.

------
latentpot
If only this was available as a apk

------
jl6
I thought I’d take this opportunity to describe my recent experience
submitting a bug report for WhatsApp on iOS.

When you export a chat, you get a zip file containing the messages as plain
text, plus any media files referenced in the chat. The .txt file unfortunately
only contains the text-only messages, not the text captions for media items. I
reported this as a bug and was told this was functioning as intended.

So this is a warning to anyone who thinks they are backing up their WhatsApp
chats via the export feature that their backups are incomplete.

As a workaround, you can get hold of the ChatStorage.sqlite file from an
iTunes backup of your phone. All text is in there but you obviously have to
query the database and format it into a readable sequence of messages.

This really, really sucks as a workflow and I hope if any WhatsApp engineers
ever read this they start working on a real export feature.

~~~
abhchand
It seems that WhatsApp has some oddity in how it handles captions on media
items.

I forward messages between various groups, but when you forward a media item
like an image, it doesn't forward the caption with it. This is incredibly
frustrating - sometimes you don't realize you've forwarded a photo of
something that has no context, and my recipients have been often clueless
until I have to clarify.

~~~
davchana
Also, you can not copy that caption from the image message, you have to type
it again.

~~~
airstrike
Yet somehow this POS app sold for $19+ billion and it's one of the most
popular apps in the world...

~~~
pell
It's a very reliable app despite some of its flaws. It mainly sold that high
due to high market share in some countries.

~~~
Polylactic_acid
Virtually every IM app I have ever used has been very reliable.

------
pier25
> _Can you help me decrypt someone 's WhatsApp?_

Answering the most important questions.

------
dancemethis
Somewhat disheartening that the author believes by default that the encryption
wasn't tampered with on the proprietary server side of this proprietary
client.

~~~
shawnz
There's nothing "by default" about it, E2E encryption by definition can't be
tampered with by anything on the server side, and the encryption mechanisms of
WhatsApp are well understood

~~~
upofadown
Which definition? WhatsApp, like a lot of things that claim E2EE, encrypts and
decrypts at the clients. The problem is that we have no idea what the client
programs are doing. They have not yet performed the required step of showing
us the source code in a form that can be compiled to be the same as the
distributed binary.

~~~
shawnz
We know exactly what the client programs are doing, the bits are right on your
device and you can audit them if you want (and it has been done already for
WhatsApp by many researchers). Have you audited any of the open source
software that you use?

~~~
upofadown
>...and it has been done already for WhatsApp by many researchers...

Citation required...

------
seemslegit
> No. WhatsApp uses iOS Data Protection to encrypt user data files (including
> ChatStorage.sqlite) using the device-specific and unrecoverable hardware UID
> key as well as a key derived from the user's passcode. It may not be
> decrypted without physical access to the specific iOS device that created
> the file as well as knowledge of the user's passcode.

Didn't we learn that not to be the case since presumably the device can still
flash a new apple-signed firmware that would override this ?

~~~
heavenlyblue
If that were the case, one would not be able to decrypt their iPhone backup on
another iPhone

~~~
seemslegit
No. You would still need a signed modified firmware that would make use of the
passcode-derived key from the original device, but the point is that an iPhone
can accept a new firmware while locked which shouldn't be the case if Apple
was serious about non-compromised security.

~~~
heavenlyblue
Wait, so I can’t restore my iPhone backup without the other phone?

~~~
Spooky23
When you enter your passcode while enabling backup, you’re letting iOS decrypt
your data and reencrypt with the key used for the backup.

Local backup key strength depends on the key. iCloud depends on the law.

