# Lost your Bitwarden Master Password?

{% hint style="danger" %}
This technique doesn't work anymore. Bitwarden changed the code. There are alternative however. I might publish a new way in sometime.
{% endhint %}

## Introduction

This morning, I don't know why but I had a blank. I wasn't able to remember my Bitwarden master password. And if you know how Bitwarden works, you know that you can't recover your account if you have lost your master password. But, there is a small chance that you could be able to extract all the password from one of your connected vault if you still have access without needing your master password. Then, you can simply delete your account, create a new one and import the password in json format. Here is how I did it. It saved me a lot of hours !

### Prerequisite

First, to able able to recover all your passwords in a .json format you will need this

{% hint style="info" %}
Having still access to one of your vault (chrome, firefox or any other browser) logged in
{% endhint %}

## How to export the data

### Step 1

First, open the bitwarden app in your browser, in my case I did it with Firefox but it should be really similar with other browsers:

Navigate to this url with your browser:&#x20;

`moz-extension://5f297e69-c8a8-4659-871d-0c4e43ed600d/popup/index.html#/export`

Note: If you are using Chrome, replace `moz-extension` with `chrome-extension`.

### Step 2

Now, open the developer tools. Should be F12. Then, go in the Inspector tab.&#x20;

Ctrl+Click on `../popup/main.js`

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqXqapiBXuTHanjL4f%2Fimage.png?alt=media\&token=7e4236fc-4397-4a75-9dbc-a2c25aae3b0c)

From there, you should be redirected to the `main.js` source code.&#x20;

### Step 3

Send Ctrl+F and a input below should appear so you can search for specific line. Enter `storedKeyHash != null && keyHash != null && storedKeyHash === keyHash`

You should end up here:

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqZxMg1cYxaEVP7WIE%2Fimage.png?alt=media\&token=be4a7ee2-35a6-4ce6-9b88-a0198becf749)



### Step 4

Now we need to put a break point on the line 10409. Just click on the line 10409. Should look something like below.

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOq_IEZcJ98P99hks4m%2Fimage.png?alt=media\&token=bfb8014f-064d-43d5-b885-22191794639b)



### Step 5

This step is really important, we will now enter a random password in the master password field and submit the form.

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqfxdeOxpaMqhtsqG4%2Fimage.png?alt=media\&token=f3f516ca-4d39-4b5f-a9e2-ccecb35aebb4)

On submitting the form, you should be redirected in the debugger where you added the break point as below:

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqge-ly5jMvPybHS1g%2Fimage.png?alt=media\&token=8b3ccff0-d667-40b3-bddc-ece699f85c50)

Let's copy the value in `storedKeyHash` and replace the value of `keyHash` with it. You can hover your mouse on the variable `storedKeyHash` and a small box will pop above. Once you have copied the hash value go in the console tab and enter the following code:

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqhkpfQkENzAQ17BCy%2Fimage.png?alt=media\&token=838ff24b-a714-49cd-8ab3-b206a15841de)



Now we have replaced the value of the keyHash and it should be equal to the storedKeyHash value.&#x20;

### Step 6

This is the last step. Now it's pretty straight forward. Simply click on the "Play" button to continue the execution of the JavaScript code and you should be prompted to download the exported data in .json.&#x20;

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqiHghbifP8Dv0s9SU%2Fimage.png?alt=media\&token=76831d51-ab0a-4cf8-89f9-e82336076793)



**And voilà !**

![](https://264548672-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LZXaItVq_GEICsb1KHL%2F-MOqVTkeVovHRVEk-9L-%2F-MOqiT3zuEZ1iRPex6NN%2Fimage.png?alt=media\&token=1b74db37-b1e9-46f1-b66b-64c0aea0975b)



I hope that it worked for you. It saved me a lot of hours. I would have to copy all my password manually which would have been ridiculous.&#x20;
