mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-03-12 09:54:49 -05:00
rbw client fails to access entries with failed to decrypt: failed to decrypt encrypted secret: invalid mac
#5617
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @polyzen on GitHub (Jul 24, 2024).
Subject of the issue
rbw client fails to access entries with the error
failed to decrypt: failed to decrypt encrypted secret: invalid mac:https://github.com/doy/rbw/issues/163
A user there stated "it may be your database schema didn't get updated on your account. I would suggest going to their project and figure out how to export and reimport fresh."
Deployment environment
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden:
Steps to reproduce
rbw get <entry>Expected behaviour
Receive the associated password
Actual behaviour
Receive the error:
Troubleshooting data
Some details may be found here: https://github.com/doy/rbw/issues/163
A fresh account does not receive this error.
@BlackDex commented on GitHub (Jul 25, 2024):
Did you also used the new mobile beta native client using that account? If so, which device? iOS or Android?
Or which other clients did you used to create new entries?
@polyzen commented on GitHub (Jul 25, 2024):
I have not tried the new beta yet.
Most likely would've created new entries on either the web or Android client. Not sure if I've actually used rbw to add or edit entries yet. I mostly use
rbw getor rofi-rbw to copy/paste stuff.Edit: I have used
rbw removeat least once, but that might've been months ago.@BlackDex commented on GitHub (Jul 25, 2024):
And do other clients still work? They show all the ciphers/entries?
@polyzen commented on GitHub (Jul 25, 2024):
Yes I haven't noticed any issues in the web and Android clients.
@BlackDex commented on GitHub (Jul 25, 2024):
Well, i do not want to bounce you around, but then i think it must be something in the rbw client.
Best would be if you are able to pinpoint the issue to a specific item in the vault and look in the database if something is off compared to others.
@polyzen commented on GitHub (Jul 25, 2024):
No worries.
😅
@awpk commented on GitHub (Jul 25, 2024):
I also tried the new app and now I can't use any client.
Desktop -> loads forever after login
Web -> just no entries
new iOS app -> shows this error
old iOS app -> crashes
EDIT: Browser extension just shows a very limited amount of entries
@awpk commented on GitHub (Jul 25, 2024):
Sorry, overread the error message above a bit. Mine is "Cryptography error, The cipher's MAC doesn't match the expected value.
@BlackDex commented on GitHub (Jul 25, 2024):
Well, that is a possible known issue with the native iOS client.
We are not yet sure if this is a Vaultwarden issue, or a client issue, i have not yet checked the Bitwarden repo's for this my self.
@awpk commented on GitHub (Jul 25, 2024):
I'm having a real issue here not having any access, not even cached on the devices I was logged in :/
@BlackDex commented on GitHub (Jul 25, 2024):
You should restore a backup, or somehow delete the cipher from the database which is causing this issue.
@awpk commented on GitHub (Jul 25, 2024):
I need my passwords to get access to backups restore 🤦 (yep will change that).
How can I find out which one it is?
@BlackDex commented on GitHub (Jul 25, 2024):
Probably the last one you edited, and then probably the one you did via the iOS Native client.
So, i would suggest to to the following.
cipherstable.updated_atso that the newest items are at the top.If you need to know your users uuid, check the
userstable and look for your email address and check theuuidthere.@awpk commented on GitHub (Jul 25, 2024):
Thank you so much @BlackDex for your fast answers.
This worked perfectly. Needed to relogin on Desktop and reinstall on iOS but I'm back in.
I will go now do som changes to my procedures and emergency measures 😅
Not sure which entries I deleted now but I guess I will find out one day.
@BlackDex commented on GitHub (Jul 25, 2024):
Hehe, you can at least now access your backup, and maybe even compare the databases and see which entries are removed. You should be able to copy that row over to the active database and it should be there again.
It would also help to determine the possible issue with rbw or Vaultwarden. There might be something in the broken database which might help.
@awpk commented on GitHub (Jul 25, 2024):
I actually just remember at least one of the entries (deleted 2) and I did some saving the entry and sharing to an organisation at the same time.
The entry also was quite important. So the row I just deleted could be copied back and it should work?
Where is the thing then that broke it?
@BlackDex commented on GitHub (Jul 25, 2024):
I wouldn't copy back the entry you deleted, at least not from the broken export at least.
But, if you know the
uuidof the ciphers, you can always copy those from a backup into thecipherstable.For me, and probably the
rbwdevs as well, it would be good to know what the difference is between the working record and the broken record.It might be something in the
datacolumn, but it could be anything. Even a broken encryption of thename,notesorfieldsentries.In theory, you should be able to share those entries without any issue, since all is stored encrypted, and without your keys we can't do anything with those items at all. If you want to share it with us, and make it a bit safer you could do the following.
As an example.
The original entry:
See there are 3 segments divided by a
|. You could convert all those items to something like this.Just keep the first 4 and last 4 characters (exclude the
=from the count)Some entries like the
dataandfieldscolumn have multiple of these items.Original:
Safer:
That might help use pinpoint the specific issue which caused all the clients to break down.
@awpk commented on GitHub (Jul 25, 2024):
Though this only works when updated I guess? I just created the entry yesterday so it will not be in a backup.
Is there a manual way I could decrypt the data to at least get raw data to manually enter back into my working vault as I actually would need at least an information from the "Notes" section of that entry to reset my password there.
I will look at the steps you provided later to hopefully give you some information about it.
@BlackDex commented on GitHub (Jul 25, 2024):
I just did a quick test, and for me it seems to at least still be accessible via the web-vault.
But you could modify the contents of the broken record per one encrypted item at a time.
You probably do not want to touch the
notescolumn of course, because that is what you need, unless that somehow is what is broken, then you might try to set that tonulland keep the rest original.You can modify the records as follow, one by one.
name>unencrypted_name(This will not work, but it will at least not break)data> Modify every single entry there to eithernullor[]one by one. With everything changed it could look like this:fields> Same as thedatacolumn.And if it all still fails, try to revert all the above and update
notes.notes>NULL(As in SQL NULL, not the text)The only UI issue would be, that if the username is not able to be decrypted, you can not click on the vault entry.
This can be worked around by clicking the 3dot's at the right of that entry, and click on
Clone, that will open the entry and make all the values visible.Edit:
For every change you make and saved to the database, you need to logout and back in again to make sure it will reload the vault and fetch the updated record.
@polyzen commented on GitHub (Jul 25, 2024):
Sorry, you seem to have misread. I have not tried the new Bitwarden beta app. You haven't mentioned using rbw, either. I think you're having a different issue? At least the troubleshooting steps seem to be useful for the rbw issue as well 😅
@BlackDex commented on GitHub (Jul 25, 2024):
@polyzen Still, the same applies for you, we need to know which cipher record is causing the issue, and what the difference is between the record with an issue, and a record without an issue.
If you are able to provide that info, that would be great.
@stefan0xC commented on GitHub (Jul 25, 2024):
@BlackDex I could be wrong but I think the difference is that Vaultwarden supports cipher key encryption #3990 and rbw does not (yet). At least that seems to be the difference between working entries and not-working ones.
I'm not sure if this can be replicated generally or is specific to my setup because I've been testing the new
web-v2024.7.1but to replicate the issue rbw users are facing I just had to add or change an entry via the web-vault.OT: Two issues I've encountered with
web-v2024.7.1are that I cannot seem to clone an entry back to my personal vault (web vault complains about a missing key) and I also can't change the user role (becauseaccess_allhas been removed and is not yet optional).@BlackDex commented on GitHub (Jul 25, 2024):
I actually think the key's are not working for us either. I could be wrong also, but haven't seen those being added on new entries actually. Not on 5 or 6.
@stefan0xC commented on GitHub (Jul 25, 2024):
With
web-v2024.5.1the entries are still decipherable (and also clonable) so I'd consider it functional for Vaultwarden.Have you checked if the new clients are producing items with cipher key encryption?
@BlackDex commented on GitHub (Jul 25, 2024):
Ill have to recheck, reverted and replaced some of my test databases, so no clue anymore which had newer entries actually.
I do have a few with keys, but those are older.
@Biepa commented on GitHub (Jul 25, 2024):
Hey @BlackDex,
This is @phillip-kaiser from another account 😅
I setup a testing instance with the broken db and the result was the same as before. So far so good. I could find the broken cipher. I deleted the two last ciphers in my first test today and the one I thought of is not the cause of this issue as I can see it again after testing out which one of the two is the reason.
So the "broken entry" just has values in "data" and "name".
Now to the suggested steps.
When trying to login after changing the value of the "name" column to "unencrypted_name" this gave a red error message at the top right saying "An Error has occured: Error saving device"
I reverted that step therefore to not mess up with further testing.
The "data" column just had "username" in it. Nothing else. I changed that to to be
{"username":null}-> can login but still broken.The only other column filled is "key".
As the db neither worked with the suggested changes to "data" or "name" (assuming I understood everything correctly) here are the values to hopefully help you finding the issue.
name =
2.Z4...pnXw==|kAtx...H3Vw=|jBmm...KCak=data =
{"username":"2.8A...E7VQ==|D5i1...pDpw==|n5i2...5iBw="}notes, fields, password_history, deleted_at =
NULLHappy to help if there is anything else I can do.
@BlackDex commented on GitHub (Jul 25, 2024):
Ok, then i think @stefan0xC is correct, and some clients might not be able to handle them, like rbw.
@BlackDex commented on GitHub (Jul 26, 2024):
So, i quickly checked and it looks like since the v2024.7.x client versions they are now using cipher key encryption by default if the server version is 2024.2.0 or newer.
Since our web-vault does not yet uses this version creating items via that route does not create the special
keyper cipher.So, using any client which isn't able to decrypt this will fail.
Therefor I'm going to close this issue as this has nothing to do with Vaultwarden it self, but more with
rbwwhich currently isn't able to decrypt those ciphers. That probably goes for all older clients, not sure which version.@polyzen commented on GitHub (Jul 26, 2024):
Thank you all 🙏. I had updated to Bitwarden Mobile 2024.7.0 on the 16th, and now found one entry that I (accidentally?) updated the day of/before I ran into this issue. AFAICT I had re-saved it with no changes.
@BlackDex commented on GitHub (Jul 26, 2024):
Saving an entry, no matter if you change it or not, will always push the cipher with newly encrypted data i think.