en	[[!meta date="Thu, 07 May 2015 12:34:56 +0000"]]

en	[[!meta title="Claws Mail leaks plaintext of encrypted emails to IMAP server"]]
es	[[!meta title="Claws Mail filtra el texto plano de los correos electrónicos cifrados al servidor IMAP"]]

en	[[!pagetemplate template="news.tmpl"]]

en	[[!tag security/fixed]]

en	We discovered that *Claws Mail*, the email client in Tails, stores plaintext copies of all emails on the remote IMAP server, including those that are meant to be encrypted.

en	When sending an email, *Claws Mail* copies the email in plaintext to the sending queue of the IMAP server before encrypting the email. *Claws Mail* deletes this plaintext copy after sending the email.

en	*Claws Mail* drafts in plaintext on the server. An email can be saved as draft either:

en	Manually by clicking on the **Draft** button when composing an email.

en	Automatically if you selected the **automatically save message to Draft folder** option in the writing preferences. This option is deselected by default in Tails.

en	**All users of *Claws Mail* using IMAP and its OpenPGP plug-in are affected.**

en	Users of *Claws Mail* using POP are not affected.

en	<div class="tip">

en	To know if you are using IMAP or POP, choose <span class="menuchoice"> <span class="guimenu">Configuration</span>&nbsp;▸ <span class="guimenuitem">Edit accounts&hellip;</span></span> and refer to the <span class="guilabel">Protocol</span> column in the list of accounts.

en	</div>

en	Unfortunately, we were not yet able to fix the problem automatically and for everybody. This would require to either modify *Claws Mail* or to migrate to a different application. Refer to the workarounds section to solve this problem in your setup and please warn others around you.

en	[[!toc levels=2]]

en	Workarounds

en	Verify the content of your **Drafts** folder

en	First of all, verify the content of the **Drafts** folder on the server, either through *Claws Mail* or through the web interface of your email provider. Delete any plaintext email that might have been stored against your will in this folder until now.

en	Then apply one of the other two workarounds to prevent more leaks in the future.

en	Use POP instead of IMAP

en	*Claws Mail* can connect to the email server using either the IMAP or POP protocol.

en	With IMAP, *Claws Mail* constantly synchronizes with the server and displays the emails and folders that are currently stored on the server. IMAP is better suited if you access your emails from different operating systems.

en	With POP, *Claws Mail* downloads the emails that are in the inbox on the server and possibly removes them from the server. POP is better suited if you access emails from Tails only and store them in the persistent volume.

en	To know more, see also this Yahoo! Help page on [comparing the differences between POP and IMAP](https://help.yahoo.com/kb/mail-for-desktop/compare-differences-pop-imap-sln3769.html).

en	POP is not affected at all by this security problem. When using POP, only encrypted emails are sent to the server. So consider switching to POP if you have an email account dedicated to your activities on Tails. To do so:

en	1. Choose **File**&nbsp;▸ **Add mailbox**&nbsp;▸ **MH&hellip;** to create a local mailbox where to download your emails.

en	1. To store the mailbox in the persistent volume, specify `.claws-mail/Mail` as location. Make sure to type the `.` before `claws-mail/Mail`.

en	[[!img claws_mail_leaks_plaintext_to_imap/add_mailbox.png link="no"]]

en	1. Choose **Configuration**&nbsp;▸ **Edit accounts&hellip;**, select your IMAP account in the list of accounts, and click **Delete** to delete it. Doing so does not delete any email stored on the server.

en	1. Click **New** and configure this new account as specified by your email provider.

en	In the **Basic** tab, make sure that the **Protocol** option is set to **POP3**.

en	In the **Receive** tab, click on the **Browse** button of the **Default Inbox** option and select the **Inbox** folder of the mailbox that you created in step 2.

en	[[!img claws_mail_leaks_plaintext_to_imap/select_inbox.png link="no"]]

en	If you want to keep a copy of the received emails on the server, verify the preferences in the **Receive** tab. We recommend you to disable the **Remove messages on server when received** option until you make sure that the emails are stored in the persistent volume.

en	1. Close the preferences dialog and the list of accounts to go back to the main window of *Claws Mail*.

en	1. Click on the **Get Mail** button to download all emails from the inbox on the server. Emails in other folders are not downloaded.

en	Use local **Drafts** and **Queue** folders

en	If you want to continue using IMAP, you should configure your IMAP account to use **Drafts** and **Queue** folders stored in Tails instead of on the server. To do so:

en	1. Choose **Add mailbox**&nbsp;▸ **MH&hellip;** to create a local mailbox where to save your drafts and queued emails.

en	1. Choose **Configuration**&nbsp;▸ **Edit accounts&hellip;**, select your IMAP account in the list of accounts, and click **Edit** to edit its preferences.

en	Select **Advanced** in the left pane.

en	1. Select the **Put queued messages in** option, click **Browse**, and select the **Queue** folder of the **MH** mailbox.

en	1. Select the **Put draft messages in** option, click **Browse**, and select the **Drafts** folder of the **MH** mailbox.

en	[[!img claws_mail_leaks_plaintext_to_imap/local_folders.png link="no"]]

en	Long term solution

en	As for the possible long term solutions to this problem, we are considering:

en	Getting the development team of *Claws Mail* to [fix the problem upstream](http://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=2965). We contacted them about this problem already. Please help them provide a technical solution if you can.

en	Replacing *Claws Mail* with *Icedove* (the name of *Mozilla Thunderbird* in Debian). We have been willing to do so for years and this problem motivates us to move faster.

en	Technical details

en	Leak through the sending queue

en	When sending an email from an IMAP account, *Claws Mail* does the following:

en	1. It connects to the IMAP server and stores a plaintext copy of the email in the **Queue** folder on the server.

en	It encrypts the email locally.

en	It sends the encrypted email through the SMTP server.

en	1. It connects to the IMAP server and stores an encrypted copy of the email in the **Sent** folder on the server.

en	1. It connects to the IMAP server and deletes the plaintext email saved in step 1 from the **Queue** folder.