Improve Mnemonic + Password handling security #150
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Abstract
Previously, MPW left 'residue' of sensitive data such as Passwords and Mnemonics in memory (by keeping it in the HTML input values), thus, for example, after creating a new MPW wallet - as long as that initial session is open, your mnemonic is recoverable. The same goes for passwords; as long as the Prompt box was not reused, they were recoverable.
This PR fixes this by immediately wiping sensitive data from these input boxes as soon as possible.
Testing
Try this console command after Creating a new wallet:
document.getElementById('ModalMnemonicContent').innerText
Try this console command after Unlocking your wallet:
document.getElementById('restoreWalletPassword').value
In
master
MPW, those will return sensitive data - in this PR, all sensitive input boxes should be cleanly empty immediately after completing an action (Unlock, New Wallet, etc).What does this PR address?
It addresses a potential, and very simple security leak in the UI, which could've been exploited by malware or even a malicious user with access to one's device locally or remotely.
What features or improvements were added?
N/A, security improvement only.
How does this benefit users?
MPW is slightly more resilient to easy attacks - yay!