anarsec.guide/content/posts/e2ee/index.md
2023-11-15 17:22:05 +00:00

35 KiB
Raw Blame History

+++ title="Encrypted Messaging for Anarchists" date=2023-04-02

[taxonomies] categories = ["Defensive"] tags = ["intro", "e2ee", "easy"]

[extra] blogimage="/images/BASE_2.png" toc=true dateedit=2023-05-10 a4="e2ee-a4.pdf" letter = "e2ee-letter.pdf" +++ There are several different options for end-to-end encrypted communication, each with different trade-offs. This article provides an overview and installation instructions for Tails, Qubes OS, and GrapheneOS.

Before proceeding, there are a few concepts that need to be understood, in order to distinguish between the various options.

  • End-to-end encryption means that only you and the person you are communicating with can read messages. However, not all encryption is created equal. The quality of the encryption is determined by the encryption protocol used and how it is implemented at the software level.
  • Metadata protection means that the metadata (the data about the data) about the communication is obscured. Even if the message itself is encrypted, metadata can reveal who is communicating with whom, when, how often, the sizes of any files that may have been transferred, and so on. Metadata exposure is a major concern.
  • Peer-to-peer means that there is no centralized server to trust.
  • Tor is an anonymity network, and some applications route your messages through it by default.

For a more in-depth look at these various considerations, we recommend The Guide to Peer-to-Peer, Encryption, and Tor: New Communication Infrastructure for Anarchists. This text criticizes Signal for not being peer-to-peer and not using Tor by default, and goes on to compare Signal, Cwtch, and Briar.

Anonymous public-facing projects have additional needs for encrypted communication, because they will be interacting with unknown (and untrusted) contacts:

  • Anyone can contact the project without requiring a separate channel
  • Resiliency to correlation attacks
  • Resiliency to exploits
  • Multiple project members can access the same messages

The following options for encrypted messaging are listed from most metadata protection to least.

TLDR:

  • For text communication with other anarchists, prioritize Cwtch.
  • For voice or video calls, use SimpleX Chat or Signal (with usernames).
  • For anonymous public projects, PGP email is still the best option.

Cwtch

  • Mediums: Text
  • Metadata protection: Yes (strong)
  • Encryption protocol: Tor Onion Services (v3) + Tapir
  • Peer-to-peer: Yes
  • Tor: Yes

Cwtch is our preference, by a long shot. For an overview of how Cwtch works, watch the video below. Cwtch is designed with metadata protection in mind; it is peer-to-peer, uses the Tor network, and stores everything locally on the device, encrypted.


How Cwtch works

Like all peer-to-peer communication, Cwtch requires synchronous communication, meaning that both peers must be online at the same time. However, its server feature also allows asynchronous communication by providing offline delivery:

"Cwtch contact to contact chat is fully peer to peer, which means if one peer is offline, you cannot chat, and there is no mechanism for multiple people to chat. To support group chat (and offline delivery) we have created untrusted Cwtch servers which can host messages for a group. [...] the server has no way to know what messages for what groups it might be holding, or who is accessing it."

Once the server exists, contacts can be invited to use it. For asynchronous direct messaging, create a group chat with only two people.

Any Cwtch user can turn the app on their phone or computer into an untrusted server to host a group chat, though this is best for temporary needs like an event or short-term coordination, as the device must remain powered on for it to work. Fortunately, Anarchy Planet runs a public server that is suitable for long-term groups.

Asynchronous conversations on Cwtch need to be started from a synchronous conversation - you need to be online at the same time as your contact to invite them to a group, and then you no longer need to be online at the same time. In the future, Cwtch plans to improve this with hybrid groups. Until hybrid groups are implemented, you will need to establish your asynchronous Cwtch conversations by using a second channel to set a time for when you both need be on Cwtch.

You can learn more about how to use Cwtch with the Cwtch Handbook.

For Anonymous Public-facing Projects

Anyone can contact the project without requiring a separate channel

Anyone can connect to a public Cwtch account when it is online. In the future, Cwtch bots that are semi-trusted (which are hosted on a Cwtch server) will enable first contact when the public Cwtch account is offline.

Cwtch will reject connections from blocked contacts, and if the setting "Block Unknown Contacts" is enabled, you must be the one to add a contact in order to establish a connection. This greatly limits the kinds of features that untrusted contacts can access. However, this setting is less relevant for public projects that need to be able to be contacted by anyone.

Resiliency to correlation attacks

Real-time messaging applications are particularly susceptible to end-to-end correlation attacks because of the ability of an adversary, once they know their target's ID on the messaging platform, to trigger incoming network traffic on the target's side by sending them messages on the platform (when the target is online). "Appear Offline Mode" in Cwtch allows a user to selectively connect to trusted contacts and groups, while appearing offline to everyone else. An issue is open to further address this.

Content padding exists to frustrate correlation attacks via message size.

Resiliency to exploits

A vulnerability in any application can be targeted with exploits - a severe vulnerability can allow an adversary to hack your system, such as by permitting Remote Code Execution. Cwtch does fuzz testing to find bugs. For public-facing project accounts, we recommend that you do not enable the "file sharing experiment" or the "image previews and profile pictures experiment" in the settings.

Multiple project members can access the same messages

If a project has multiple members, all of them should be able to access the same messages independently. Currently, this is not possible with Cwtch.

Note

Briar is another application that works in a similar way (with peer-to-peer and Tor), using the Bramble Transport Protocol (BTP). Briar's main distinguishing feature is that it continues to work even when the underlying network infrastructure is down. It was audited in 2017. Unfortunately, Briar Desktop does not yet work with Tails or Qubes-Whonix because it cannot use the system Tor. Unlike Cwtch, to connect to a contact on Briar, you both have to add each other first. You can either exchange briar:// links or scan a contacts QR code if they are nearby. Briar Mailbox allows asynchronous communication.

OnionShare has a chat feature that creates an ephemeral peer-to-peer chat room that is routed over the Tor network. The metadata protection works in the same way as Cwtch; it uses the Tor network as a shield and stores everything (ephemerally) locally on the device running OnionShare. OnionShare doesnt implement any chat encryption on its own - it relies on the Tor onion services encryption. Cwtch and Briar both have more features (including the additional Tapir and BTP encryption protocols). The only advantage of OnionShare is that it is installed on Tails by default.

Cwtch Installation on GrapheneOS


Install Cwtch as you would any app that doesn't require Google Services (we don't recommend F-Droid).


Cwtch Installation on Tails


Cwtch support for Tails is very new and not thoroughly tested.

  • Start Tails with an Adminstration Password.
  • Download Cwtch for Linux with Tor Browser
  • Verify your download
    • Open the folder using the Tor Browser's download icon
    • Right-click in the file manager and select "Open a Terminal Here"
    • Run sha512sum cwtch-VERSION-NUMBER.tar.gz (replace the version number as appropriate)
    • Compare the hash of the file to what is listed on the download page
  • According to our Tails Best Practices, personal data should be stored on a second LUKS USB and Persistent Storage should not be enabled. Extract the file with the file manager (right click, select "Extract Here"), then copy the cwtch folder to such a personal data LUKS USB.
    • OPTIONAL - If you enable Persistent Storage: with Persistent Storage unlocked, in Terminal run sudo sed -i '$ a /home/amnesia/.cwtch source=cwtch' /live/persistence/TailsData_unlocked/persistence.conf && sudo sed -i '$ a /home/amnesia/.local source=cwtch_install' /live/persistence/TailsData_unlocked/persistence.conf then restart Tails for the changes to take effect, again with an Adminstration Password.
  • Run the install script
    • In the File Manager, browse to the directory you just created, cwtch. Right click in the File Manager and select "Open a Terminal Here"
    • Run install-tails.sh and enter the Administration Password when prompted.
  • As the documentation states, "When launching, Cwtch on Tails should be passed the CWTCH_TAILS=true environment variable". In the Terminal, run:
    • exec env CWTCH_TAILS=true LD_LIBRARY_PATH=~/.local/lib/cwtch/:~/.local/lib/cwtch/Tor ~/.local/lib/cwtch/cwtch
  • With Persistent Storage disabled, configuration and profile data must be restored from backup every session you need to install Cwtch. Backup /home/amnesia/.cwtch/ to the personal data LUKS USB, and copy it back to /home/amnesia/ the next time you install Cwtch.
  • Updates to new versions must be done manually - back up your profile first.

Cwtch Installation on Qubes-Whonix


Cwtch on Whonix currently has an issue - support is forthcoming.



SimpleX Chat

SimpleX Chat functions without persistent user IDs, which creates strong metadata protection. This means that an adversary can't easily observe how users are connected to each other in a network. This is possible because connection requests work by sharing an invitation link that is communicated through a separate channel, or in person. When connecting to another user you have the choice to use "Incognito mode", which creates a new random profile for each contact. This avoids sharing any data between contacts.

As a design choice to facilitate asynchronous communication, SimpleX Chat is not peer-to-peer - it uses decentralized servers that anyone can host and does not rely on any centralized component. Servers do not store any user information (no user profiles or contacts, or messages once they are delivered), and primarily use in-memory persistence. To understand what a server can and cannot see, read the threat model. Your data can be exported and then imported onto another device, as there are no central servers where this is backed up.

Due to needing to place some trust in the SimpleX servers, we recommend prioritizing Cwtch over SimpleX Chat for text communication with other anarchists, and using SimpleX Chat or Signal for voice and video calls. Unlike Signal, SimpleX Chat doesn't require a phone number or smartphone.

If SimpleX is served with a warrant, their privacy policy is quite specific. Servers have the records of the message queues and any undelivered encrypted messages - no data is stored that links the queues or messages to particular users, and the data which is stored is not very useful without access to the user's device. SimpleX Chat doesn't have to use the default SimpleX servers.

SimpleX Chat will work with Tor if used on an operating system that forces it to, such as Whonix or Tails. However, voice and video calls are generally not very functional over Tor with any application due to the latency Tor will introduce.

You can learn more about how to use SimpleX Chat with their guide.

For Anonymous Public-facing Projects

Anyone can contact the project without requiring a separate channel

Unlike the one-time invitation links that are normally used by SimpleX Chat and shared through a separate channel, you also have a long term address that can be published online so that anyone can connect to you. We recommend not enabling "Auto-accept".

Resiliency to correlation attacks

Real-time messaging applications are particularly susceptible to end-to-end correlation attacks because of the ability of an adversary, once they know their target's ID on the messaging platform, to trigger incoming network traffic on the target's side by sending them messages on the platform (when the target is online). An issue is open to address this. Message "mixing" is also planned.

Content padding exists to frustrate correlation attacks via message size.

Resiliency to exploits

A vulnerability in any application can be targeted with exploits - a severe vulnerability can allow an adversary to hack your system, such as by permitting Remote Code Execution. For public-facing project accounts, we recommend that you set SimpleX Chat preferences to only allow text (prohibiting voice messages and attachments).

Multiple project members can access the same messages

If a project has multiple members, all of them should be able to access the same messages independently. Currently, this is not possible with SimpleX Chat.

SimpleX Chat Installation on GrapheneOS


Install SimpleX Chat as you would any app that doesn't require Google Services (we don't recommend F-Droid). If you are using SimpleX Chat from behind a VPN (as we recommend) then the default relay for calls is redundant and can be turned off: Settings → Audio & video calls, disable Always use relay


SimpleX Chat Installation on Tails


  • Start Tails with an Adminstration Password.
  • Download the AppImage with Tor Browser
  • According to our Tails Best Practices, personal data should be stored on a second LUKS USB and Persistent Storage should not be enabled. Copy the .AppImage file to such a personal data LUKS USB.
  • Make the AppImage executable
    • In the File Manager, browse to the directory with the file. Right click in the File Manager and select "Open a Terminal Here"
    • Run chmod +x simplex-desktop-x86_64.AppImage and enter the Administration Password when prompted.
  • To launch, in the Terminal, run:
    • ./simplex-desktop-x86_64.AppImage
  • With Persistent Storage disabled, configuration and profile data must be restored from backup every session. Backup /home/amnesia/.local/share/simplex to the personal data LUKS USB, and copy it back to /home/amnesia/.local/share in your next session.

SimpleX Chat Installation on Qubes-Whonix


SimpleX Chat on Whonix is not guaranteed to have Tor Stream Isolation from other applications in the same qube, so we will install it in a dedicated qube. SimpleX Chat is installed in an App qube, not a Template (because it is an AppImage).

  • Download the AppImage using Tor Browser in a disposable Whonix qube.
  • Create an App qube with the Template whonix-ws-16 and networking sys-whonix.
  • Copy the file to your new App qube
  • Make the AppImage executable
    • In the File Manager, browse to the directory with the file. Right click in the File Manager and select "Open a Terminal Here"
    • Run chmod +x simplex-desktop-x86_64.AppImage
  • Reboot the App qube for SimpleX Chat to show up in the Settings > Applications tab


Signal

  • Mediums: Video call, voice call, text
  • Metadata protection: Yes (Moderate)
  • Encryption protocol: Signal Protocol, audited (2017)
  • Peer-to-peer: No
  • Tor: Not default

The Signal Protocol has a moderate amount of metadata protection; sealed sender, private contact discovery, and the private group system. Message recipient identifiers are only stored on Signal's servers for as long as it takes to deliver each message. As a result, if Signal is served with a warrant, they will only be able to provide the time of account creation and the date of the account's last connection to the Signal servers. Still, Signal relies on the Google Services Framework (though it's possible to use it without it), and the sealed sender metadata protection applies only to contacts (by default).

Signal is not peer-to-peer; it uses centralized servers that we must trust. Signal will work with Tor if used on an operating system that forces it to, such as Whonix or Tails.

Signing up for a Signal account is difficult to do anonymously. The account is tied to a phone number that the user must still control - due to changes in "registration lock", it is no longer sufficient to register with a disposable phone number. An anonymous phone number can be obtained on a burner phone or online and must be maintained - most people will not do this.

Another barrier to anonymous registration is that Signal Desktop will only work if Signal is first registered from a smartphone. For users familiar with the command line, it is possible to register an account from a computer using Signal-cli. The VoIP account used for registration would have to be obtained anonymously.

These barriers to anonymous registration mean that Signal is rarely used anonymously. This has significant implications if the State gains physical or remote access to the device. One of the primary goals of State surveillance of anarchists is network mapping, and it's common for them to gain physical access to devices through house raids or even simple arrests. For example, if your device's authentication is bypassed, it is easy for the police to identify all of your Signal contacts (as well as the members of any groups you are in) simply by their phone number.

In a recent repressive operation in France against a riotous demonstration, the police did exactly that. The phones of suspects were accessed through physically seizing them during arrests and house raids, as well as through spyware, and then Signal contacts and group members were identified. These identities were added to the list of suspects who were subsequently investigated.

A compromised device contributing to network mapping is partly mitigated by the username feature - use it to prevent a Signal contact from being able to learn your phone number. In Settings → Privacy → Phone Number, set both Who can see my number and Who can find me by number to Nobody. For voice and video calls, Signal reveals the IP address of both parties by default, which could also be used to identify Signal contacts. If you aren't using Signal from behind a VPN or Tor, then in Settings → Privacy → Advanced, enable Always relay calls to prevent this.

A company that sells spyware to governments has a product called JASMINE that is marketed to deanonymize Signal users, based on the analysis of metadata.

In its targeted interception mode which starts from a single target JASMINE has claimed it is able to identify communicating parties in encrypted but peer-to-peer applications [...] the JASMINE documentation explicitly claims support for identifying the IP addresses of participants in encrypted apps such as WhatsApp and Signal during voice and video calls where peer-to-peer connections are also used for calling by default.

The JASMINE documentation also explains that by analysing encrypted traffic “events” for a whole country in mass interception mode JASMINE has the ability to correlate and identify the participants in encrypted group chats on messaging apps.

A similar surveillance product would not work against Cwtch because it uses Tor by default. Without a Tor or VPN proxy, an adversary can see that you are connecting to Signal servers which is what enables this type of timing correlation attack. Although it is possible to configure Signal to use a VPN or Tor, it is opt-in so will always be a minority of users.

Signal was designed to bring encrypted communication to the masses, not for an anarchist threat model. Because it's very difficult to register for Signal anonymously, and because you must first install Signal on a phone to use it on a computer, we recommend prioritizing Cwtch over Signal for text communication with other anarchists, and using SimpleX Chat or Signal for voice and video calls. For the same reasons, Signal is not well-suited for anonymous public-facing projects.

Signal Installation on GrapheneOS


We recommend the Signal Configuration and Hardening Guide. As noted above, unless you are familiar with the Command Line Interface, Signal needs to be registered on a smartphone before it can be connected to a computer. Install Signal as you would any app that doesn't require Google Services (we don't recommend F-Droid). If you are using Signal from behind a VPN (as we recommend) then a relay for calls is redundant and should be turned off: Settings → Privacy → Advanced, disable Always relay calls

Molly-FOSS is a fork of Signal with hardening and anti-forensic features available on Android - we recommend it over Signal for anarchists, and extending trust to the Molly team is made easier by its reproducible builds. Follow the instructions for installing software that isn't available in the Play Store. You can migrate from an existing Signal account. Turn on database encryption.


Signal Installation on Tails


About.Privacy maintains a guide for installing Signal Desktop on Tails. There is a guide for registering an account from Tails without a smartphone (using Signal-cli), and another guide for if you already have a Signal account.

Some of the Signal Configuration and Hardening Guide also applies to Signal Desktop.


Signal Installation on Qubes-Whonix


Signal Desktop on Whonix is not guaranteed to have Tor Stream Isolation from other applications in the same qube, so we will install it in a dedicated qube. Signal Desktop is installed in a Template, not an App qube (because it is available as a .deb from a third party repository).

Some of the Signal Configuration and Hardening Guide also applies to Signal Desktop.

  • Go to Applications menu → Qubes Tools → Qube Manager
  • Clone whonix-ws-16 and name it something like whonix-ws-16-signal.
    • We do this so as not to add attack surface to the base Whonix Workstation template. If you also install other messaging applications, they could share a cloned template with a name like whonix-ws-16-e2ee
  • Open a Terminal in the new Template: Applications menu → Template: whonix-ws-16-signal: Xfce Terminal
  • Run the commands in the Signal installation guide to install Signal Desktop in the Template.
    • Note that the layout of the Signal installation guide is a bit confusing for users unfamiliar with the command line; wget and cat are separate commands, but echo in #2 is a command so long that it takes two lines (which is why the second line is indented).
    • Template qubes require a proxy for wget. Before running the command, create a configuration file at ~/.wgetrc in the Template, with the following contents:
use_proxy = on
http_proxy = 127.0.0.1:8082
https_proxy = 127.0.0.1:8082
  • Create an App qube with the Template whonix-ws-16-signal and networking sys-whonix.
  • In the Settings → Applications tab of the new App qube, move Signal to the Selected column and press OK.
  • Updates will be handled by Qubes Update as you would expect.

Alternative method

You can install Signal Desktop in a Whonix Workstation App qube using Qube Apps and not need to bother with Templates. Signal Desktop on Flathub is community maintained, not official, which is a security consideration.



PGP Email

  • Mediums: Text
  • Metadata protection: No
  • Encryption protocol: RSA or ed25519, no forward secrecy
  • Peer-to-peer: No
  • Tor: Not default

PGP (Pretty Good Privacy) is not so much a messaging platform as it is a way to encrypt messages on top of existing messaging platforms (in this case, email). PGP email does not have the encryption property of forward secrecy. The goal of forward secrecy is to protect past sessions from future key or password compromises. It maintains the secrecy of past communications even if the current communication is compromised. This means that an adversary could decrypt all future PGP messages in one fell swoop. When you also consider the metadata exposure inherent in email, PGP simply doesn't meet the standards of modern cryptography. For a more technical critique, see The PGP Problem and Stop Using Encrypted Email. Privacy Guides agrees that "email is best used for receiving transactional emails [...], not for communicating with others." We recommend that anarchists don't use PGP email for communication with other anarchists.

There is an exception: for anonymous public-facing projects, we still recommend using PGP email because it is the best option that meets the additional needs required by a public account. Use a radical server that doesn't require an invite code and read the Riseup Guide to Encrypted Email.

For Anonymous Public-facing Projects

Anyone can contact the project without requiring a separate channel

Anyone can send a message to a public email account regardless of whether the recipient is online or offline.

Resiliency to correlation attacks

Email is not a real-time messaging application - this means that it is not particularly susceptible to end-to-end correlation attacks via time.

No content padding exists to frustrate correlation attacks via message size in email protocols, but if you access the mail servers through Tor then the traffic is padded.

Resiliency to exploits

A vulnerability in any application can be targeted with exploits - a severe vulnerability can allow an adversary to hack your system, such as by permitting Remote Code Execution. Email can be accessed through webmail (via Tor Browser) or through a client like Thunderbird - these have different attack surfaces. For example, a Cwtch developer found an exploit to turn Thunderbird into a decryption oracle when it displays messages with HTML.

We recommend using Thunderbird (which is available in Tails and Qubes-Whonix by default) with the setting to display email as "Plain Text" rather than as HTML: View → Message Body As → Plain Text. Most webmail will not function with Tor Browser in "Safest" mode.

Multiple project members can access the same messages

If a project has multiple members, all of them should be able to access the same messages independently. This is straight forward with email, if all project members have the email password and the private PGP key.

Note

PGP is used for another purpose outside of communication: verifying the integrity and authenticity of files. For this use case, see our explanation.


Warnings

We do not recommend: