How to decrypt Remmina passwords

Background

This article is about decrypting Remmina passwords. Of course it’s pretty easy to Google but the problem is the very first link on Stack is from 2013 and based on Python 2 which was prominent at the time.

To cut to the chase, you have to use the following up to date Python 3 script that takes two command line arguments:

import base64,sys
from Crypto.Cipher import DES3;
pc=open(sys.argv[1]).read();
pci=pc.index('secret=');
secret=pc[pci:pc.index('\n',pci)].split('=',1)[1];cc=open(sys.argv[2]).read();
cci=cc.index('password');
password=cc[cci:cc.index('\n',cci)].split('=',1)[1];
secret,password=base64.b64decode(secret),base64.b64decode(password);
print(DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password))

To use it, open Remmina and click on the connection that you want to examine. It will be at the bottom in the taskbar. Carefully note the path.

Next do something like this:

python decrypt.py $HOME/.config/remmina/remmina.pref ~/.local/share/remmina/THE_NAME_YOU_SAW_IN_REMMINA.remmina
b'Your-secret-will-be-displayed-here\x00\x00\x00\x00\x00'

I’ve not used Python much in my life but googling the errors that came up as I converted it from Python 2 to 3 was fairly easy.

Here is a quick summary of them:

Possible errors

ModuleNotFoundError: No module named ‘Crypto’

Do this:

pip3 install pycryptodome

AttributeError: module ‘base64’ has no attribute ‘decodestring’

The original script had decodestring but you have to use b64decode. References on the internet also refer to decodebytes but I don’t think it works with any old string.

binascii.Error: Incorrect padding

I got this error when I didn’t have the correct files specified in the path.

References

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top