$ grep -rn "<password" ~/.purple/*
$ wget http://downloads.sourceforge.net/\ sourceforge/sylpheed-claws/claws-mail-3.7.8.tar.bz2 $ tar xjvf claws-mail-3.7.8.tar.bz2 $ cd claws-mail-3.7.8/src $ grep -rn password * # lots of stuff, let's get a simple file list $ grep -rn password * | cut -d':' -f1 | sort | uniq [...] common/passcrypt.c common/passcrypt.h [...] $ # here it is ! $ vim common/passcrypt.c common/passcrypt.h
When you type your password in the UNIX login prompt, the system checks that the password you gave produces the same hash that is stored in /etc/shadow; it does not check that you entered YOUR password (because it does not know it, it simply knows the hash). Thanks to the cryptographic hash functions properties, this ensures us that there is a very high probability that the password you entered was indeed yours. This propery is called collision resistance.
On the contrary, Claws-Mail HAS to know your password because the mail protocol (e.g IMAP, SMTP) states that you must provide a password. So either you type the password each time you launch Claws-Mail, either it stores it in a reversible way. Anyone who has the same knowledge as you (i.e. who knows the value of PASSCRYPT_KEY) can retrieve the password.
$ sudo grep password /home/dummy/.claws-mail/accountrc password=!U5unwpFJ3+dsOVd+IwfdyQ== $ grep -rn passcrypt_decrypt * [...] prefs_gtk.c:226: passcrypt_decrypt(tmp, len); [...] $ vim prefs_gtk.cThe deciphering is done in this file.
case P_PASSWORD:
g_free(*((gchar **)param[i].data));
if (value[0] == '!') {
gchar tmp[1024];
gint len;
len = base64_decode(tmp, &value[1], strlen(value) - 1);
passcrypt_decrypt(tmp, len);
tmp[len] = '\0';
*((gchar **)param[i].data) =
*tmp ? g_strdup(tmp) : NULL;
} else {
*((gchar **)param[i].data) =
*value ? g_strdup(value) : NULL;
}
break;
$ sudo python2 passrec.py dummy [+] found claws-mail config files for user dummy [ ] account address: dummy@gmail.com [ ] receive server: imap.gmail.com [ ] login: dummy [ ] ciphered password: U5unwpFJ3+dsOVd+IwfdyQ== [+] deciphered password: zessuperPAssw0rd
$ ./configure --with-passcrypt-key=KEYUnfortunately, the key will still be stored in the binary. So a little bit of reverse-engineering will eventually bring you the secret. Fire up gdb, break on crypt_cfb_buf, and find the key.