Recover lost mail password with k9mail

Let’s say you forgot your mail password, let’s say you use k9mail (maybe it works also with other clients but idk) well you can recover the password having it in plaintext.


  • An android smartphone with k9mail installed and with a working configuration (it has to know you’r password)
  • Adb
  • Usb debugging enabled
  • Optional:root

How to do it:

We have 2 ways to recover the password: one with root and one without, first without

I’ll assume you use linux.

  • Open a shell and issue the following svalo:$ adb backup -f data.ab com.fsck.k9

    -f specifies the output filename and com.fsck.k9 is the name of the app you want to extract

    • Now you have to extract the archive, on arch I used abe, it comes in the AUR abe unpack data.ab k9.tar

    • You’ll find yourself with an archive called k9.tar wich you have to extract tar xvf k9.tar

    • Now you need to find and browse the right sqlite database, I used sqlitebrowser wich comes from community repository in Arch open it and open the file called preferences_storage in the same folder run svalo:$ sqlitebrowser data/apps/com.fsck.k9/db/preferences_storage

    • Go in section browse data and select preferences_storage table, search for a primkey like <somename>.transportUri and copy it’s value, let’s say it’s "c210cCtzc2wrOi8vbWVAZXhhbXBsZS5jb206bXlwYXNzd29yZDpQTEFJTkBtYWlsLmV4YW1wbGUuY29tOjQ2NQo="

    • The value you copied is base64 encoded so it’s enough to echo "c210cCtzc2wrOi8vbWVAZXhhbXBsZS5jb206bXlwYXNzd29yZDpQTEFJTkBtYWlsLmV4YW1wbGUuY29tOjQ2NQo=" | base64 -d

      and you’ll get smtp+ssl+://

    • The filed in the position of  mypassword is the password of your account

The second method instead it’s a bit easier because with a rooted phone you can just browse trough adb shell inside /data foder untill you’ll find the com.ksck.k9 folder (usually in /data/data/com.ksck.k9 ) and pull it in a folder, you can then search for the file preferences_storage and follow the previous instructions

Credits: This blog

More Reading