Now With Encryption! (or, Pointless Crypto) [NekoWiki]

3 min read Original article ↗

Table of Contents

Now With Encryption! (or, Pointless Crypto)

Prelude: Cobalt

Cobalt is a web service for downloading media from popular websites like Reddit and Instagram. Its privacy page has this section on encryption:

temporarily stored tunnel data is encrypted using the AES-256 standard. decryption keys are only included in the access link and never logged/cached/stored anywhere. only the end user has access to the link & encryption keys. keys are generated uniquely for each requested tunnel.[ref]

A project advertising crypto in this way is rarely a good sign. It contains a “marketing copy” degree of information: just too jargon-y for a layman to understand it, and too little information for a specialist to derive anything from it.

Crypto mentions always nerd snipe me, so I took a look at the source code.

How Cobalt Uses Encryption

Downloading media with Cobalt generally works like this:

  1. The client sends a POST request to / with a url parameter.

  2. The server extracts direct links to media it finds at the URL.

  3. The server generates a unique request ID for the request.

  4. The server wraps the direct links in an object like { "url": direct_links }.

  5. The server generates a random AES-256-CBC-CTS key and IV.

  6. The server encrypts the object, discard the keys, and store the encrypted object in a map from its ID.

  7. The server returns a URL to the client with the key, IV, and the request ID as query parameters.

The client then sends a second request to that URL to download the media, proxied by the server.

This Protects Nothing

The encryption in this scheme serves no purpose.

  1. The client sends the server the original URL in plaintext.

  2. The server generates the plaintext from that URL.

  3. The server generates the encryption key.

  4. The client sends the server a request for the encrypted content, along with the key.

Every step of this scheme relies on the server being honest: a malicious server could deduce or simply read the entire encrypted message at any step in the process with no way for the client to stop or even determine such has a thing has happened. Cobalt actually notes something to this effect:

this data is irreversibly purged from server’s RAM after 90 seconds. no one has access to cached tunnel data, even instance owners, as long as cobalt’s source code is not modified.[ref]

(Emphasis mine.)

And even this is misleading. A server doesn't have to modify Cobalt's source code to extract or determine any of the information Cobalt encrypts; it could:

  1. Log requests Cobalt receives to determine URLs a client downloads (e.g. with a reverse proxy).

  2. Log requests Cobalt makes to determine the direct media links associated with a request ID and consequently with a source URL and client (at least, with very high likelihood).

So for the encryption to provide any security, we must trust that the server is honest. In that case, encryption is not necessary because the server can just choose to not log any sensitive information.