IntersectMBO / IntersectMBO/cardano-crypto

Prevent encryption operations to use swap files

Open
#63 3 comments 0 reactions 0 assignees View on GitHub
audit :mag:
Dominant language
C
Stars
68
Forks
42
PR merge metrics
No merged PRs in 30d

Description

I believe many of the encryption operations that are being done in memory could reach the disk if any wallet/node uses any encryption function whilst having a full memory. This would result in passphrases and private keys reaching swap files on disk, making it possible to access them.

Some of the affected functions include: `generateNew` , `xPrvChangePass` in **Wallet.hs** and `encryptedKey`,`encryptedCreate`,`encryptedCreateDirectWithTweak`,`encryptedChangePass`,`encryptedSign` in **Encrypted.hs**

In summary ensuring that encryption functions are done in memory will avoid the posibility of passphrases/keys being leaked into the disk and therefore susceptible to be stolen. A possible solution would be using `mlock` in unix and `VirtualLock` in Win32, which locks some memory space and ensures that some operations will always be executed in memory.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.