💾Exporting data from a local Bitwarden vault without knowing the master password
Forgotten your Bitwarden master password but still have access to your vault via PIN or Biometrics? By manipulating the JavaScript of the Desktop app, you can easily bypass the credential prompt.
Foreword
After changing my account master password and re-authenticating the desktop app, I tried to access an individually protected item in my vault before becoming overtaken by brain fog. I panicked, thinking all the protected credentials in my vault would be lost and I would have to export the remaining non-protected credential one by one, knowing the export function was protected by a credential prompt.
After digging around in the JavaScript, I found the following workaround, allowing for a full vault export without knowing the master password. You can then delete the account, create a new one, and import this exported file, keeping all items in the vault.
Don't panic! Your data is secure as long as an attacker doesn't have physical access to your machine. Once an attacker has physical access to a machine, virtually no software protection can mitigate access of data.
Bitwarden are aware these protections can be bypassed. They add a warning under this section.

Method


Unlock the vault using either PIN or Biometrics
In the toolbar, select View, Toggle Developer Tools
In the toolbar, select File, Export Vault
In the Developer Tools window, go to the Elements tab and expand the head section
Right click app/main.js, Reveal in Sources panel
Right click app/main.js, Reveal in Sources panel Press the beautify button highlighted below
Press CTRL + F, searching for compareAndUpdateKeyHash
In this version, 2022.12.0, it is line 31731 Identify the constructor for the retrieval of the stored master hash, it will reference LocalAuthorization
Add a breakpoint to the if statement (click the line number)
n & i variables are explained for reference Return to Bitwarden and enter any text into the password field
The password is usually covered, I have uncovered for reference Press the Download button, the breakpoint will be hit and the program halted
Note the n and i variables on the right, these are the hashed values of our fake password and stored master password. Press the Console tab at the top of Developer tools, and enter n = i, then press enter (return)
This overwrites the hash of our fake password with the correct stored password hash. This method of attack is known as Pass The Hash. Go back to the Bitwarden Export view and resume execution
Press the Resume button (Mix of play and pause, blue button) You will then be asked where to save the export file
All done. If you have forgotten your master password, delete your account, then create it afresh and import this export.
Next Steps / Further Research
Last updated