markuta / authy-backup

A way to extract Authy TOTP tokens using a rooted Android device.
BSD 2-Clause "Simplified" License
31 stars 2 forks source link

Random issues that I found while using the script #2

Closed MrPowerGamerBR closed 3 months ago

MrPowerGamerBR commented 3 months ago

First things first: Thanks for the script! Finally decided to dump my tokens from Authy, I hate that they deprecated the desktop app and haven't provided any way of creating a offline backup.

For some reason, when I tried to dump my tokens, some of them do not have all of the keys that the script expects, here's all the errors that I found.

Here's my patched up script that I made that fixes these issues, if you think that it is good enough, I can PR the changes :3: https://gist.github.com/MrPowerGamerBR/0b34232c319fe044d22d4cd42d0a9b07

What I also noticed is that the script should use name instead of originalName, a lot of the dumped accounts end up with my email as its name because Authy stored the originalName as my email, while name has the name of the service (yes, the originalIssuer should have the service name... but in my case not all of them have it...).

Script skips accountType that aren't authenticator, even tho the script can successfully dump them

Some of my accountType are weird... My Discord has discord as its account type, my Stripe account is stripe, so on and so forth, and because of that, the script skips the account, even tho it can successfully dump it.

I haven't thoroughly tested it yet, but the script does generate valid TOTP codes (I tested with the dumped discord and twitter accountType, and I was able to login with no issues) for these accounts.

Maybe it would be better for the script to attempt to dump any accountType, and if it fails, skip it.

Here's a reference of all the accountType that I found that weren't authenticator:

KeyError: 'originalName'

Traceback (most recent call last):
  File "C:\Users\leona\AppData\Local\Programs\Python\Python312\Lib\site-packages\frida\core.py", line 562, in _on_message
    callback(message, data)
  File "C:\Users\leona\AppData\Local\Programs\Python\Python312\Scripts\authy-totp.py", line 60, in onMessage
    parseXML(dataFile)
  File "C:\Users\leona\AppData\Local\Programs\Python\Python312\Scripts\authy-totp.py", line 97, in parseXML
    "name": data[i]["originalName"],
            ~~~~~~~^^^^^^^^^^^^^^^^
{'accountType': 'authenticator', 'decryptedSecret': '{secret_here}', 'digits': 6, 'encryptedSecret': '{encrypted_secret_here}', 'key_derivation_iterations': 100000, 'logo': 'proxmox', 'timestamp': 1568657426, 'salt': '{salt_here}', 'upload_state': 'uploaded', 'hidden': False, 'id': '1577886906', 'isNew': False, 'name': 'Stardust Proxmox'}

KeyError: 'originalIssuer'

Traceback (most recent call last):
  File "C:\Users\leona\AppData\Local\Programs\Python\Python312\Lib\site-packages\frida\core.py", line 562, in _on_message
    callback(message, data)
  File "C:\Users\leona\AppData\Local\Programs\Python\Python312\Scripts\authy-totp.py", line 60, in onMessage
    parseXML(dataFile)
  File "C:\Users\leona\AppData\Local\Programs\Python\Python312\Scripts\authy-totp.py", line 95, in parseXML
    "issuer": data[i]["originalIssuer"],
              ~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'originalIssuer'
{'accountType': 'authenticator', 'decryptedSecret': '{secret_here}', 'digits': 6, 'encryptedSecret': '{encrypted_secret_here}', 'key_derivation_iterations': 100000, 'originalName': '{my_email}', 'timestamp': 1568657426, 'salt': '{salt_here}', 'upload_state': 'uploaded', 'hidden': False, 'id': '1561743679', 'isNew': False, 'name': 'Foxbit'}
markuta commented 3 months ago

Hey @MrPowerGamerBR glad it sort of worked for you :D

I must admit it was a really fast and dirty script, I didn't put too much effort into testing (as it shows) many different accounts.

Hmm, interesting, I guess they use that field for popular services and icon packs? anyway, Happy to do a PR.